Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Commit

Permalink
GH-206 Configureable 'tune' property for rtmp video encoding
Browse files Browse the repository at this point in the history
'tune' property is now configureable, used to set the property in
x264enc (see http://mewiki.project357.com/wiki/X264_Settings).
Also added a note about setting other outputs to be leaky when
using rtmp.  As well, added connecting signal to video quality
spinbox that was missing
  • Loading branch information
mcchong authored and zxiiro committed Feb 23, 2013
1 parent 2d8aa00 commit af03a42
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions src/freeseer/plugins/output/rtmp-streaming/rtmp-streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class RTMPOutput(IOutput):
url = ""
audio_quality = 0.3
video_bitrate = 2400
video_tune='none'

TUNE_VALUES = ['none', 'film', 'animation', 'grain', 'stillimage', 'psnr', 'ssim', 'fastdecode', 'zerolatency']

#@brief - RTMP Streaming plugin.
# Structure for function was based primarily off the ogg function
Expand Down Expand Up @@ -108,7 +111,9 @@ def get_output_bin(self, audio=True, video=True, metadata=None):
bin.add(videoqueue)

videocodec = gst.element_factory_make("x264enc", "videocodec")
videocodec.set_property('tune', 'zerolatency')
videocodec.set_property("bitrate", int(self.video_bitrate))
if self.video_tune != 'none':
videocodec.set_property('tune', self.video_tune)
bin.add(videocodec)

# Setup ghost pads
Expand Down Expand Up @@ -192,6 +197,32 @@ def get_widget(self):
self.spinbox_video_quality.setMaximum(16777215)
self.spinbox_video_quality.setValue(2400) # Default value 2400
layout.addRow(self.label_video_quality, self.spinbox_video_quality)

self.widget.connect(self.spinbox_video_quality, QtCore.SIGNAL('valueChanged(int)'), self.set_video_bitrate)

#
# Video Tune
#

self.label_video_tune = QtGui.QLabel("Video Tune")
self.combobox_video_tune = QtGui.QComboBox()
self.combobox_video_tune.addItem("autovideosink")
self.combobox_video_tune.addItem("ximagesink")
self.combobox_video_tune.addItem("xvimagesink")
self.combobox_video_tune.addItem("gconfvideosink")
layout.addRow(self.label_video_tune, self.combobox_video_tune)

self.widget.connect(self.combobox_video_tune,
QtCore.SIGNAL('currentIndexChanged(const QString&)'),
self.set_video_tune)

#
# Note
#

self.label_video_tune_note = QtGui.QLabel("*For RTMP streaming, all other outputs must be set to leaky")
layout.addRow(self.label_video_quality)


return self.widget

Expand All @@ -215,8 +246,13 @@ def set_video_bitrate(self):
self.plugman.plugmanc.registerOptionFromPlugin(self.CATEGORY, self.get_config_name(), "Video Bitrate", str(self.video_bitrate))
self.plugman.save()

def set_video_tune(self, tune):
self.video_tune = tune
self.plugman.plugmanc.registerOptionFromPlugin(self.CATEGORY, self.get_config_name(), "Video Tune", str(self.video_tune))
self.plugman.save()

def get_properties(self):
return ['StreamURL', 'AudioQuality', 'VideoBitrate']
return ['StreamURL', 'AudioQuality', 'VideoBitrate', 'VideoTune']

def get_property_value(self, property):
if property == "StreamURL":
Expand All @@ -225,6 +261,8 @@ def get_property_value(self, property):
return self.audio_quality
elif property == "VideoBitrate":
return self.video_bitrate
elif property == "VideoTune":
return self.video_tune
else:
return "There's no property with such name"

Expand All @@ -235,6 +273,8 @@ def set_property_value(self, property, value):
return self.set_audio_quality(value)
elif property == "VideoBitrate":
return self.set_video_bitrate(value)
elif property == "VideoTune":
return self.set_video_tune(value)
else:
return "Error: There's no property with such name"

0 comments on commit af03a42

Please sign in to comment.