Add video only encoding, also add a proper license header to which.py

parent fce33348
0.17
Port to new plugins-base discoverer
Port to new plugins-base discoverer and encodebin
Replace radiobutton lists with a combobox instead
add support for audio only transcoding
add support for outputting audio only from video+audio files
Add deinterlacing
Support container free audio formats such as FLAC, mp3 and AAC
Add HTML5 and Nokia 9000 profile
add support for video only transcoding
0.16 - 21-05-2010
Add WebM support
......
......@@ -52,9 +52,9 @@ This list is completely unordered. Nothing about the ordering in this list shoul
turn up in directory
iii) start transcode once dvb-daemon says recording is done
* Add black borders based on aspect-ratio
* AVC HD support.
Variation of MPEG TS with H264 and AC3 audio
* Support multiple audio tracks. Probably want to wait for new discoverer for that.
* Batch transcoding - multiple files 'programmed up front'
......@@ -47,7 +47,7 @@ class Transcoder(gobject.GObject):
# Choose plugin based on Container name
self.container = CONTAINERCHOICE
self.audiocaps = gst.Caps(AUDIOCODECVALUE)
self.audiocaps = AUDIOCODECVALUE
if self.container != False:
self.containercaps = gst.Caps(codecfinder.containermap[CONTAINERCHOICE])
# special case mp3 which is a no-container format with a container (id3mux)
......@@ -99,11 +99,6 @@ class Transcoder(gobject.GObject):
# gather preset data if relevant
if self.preset != "nopreset":
height, width, num, denom, pixelaspectratio = self.provide_presets()
print "height is " + str(height)
print "width is " + str(width)
print "num is " + str(num)
print "denom is " + str(denom)
print "pixelaspect is " + str(pixelaspectratio)
for acap in self.audiocaps:
acap["channels"] = self.channels
for vcap in self.videocaps:
......@@ -126,6 +121,7 @@ class Transcoder(gobject.GObject):
# first check if we have a container format, if not set up output for possible outputs
print "self.container is " + str(self.container)
print "self.container caps is " + str(self.containercaps)
if self.container==False:
if self.audiocaps.intersect(gst.Caps("audio/mpeg, mpegversion=4")):
self.audiocaps=gst.Caps("audio/mpeg, mpegversion=4, stream-format=adts")
......@@ -134,12 +130,14 @@ class Transcoder(gobject.GObject):
else:
print "self.containercaps are " + str(self.containercaps)
self.encodebinprofile = gst.pbutils.EncodingContainerProfile ("containerformat", None , self.containercaps, None)
if self.container==False:
self.encodebinprofile = gst.pbutils.EncodingAudioProfile (self.audiocaps, None, gst.caps_new_any(), 0)
else:
print "audiocaps used to create encodebin is " + str(self.audiocaps)
self.audioprofile = gst.pbutils.EncodingAudioProfile (self.audiocaps, None, gst.caps_new_any(), 0)
self.encodebinprofile.add_profile(self.audioprofile)
print "audiocaps without audio is " + str(self.audiocaps)
if self.audiocaps != False:
if self.container==False:
self.encodebinprofile = gst.pbutils.EncodingAudioProfile (self.audiocaps, None, gst.caps_new_any(), 0)
else:
print "audiocaps used to create encodebin is " + str(self.audiocaps)
self.audioprofile = gst.pbutils.EncodingAudioProfile (self.audiocaps, None, gst.caps_new_any(), 0)
self.encodebinprofile.add_profile(self.audioprofile)
if self.videocaps != "novid":
if (self.videocaps != False):
print "videcaps used to create encodebin is " + str(gst.Caps(self.videocaps))
......
......@@ -161,6 +161,9 @@ class TransmageddonUI:
self.videorows=[]
self.audiocodecs=[] # create lists to store the ordered lists of codecs
self.videocodecs=[]
# these dynamic comboboxes allow us to support files with multiple streams eventually
def dynamic_comboboxes_audio(streams,extra = []):
streams=1 # this will become a variable once we support multiple streams
vbox = gtk.VBox()
......@@ -533,6 +536,9 @@ class TransmageddonUI:
self.audiocodec.set_markup(''.join(('<small>','Audio codec: ', \
str(gst.pbutils.get_codec_description(inputaudiocaps)), \
'</small>')))
if self.haveaudio==False:
self.audioinformation.set_markup(''.join(('<small>', "No Audio", '</small>')))
self.audiocodec.set_markup(''.join(('<small>', "",'</small>')))
if isinstance(i, gst.pbutils.DiscovererVideoInfo):
self.inputvideocaps=i.get_caps()
......@@ -603,10 +609,11 @@ class TransmageddonUI:
videointersect = sourcecaps.intersect(self.videodata['videotype'])
if videointersect != ("EMPTY"):
self.vsourcecaps = videointersect
if audiointersect == ("EMPTY"):
audiointersect = sourcecaps.intersect(self.audiodata['audiotype'])
if audiointersect != ("EMPTY"):
self.asourcecaps = audiointersect
if self.haveaudio == True:
if audiointersect == ("EMPTY"):
audiointersect = sourcecaps.intersect(self.audiodata['audiotype'])
if audiointersect != ("EMPTY"):
self.asourcecaps = audiointersect
if videointersect != ("EMPTY"):
self.videopass=True
else:
......@@ -655,13 +662,16 @@ class TransmageddonUI:
vwidth=False
ratenum=False
ratednom=False
achannels = self.audiodata['audiochannels']
if self.audiopasstoggle == False:
audiocodec = self.AudioCodec
if self.haveaudio:
achannels = self.audiodata['audiochannels']
if self.audiopasstoggle == False:
audiocodec = self.AudioCodec
else:
audiocodec = gst.Caps.to_string(self.asourcecaps)
else:
audiocodec = gst.Caps.to_string(self.asourcecaps)
# non-preset transcoding with audio and video
print "realizing there is no audio before starting transcoding"
audiocodec=False
achannels=False
self._transcoder = transcoder_engine.Transcoder(filechoice, self.filename, self.videodirectory, self.container,
audiocodec, videocodec, self.devicename,
vheight, vwidth, ratenum, ratednom, achannels,
......@@ -726,9 +736,11 @@ class TransmageddonUI:
videostatus = codecfinder.get_video_encoder_element(self.VideoCodec)
else:
videostatus=True
if self.audiopasstoggle != True:
audiostatus = codecfinder.get_audio_encoder_element(self.AudioCodec)
if self.haveaudio:
if self.audiopasstoggle != True:
audiostatus = codecfinder.get_audio_encoder_element(self.AudioCodec)
else:
audiostatus=True
else:
audiostatus=True
if self.havevideo == False: # this flags help check if input is audio-only file
......@@ -780,17 +792,30 @@ class TransmageddonUI:
self.outputfilename = str(self.nosuffix+self.timestamp+self.ContainerFormatSuffix)
context_id = self.StatusBar.get_context_id("EOS")
self.StatusBar.push(context_id, (_("Writing %(filename)s") % {'filename': self.outputfilename}))
print "basic setup done for transcodebutton"
if self.multipass == False:
self.ProgressBar.set_text(_("Transcoding Progress"))
else:
self.passcounter=int(1)
self.ProgressBar.set_text(_("Pass %(count)d Progress") % {'count': self.passcounter})
if self.audiodata.has_key("samplerate"):
self.check_for_elements()
if self.missingtoggle==False:
self._start_transcoding()
else:
self.waiting_for_signal="True"
print "self.haveaudio is " +str(self.haveaudio)
print "self.havevideo is " +str(self.havevideo)
if self.haveaudio:
if self.audiodata.has_key("samplerate"):
self.check_for_elements()
if self.missingtoggle==False:
print "reaching start transcoding with audio"
self._start_transcoding()
else:
self.waiting_for_signal="True"
elif self.havevideo:
if self.videodata.has_key("videoheight"):
self.check_for_elements()
if self.missingtoggle==False:
print "reaching start transcoding with video"
self._start_transcoding()
else:
self.waiting_for_signal="True"
def on_cancelbutton_clicked(self, widget):
self.FileChooser.set_sensitive(True)
......@@ -830,21 +855,23 @@ class TransmageddonUI:
# end of housecleaning
# start filling audio
if self.usingpreset==True: # First fill menu based on presetvalue
print "adding preset value to audiomenu and setting it active"
self.audiorows[0].append_text(str(gst.pbutils.get_codec_description(self.presetaudiocodec)))
self.audiorows[0].set_active(0)
self.audiocodecs.append(self.presetaudiocodec)
else:
audio_codecs = []
audio_codecs = supported_audio_container_map[self.container]
for c in audio_codecs:
self.audiocodecs.append(gst.Caps(codecfinder.codecmap[c]))
for c in audio_codecs:
self.audiorows[0].append_text(c)
if self.haveaudio==True:
if self.usingpreset==True: # First fill menu based on presetvalue
self.audiorows[0].append_text(str(gst.pbutils.get_codec_description(self.presetaudiocodec)))
self.audiorows[0].set_active(0)
self.audiocodecs.append(self.presetaudiocodec)
else:
audio_codecs = []
audio_codecs = supported_audio_container_map[self.container]
for c in audio_codecs:
self.audiocodecs.append(gst.Caps(codecfinder.codecmap[c]))
for c in audio_codecs:
self.audiorows[0].append_text(c)
self.audiorows[0].set_sensitive(True)
self.audiorows[0].set_active(0)
else:
self.audiorows[0].set_sensitive(False)
# fill in with video
if self.havevideo==True:
if self.container != False:
......@@ -890,6 +917,7 @@ class TransmageddonUI:
self.ProgressBar.set_text(_("Transcoding Progress"))
if self.builder.get_object("containerchoice").get_active()!= -1:
self.container = self.builder.get_object ("containerchoice").get_active_text ()
print "self.container is " + str(self.container)
if self.builder.get_object("containerchoice").get_active()!= -1:
print "checking for discover done"
print "discover done is " + str(self.discover_done)
......
......@@ -3,8 +3,31 @@
# See LICENSE.txt for license details.
# Author:
# Trent Mick (TrentM@ActiveState.com)
#
# Home:
# http://trentm.com/projects/which/
# http://code.google.com/p/which/
#
# Copyright (c) 2002-2005 ActiveState Corp.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
r"""Find the full path to commands.
......
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