From 38677a237436ac49ccc2a821293f153786c975f4 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 13 Mar 2012 21:57:57 -0700 Subject: [PATCH 1/2] Adding a justintv component. Fixes #13 --- configure.ac | 1 + flumotion/component/consumers/Makefile.am | 1 + .../component/consumers/justintv/Makefile.am | 10 ++++ .../component/consumers/justintv/__init__.py | 18 ++++++ .../component/consumers/justintv/justintv.py | 60 +++++++++++++++++++ .../component/consumers/justintv/justintv.xml | 55 +++++++++++++++++ 6 files changed, 145 insertions(+) create mode 100644 flumotion/component/consumers/justintv/Makefile.am create mode 100644 flumotion/component/consumers/justintv/__init__.py create mode 100644 flumotion/component/consumers/justintv/justintv.py create mode 100644 flumotion/component/consumers/justintv/justintv.xml diff --git a/configure.ac b/configure.ac index 37be3ca2..ecdc2d43 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/flumotion/component/consumers/Makefile.am b/flumotion/component/consumers/Makefile.am index dc2a1818..d7ed6839 100644 --- a/flumotion/component/consumers/Makefile.am +++ b/flumotion/component/consumers/Makefile.am @@ -15,6 +15,7 @@ SUBDIRS = \ icystreamer \ hlsstreamer \ httpstreamer \ + justintv \ pipeline \ preview \ shout2 diff --git a/flumotion/component/consumers/justintv/Makefile.am b/flumotion/component/consumers/justintv/Makefile.am new file mode 100644 index 00000000..e99ed9e3 --- /dev/null +++ b/flumotion/component/consumers/justintv/Makefile.am @@ -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) diff --git a/flumotion/component/consumers/justintv/__init__.py b/flumotion/component/consumers/justintv/__init__.py new file mode 100644 index 00000000..2157e846 --- /dev/null +++ b/flumotion/component/consumers/justintv/__init__.py @@ -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 $" diff --git a/flumotion/component/consumers/justintv/justintv.py b/flumotion/component/consumers/justintv/justintv.py new file mode 100644 index 00000000..1d8da5f4 --- /dev/null +++ b/flumotion/component/consumers/justintv/justintv.py @@ -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 diff --git a/flumotion/component/consumers/justintv/justintv.xml b/flumotion/component/consumers/justintv/justintv.xml new file mode 100644 index 00000000..ece0f92f --- /dev/null +++ b/flumotion/component/consumers/justintv/justintv.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 38fe00bd46a335b71ad41d90fad0f040ebacd592 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Fri, 1 Aug 2014 11:50:33 +0930 Subject: [PATCH 2/2] Adding a mp4 muxer. --- flumotion/component/muxers/Makefile.am | 1 + flumotion/component/muxers/mp4.py | 36 ++++++++++++++++++++++++ flumotion/component/muxers/muxers.xml | 20 +++++++++++++ flumotion/component/muxers/wizard_gtk.py | 4 +++ 4 files changed, 61 insertions(+) create mode 100644 flumotion/component/muxers/mp4.py diff --git a/flumotion/component/muxers/Makefile.am b/flumotion/component/muxers/Makefile.am index 7b0bbf3d..68e91439 100644 --- a/flumotion/component/muxers/Makefile.am +++ b/flumotion/component/muxers/Makefile.am @@ -6,6 +6,7 @@ component_PYTHON = \ checks.py \ webm.py \ multipart.py \ + mp4.py \ ogg.py \ wizard_gtk.py diff --git a/flumotion/component/muxers/mp4.py b/flumotion/component/muxers/mp4.py new file mode 100644 index 00000000..f003100b --- /dev/null +++ b/flumotion/component/muxers/mp4.py @@ -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 diff --git a/flumotion/component/muxers/muxers.xml b/flumotion/component/muxers/muxers.xml index d8dd5c10..84c1994c 100644 --- a/flumotion/component/muxers/muxers.xml +++ b/flumotion/component/muxers/muxers.xml @@ -63,6 +63,25 @@ + + + + + + + + + + + + + + + @@ -85,6 +104,7 @@ + diff --git a/flumotion/component/muxers/wizard_gtk.py b/flumotion/component/muxers/wizard_gtk.py index 9d6f7e61..af33a758 100644 --- a/flumotion/component/muxers/wizard_gtk.py +++ b/flumotion/component/muxers/wizard_gtk.py @@ -33,3 +33,7 @@ class MultipartWizardPlugin(base.MuxerPlugin): class WebMWizardPlugin(base.MuxerPlugin): requirements = ['webmmux'] + + +class MP4MWizardPlugin(base.MuxerPlugin): + requirements = ['mp4mux']