Commit 9d610e16 authored by Christian Schaller's avatar Christian Schaller

Add preset files and rename old preset directory profiles.

Add misc code for changing framerate and more
parent 4d921fd5
AUTOMAKE_OPTIONS = dist-bzip2
SUBDIRS = bin src common po debian presets
SUBDIRS = bin src common po debian presets profiles
@INTLTOOL_DESKTOP_RULE@
......
......@@ -71,6 +71,7 @@ common/Makefile
common/m4/Makefile
src/Makefile
presets/Makefile
profiles/Makefile
debian/Makefile
po/Makefile.in
transmageddon.spec
......
[_presets_]
version=0.10
element-name=GstFaac
[Profile Low Complexity]
_meta/comment=Low Complexity Profile
profile=LC
[Profile Main]
_meta/comment=Main Profile
profile=MAIN
[Profile Sample Rate Scalable]
_meta/comment=Sample Rate Scalable Profile
profile=SSR
[Profile Long Term Prediction]
_meta/comment=Long Term Prediction Profile
profile=LTP
[Quality Low]
_meta/comment=Low quality
bitrate=96000
[Quality Normal]
bitrate=128000
[Quality High]
bitrate=200000
[_presets_]
version=0.10.22.3
element-name=GstX264Enc
[Profile Baseline]
_meta/comment=Baseline Profile
bframes=0
cabac=false
dct8x8=false
[Profile Main]
_meta/comment=Main Profile
cabac=true
dct8x8=false
[Profile High]
_meta/comment=High Profile
cabac=true
dct8x8=true
[Quality Low]
_meta/comment=Low quality
pass=qual
quantizer=27
subme=4
threads=0
[Quality Normal]
_meta/comment=Normal quality
pass=qual
quantizer=21
me=umh
subme=6
ref=3
threads=0
[Quality High]
_meta/comment=High quality
pass=qual
quantizer=18
me=umh
subme=6
ref=3
threads=0
presetdir = $(datadir)/transmageddon/presets
preset_DATA = ipod.xml ps3.xml linux-computer.xml n800.xml
presetdir = $(datadir)/gstreamer-0.10/presets
preset_DATA = ffenc_mpeg4.prs GstFaac.prs
EXTRA_DIST = ffenc_mpeg4.prs GstFaac.prs
EXTRA_DIST = ipod.xml ps3.xml linux-computer.xml n800.xml
These files are here temporarily until further testing and development
has been done. They will eventually move into respective GStreamer
modules.
[_presets_]
version=0.10
element-name=ffenc_mpeg4
[Profile Simple]
_meta/comment=Simple Profile
max-bframes=0
pass=cbr
[Profile Advanced Simple]
_meta/comment=Advanced Simple Profile
max-bframes=8
flags=0x00000030
pass=quant
[Profile Main]
_meta/comment=Main Profile
[Profile Core]
_meta/comment=Core Profile
[Quality Low]
_meta/comment=Low quality
[Quality Normal]
_meta/comment=Normal quality
bitrate=12000
[Quality High]
_meta/comment=High quality
presetdir = $(datadir)/transmageddon/presets
preset_DATA = ipod.xml ps3.xml linux-computer.xml n800.xml krzr-k1v.xml
EXTRA_DIST = ipod.xml ps3.xml linux-computer.xml n800.xml krzr-k1v.xml
......@@ -3,38 +3,38 @@
<device>
<make>Nokia</make>
<model>N800</model>
<description>Profile for Nokia 800</description>
<description>Profile for Nokia N800</description>
<author>
<name>Christian Schaller</name>
<email>uraeus@gnome.org</email>
<email>christian.schaller@collabora.co.uk</email>
</author>
<version>1.0</version>
<icon>file://psp.svg</icon>
<icon>file://ipod.svg</icon>
<default>Normal</default>
<preset>
<name>Low</name> # This is a low quality output setting
<name>Low</name>
<container>video/quicktime,variant=iso</container>
<extension>mp4</extension>
<audio>
<name>audio/mpeg,mpegversion=1,layer=3</name>
<name>audio/mpeg,mpegversion=[4, 2]</name>
<passes>
<pass>
Quality Low,Profile Low Complexity
Quality Low, Profile Low Complexity
</pass>
</passes>
<channels>1, 2</channels>
</audio>
<video>
<name>video/mpeg,mpegversion=4</name>
<name>video/x-h264</name>
<passes>
<pass>
Quality Low,Profile Baseline
Quality Low, Profile Baseline
</pass>
</passes>
<width>320, 640</width>
<height>240, 480</height>
<rate>1, 25</rate>
<width>320, 400</width>
<height>240, 240</height>
<rate>1, 22</rate>
</video>
</preset>
<preset>
......@@ -42,10 +42,10 @@
<container>video/quicktime,variant=iso</container>
<extension>mp4</extension>
<audio>
<name>audio/mpeg,mpegversion=1,layer=3</name>
<name>audio/mpeg,mpegversion=[4, 2]</name>
<passes>
<pass>
Quality Normal,Profile Low Complexity
Quality Normal, Profile Low Complexity
</pass>
</passes>
<channels>1, 2</channels>
......@@ -54,12 +54,12 @@
<name>video/mpeg,mpegversion=4</name>
<passes>
<pass>
Quality Normal,Profile Baseline
Quality Normal, Profile Simple
</pass>
</passes>
<width>320, 640</width>
<height>240, 480</height>
<rate>1, 30</rate>
<width>320, 400</width>
<height>240, 240</height>
<rate>1, 23</rate>
</video>
</preset>
</device>
......@@ -40,7 +40,8 @@ class Transcoder(gobject.GObject):
'got-eos' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [])
}
def __init__(self, FILECHOSEN, FILENAME, CONTAINERCHOICE, AUDIOCODECVALUE, VIDEOCODECVALUE, PRESET, OHEIGHT, OWIDTH):
def __init__(self, FILECHOSEN, FILENAME, CONTAINERCHOICE, AUDIOCODECVALUE, VIDEOCODECVALUE, PRESET,
OHEIGHT, OWIDTH, FRATENUM, FRATEDEN):
gobject.GObject.__init__(self)
......@@ -53,6 +54,8 @@ class Transcoder(gobject.GObject):
self.preset = PRESET
self.oheight = OHEIGHT
self.owidth = OWIDTH
self.fratenum = FRATENUM
self.frateden = FRATEDEN
# Choose plugin and file suffix based on Container name
containercaps = codecfinder.containermap[CONTAINERCHOICE]
......@@ -108,25 +111,51 @@ class Transcoder(gobject.GObject):
hmin, hmax = preset.vcodec.height
width, height = self.owidth, self.oheight
self.vpreset = []
voutput = preset.acodec.passes[0].split(", ")
voutput = preset.vcodec.passes[0].split(", ")
for x in voutput:
self.vpreset.append(x)
self.apreset = []
aoutput = preset.acodec.passes[0].split(", ")
for x in aoutput:
self.apreset.append(x)
# Scale width / height down
if self.owidth > wmax:
print "output video smaller than input video, scaling"
# print "output video smaller than input video, scaling"
width = wmax
height = int((float(wmax) / self.owidth) * self.oheight)
print "starting with height " + str(width) + " " + str(height)
if height > hmax:
height = hmax
width = int((float(hmax) / self.oheight) * self.owidth)
print "width if needed " + str(width) + " " + str(height)
return height, width
# Some encoders like x264enc are not able to handle odd height or widths
if width % 2:
width += 1
if height % 2:
height += 1
print "scaled output size " + str(height) + " " + str(width)
# Setup video framerate and add to caps -
# FIXME: Is minimum framerate really worthwhile checking for?
# =================================================================
rmin = preset.vcodec.rate[0].num / \
float(preset.vcodec.rate[0].denom)
print "rmin er " + str(rmin)
rmax = preset.vcodec.rate[1].num / \
float(preset.vcodec.rate[1].denom)
print "rmax er " + str(rmax)
orate = self.fratenum / self.frateden
if orate > rmax:
num = preset.vcodec.rate[1].num
denom = preset.vcodec.rate[1].denom
elif orate < rmin:
num = preset.vcodec.rate[0].num
denom = preset.vcodec.rate[0].denom
else:
num = self.fratenum
denom = self.frateden
return height, width, num, denom
def noMorePads(self, dbin):
self.transcodefileoutput.set_state(gst.STATE_PAUSED)
......@@ -172,9 +201,8 @@ class Transcoder(gobject.GObject):
self.pipeline.add(self.audioencoder)
if self.preset != "nopreset":
for x in self.apreset:
self.audioencoder.load_preset=(x)
print "audio preset applied " + str(x)
self.audioencoder.load_preset(x)
self.gstaudioqueue = gst.element_factory_make("queue")
self.pipeline.add(self.gstaudioqueue)
......@@ -197,16 +225,21 @@ class Transcoder(gobject.GObject):
self.vcaps = gst.Caps()
self.vcaps.append_structure(gst.Structure("video/x-raw-rgb"))
height, width = self.provide_presets()
height, width, num, denom = self.provide_presets()
for vcap in self.vcaps:
vcap["width"] = width
vcap["height"] = height
print self.vcaps
vcap["framerate"] = gst.Fraction(num, denom)
print self.vcaps
self.vcapsfilter = gst.element_factory_make("capsfilter")
self.vcapsfilter.set_property("caps", self.vcaps)
self.pipeline.add(self.vcapsfilter)
self.videorate = gst.element_factory_make("videorate", "videorate")
self.pipeline.add(self.videorate)
self.videoscaler = gst.element_factory_make("videoscale", "videoscaler")
self.videoscaler.set_property("method", int(2))
self.pipeline.add(self.videoscaler)
......@@ -215,15 +248,17 @@ class Transcoder(gobject.GObject):
self.pipeline.add(self.videoencoder)
if self.preset != "nopreset":
for x in self.vpreset:
self.videoencoder.load_preset=(x)
print "video preset applied " + str(x)
bob = self.videoencoder.load_preset(x)
print "preset is getting set " + str(bob)
print "and the name of preset is " + str(x)
self.gstvideoqueue = gst.element_factory_make("queue")
self.pipeline.add(self.gstvideoqueue)
sink_pad.link(self.colorspaceconverter.get_pad("sink"))
if self.preset != "nopreset":
self.colorspaceconverter.link(self.videoscaler)
self.videoscaler.link(self.vcapsfilter)
self.videoscaler.link(self.videorate)
self.videorate.link(self.vcapsfilter)
self.vcapsfilter.link(self.colorspaceconvert2)
self.colorspaceconvert2.link(self.videoencoder)
else:
......@@ -233,6 +268,7 @@ class Transcoder(gobject.GObject):
self.colorspaceconverter.set_state(gst.STATE_PAUSED)
if self.preset != "nopreset":
self.videoscaler.set_state(gst.STATE_PAUSED)
self.videorate.set_state(gst.STATE_PAUSED)
self.vcapsfilter.set_state(gst.STATE_PAUSED)
self.colorspaceconvert2.set_state(gst.STATE_PAUSED)
self.videoencoder.set_state(gst.STATE_PAUSED)
......
......@@ -264,7 +264,7 @@ class TransmageddonUI (gtk.glade.XML):
"min": min,
"sec": sec,
}
if percent_remain > 1:
if percent_remain > 0.5:
self.ProgressBar.set_text(_("Estimated time remaining: ") + str(time_rem))
return True
else:
......@@ -303,7 +303,7 @@ class TransmageddonUI (gtk.glade.XML):
if d.is_video:
print "there is videodata"
self.videodata = { 'videowidth' : d.videowidth, 'videoheight' : d.videoheight,
'videolenght' : d.videolength }
'videolenght' : d.videolength, 'fratenum' : d.videorate.num, 'frateden' : d.videorate.denom }
self.videoinformation.set_markup(''.join(('<small>', 'Video height&#47;width: ', str(self.videodata['videoheight']),
"x", str(self.videodata['videowidth']), '</small>')))
if d.is_audio:
......@@ -311,6 +311,7 @@ class TransmageddonUI (gtk.glade.XML):
self.audioinformation.set_markup(''.join(('<small>', 'Audio channels: ', str(self.audiodata['audiochannels']), '</small>')))
def discover(self, path):
self.videodata ={}
def discovered(d, is_media):
if is_media:
self.succeed(d)
......@@ -339,13 +340,17 @@ class TransmageddonUI (gtk.glade.XML):
FileName = self.get_widget ("FileChooser").get_filename()
vheight = self.videodata['videoheight']
vwidth = self.videodata['videowidth']
ratenum = self.videodata['fratenum']
ratednom = self.videodata['frateden']
containerchoice = self.get_widget ("containerchoice").get_active_text ()
self._transcoder = transcoder_engine.Transcoder(FileChoice, FileName, containerchoice,
self.AudioCodec, self.VideoCodec, self.devicename, vheight, vwidth)
self.AudioCodec, self.VideoCodec, self.devicename,
vheight, vwidth, ratenum, ratednom)
self._transcoder.connect("ready-for-querying", self.ProgressBarUpdate)
self._transcoder.connect("got-eos", self._on_eos)
return True
def donemessage(self, donemessage, null):
if donemessage == gst.pbutils.INSTALL_PLUGINS_SUCCESS:
# print "success " + str(donemessage)
......@@ -425,20 +430,17 @@ class TransmageddonUI (gtk.glade.XML):
def on_containerchoice_changed(self, widget):
self.CodecBox.set_sensitive(True)
self.transcodebutton.set_sensitive(True)
self.ProgressBar.set_fraction(0.0)
self.ProgressBar.set_text(_("Transcoding Progress"))
containerchoice = self.get_widget ("containerchoice").get_active_text ()
codecs = supported_container_map[containerchoice]
self.AudioCodec = codecs[0]
self.VideoCodec = codecs[1]
self.transcodebutton.set_sensitive(True)
for b in self.codec_buttons.values():
b.set_sensitive(False)
for c in codecs:
self.codec_buttons[c].set_sensitive(True)
self.codec_buttons[self.AudioCodec].set_active(True)
self.codec_buttons[self.VideoCodec].set_active(True)
......
......@@ -45,6 +45,9 @@ Transmageddon Video Transcoding application.
%{_datadir}/transmageddon/presets/linux-computer.xml
%{_datadir}/transmageddon/presets/n800.xml
%{_datadir}/transmageddon/presets/ps3.xml
%{_datadir}/gstreamer-0.10/presets/GstFaac.prs
%{_datadir}/gstreamer-0.10/presets/ffenc_mpeg4.prs
%{_datadir}/transmageddon/presets/krzr-k1v.xml
%{_datadir}/locale
%changelog
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment