Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mp4 muxer #5

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ flumotion/component/consumers/fgdp/Makefile
flumotion/component/consumers/icystreamer/Makefile
flumotion/component/consumers/httpstreamer/Makefile
flumotion/component/consumers/hlsstreamer/Makefile
flumotion/component/consumers/justintv/Makefile
flumotion/component/consumers/pipeline/Makefile
flumotion/component/consumers/preview/Makefile
flumotion/component/consumers/shout2/Makefile
Expand Down
1 change: 1 addition & 0 deletions flumotion/component/consumers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SUBDIRS = \
icystreamer \
hlsstreamer \
httpstreamer \
justintv \
pipeline \
preview \
shout2
10 changes: 10 additions & 0 deletions flumotion/component/consumers/justintv/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include $(top_srcdir)/common/python.mk

component_PYTHON = __init__.py justintv.py
componentdir = $(libdir)/flumotion/python/flumotion/component/consumers/justintv
component_DATA = justintv.xml

clean-local:
rm -rf *.pyc *.pyo

EXTRA_DIST = $(component_DATA)
18 changes: 18 additions & 0 deletions flumotion/component/consumers/justintv/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Public License version 2.1 as published by
# the Free Software Foundation.
# This file is distributed without any warranty; without even the implied
# warranty of merchantability or fitness for a particular purpose.
# See "LICENSE.LGPL" in the source distribution for more information.
#
# Headers in this file shall remain intact.

__version__ = "$Rev: 5969 $"
60 changes: 60 additions & 0 deletions flumotion/component/consumers/justintv/justintv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Public License version 2.1 as published by
# the Free Software Foundation.
# This file is distributed without any warranty; without even the implied
# warranty of merchantability or fitness for a particular purpose.
# See "LICENSE.LGPL" in the source distribution for more information.
#
# Headers in this file shall remain intact.

from flumotion.component import feedcomponent

__all__ = ['Consumer']
__version__ = "$Rev: 7162 $"


class JustinTV(feedcomponent.MultiInputParseLaunchComponent):
LINK_MUXER=False

def get_pipeline_string(self, properties):
self._justintv_user = properties['justintv-user']
self._justintv_key = properties['justintv-key']

assert 'video' in self.eaters
assert 'audio' in self.eaters

# These settings from from
# http://apiwiki.justin.tv/mediawiki/index.php/VLC_Broadcasting_API

#video/x-raw-yuv, width= !
#x264{keyint=60,idrint=2},vcodec=h264,vb=300
videopipe = """\
@ eater:video @ !
videoscale !
x264enc bframes=0 key-int-max=2 bitrate=300 !
muxer.
"""
# acodec=mp4a,ab=32,channels=2,samplerate=2205
audiopipe = """\
@ eater:audio @ !
audioconvert !
audioresample !
audio/x-raw-int,channels=1,samplerate=44100 !
lamemp3enc bitrate=64 mono=1 target=bitrate cbr=1 !
muxer.
"""
# gst-launch-0.10 -v videotestsrc ! ffenc_flv ! flvmux ! rtmpsink location='rtmp://live.justin.tv/app/live_22076196_raZAJ55hsNU4Z9LN130N1GL71KJok6 live=1'
outputpipe = """\
flvmux name=muxer streamable=true !
rtmpsink location="rtmp://live.justin.tv/app/%s live=1"
""" % (self._justintv_key)

return videopipe + "\n\n" + audiopipe + "\n\n" + outputpipe
55 changes: 55 additions & 0 deletions flumotion/component/consumers/justintv/justintv.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<registry>

<components>
<component type="justintv-consumer"
base="flumotion/component/consumers/justintv"
_description="A GStreamer to Justin.TV exporter.">
<source location="flumotion.component.consumers.justintv.justintv" />
<eater name="default" multiple="yes" />
<entries>
<entry type="component" location="justintv.py"
function="JustinTV" />
</entries>

<synchronization required="yes" />

<properties>
<property name="justintv-user" type="string" required="yes"
_description="The Justin.TV username." />
<property name="justintv-key" type="string" required="yes"
_description="The Justin.TV live 'Stream Key'. Can be found at http://www.justin.tv/broadcast/adv_other" />
</properties>
</component>
</components>


<bundles>

<bundle name="justintv-consumer-base">
<dependencies>
<dependency name="component-base" />
</dependencies>

<directories>
<directory name="flumotion/component/consumers/justintv">
<filename location="__init__.py" />
</directory>
</directories>
</bundle>

<bundle name="justintv-consumer-component">
<dependencies>
<dependency name="component" />
<dependency name="justintv-consumer-base" />
</dependencies>

<directories>
<directory name="flumotion/component/consumers/justintv">
<filename location="justintv.py" />
</directory>
</directories>
</bundle>

</bundles>

</registry>
1 change: 1 addition & 0 deletions flumotion/component/muxers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ component_PYTHON = \
checks.py \
webm.py \
multipart.py \
mp4.py \
ogg.py \
wizard_gtk.py

Expand Down
36 changes: 36 additions & 0 deletions flumotion/component/muxers/mp4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Public License version 2.1 as published by
# the Free Software Foundation.
# This file is distributed without any warranty; without even the implied
# warranty of merchantability or fitness for a particular purpose.
# See "LICENSE.LGPL" in the source distribution for more information.
#
# Headers in this file shall remain intact.

from flumotion.common import messages
from flumotion.common.i18n import N_, gettexter
from flumotion.component import feedcomponent
from flumotion.worker.checks import check

__version__ = "$Rev$"
T_ = gettexter()


class MP4(feedcomponent.MuxerComponent):
checkTimestamp = True

def do_check(self):
return check.do_check(self, check.checkPlugin, 'isomp4',
'gst-plugins-ugly', (0, 10, 24))

def get_muxer_string(self, properties):
muxer = 'mp4mux name=muxer streamable=true'
return muxer
20 changes: 20 additions & 0 deletions flumotion/component/muxers/muxers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@
</wizard>
</component>

<component type="mp4-muxer" base="flumotion/component/muxers"
_description="Muxes encoded feeds into an MP4 feed.">
<source location="flumotion.component.muxers.mp4"/>
<feeder name="default"/>
<eater name="default" multiple="yes"/>
<entries>
<entry type="component" location="mp4.py"
function="MP4"/>
<entry type="wizard" location="wizard_gtk.py"
function="MP4WizardPlugin"/>
</entries>
<wizard _description="MP4" type="muxer"
feeder="default" eater="default">
<accept-format media-type="h264"/>
<accept-format media-type="aac"/>
<accept-format media-type="mp3"/>
<provide-format media-type="mp4" />
</wizard>
</component>
</components>

<bundles>
Expand All @@ -85,6 +104,7 @@
<filename location="multipart.py" />
<filename location="ogg.py" />
<filename location="webm.py" />
<filename location="mp4.py" />
<filename location="checks.py" />
<filename location="wizard_gtk.py" />
</directory>
Expand Down
4 changes: 4 additions & 0 deletions flumotion/component/muxers/wizard_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ class MultipartWizardPlugin(base.MuxerPlugin):

class WebMWizardPlugin(base.MuxerPlugin):
requirements = ['webmmux']


class MP4MWizardPlugin(base.MuxerPlugin):
requirements = ['mp4mux']