]> code.delx.au - transcoding/commitdiff
A few tweaks to options
authorJames Bunton <jamesbunton@fastmail.fm>
Sun, 19 Sep 2010 02:36:30 +0000 (12:36 +1000)
committerJames Bunton <jamesbunton@fastmail.fm>
Sun, 19 Sep 2010 02:36:30 +0000 (12:36 +1000)
encode.py

index 31cc0de0a72c23de21838e8a86ec8dd0c564b76c..d2d686dd0f87f02520df77c72dfeffdc72f9c226 100755 (executable)
--- a/encode.py
+++ b/encode.py
@@ -56,7 +56,7 @@ def insert_mplayer_options(cmd, o):
        do_opt = partial(append_cmd, cmd)
 
        if o.deinterlace:
-               cmd += ["-vf-add", "yadif"]
+               cmd += ["-vf-pre", "yadif"]
        if o.noskip:
                cmd += ["-noskip"]
        if o.skipkb:
@@ -70,7 +70,7 @@ def insert_mplayer_options(cmd, o):
        do_opt("-chapter", o.chapter)
        do_opt("-aid", o.audioid)
        do_opt("-sid", o.subtitleid)
-       do_opt("-vf-add", o.vfilters)
+       do_opt("-vf", o.vfilters)
        do_opt("-af-add", o.afilters)
 
 
@@ -204,7 +204,7 @@ class MPlayer(Command):
                cmd += ["-vo", "yuv4mpeg:file=video.y4m"]
                cmd += ["-ao", "pcm:waveheader:file=audio.wav"]
                insert_mplayer_options(cmd, self.opts)
-               cmd += self.profile.extra
+               cmd += self.profile.mplayeropts
                self.do_exec(cmd, wait=False)
 
 
@@ -221,7 +221,6 @@ class MencoderCopyAC3(Command):
                cmd += ["-ovc", "copy", "-oac", "copy"]
                cmd += ["-of", "rawaudio", "-o", "audio.ac3"]
                insert_mplayer_options(cmd, self.opts)
-               cmd += self.profile.extra
                self.do_exec(cmd)
 
 
@@ -270,11 +269,6 @@ class Faac(Command):
                self.do_exec(cmd, wait=False)
 
 
-class SwallowAudio(Command):
-       def run(self):
-               self.do_exec(["dd", "if=audio.wav", "of=/dev/null"], wait=False)
-
-
 class Mencoder(Command):
        codec2opts = {
                "xvid": "-xvidencopts",
@@ -306,7 +300,7 @@ class Mencoder(Command):
                cmd += ["-oac", p.acodec]
                if p.aopts:
                        cmd += [self.codec2opts[p.acodec], p.aopts]
-               cmd += self.profile.extra
+               cmd += self.profile.mplayeropts
                cmd += ["-o", self.opts.output + ".avi"]
 
                self.do_exec(cmd)
@@ -345,7 +339,6 @@ class MencoderDemux(Command):
 
 class Profile(object):
        def __init__(self, commands, **kwargs):
-               self.extra = []
                self.commands = commands
                self.__dict__.update(kwargs)
 
@@ -366,13 +359,15 @@ profiles = {
        "x264/lame" :
        Profile(
                commands=[MPlayer, X264, Lame, Wait, MKVMerge],
+               mplayeropts=[],
                x264opts=["--preset", "veryslow", "--crf", "20"],
                lameopts=["--preset", "medium"],
        ),
 
        "x264/copyac3" :
        Profile(
-               commands=[MPlayer, X264, SwallowAudio, Wait, MencoderCopyAC3, MKVMerge],
+               commands=[MPlayer, X264, Wait, MencoderCopyAC3, MKVMerge],
+               mplayeropts=["-nosound"],
                x264opts=["--preset", "veryslow", "--crf", "20"],
                lameopts=["--preset", "medium"],
        ),
@@ -380,6 +375,7 @@ profiles = {
        "xvid/lame" :
        Profile(
                commands=[Mencoder],
+               mplayeropts=["-ffourcc", "DX50"],
                vcodec="xvid",
                vopts="fixed_quant=2:vhq=4:autoaspect",
                acodec="mp3lame",
@@ -389,6 +385,7 @@ profiles = {
        "apple-quicktime" :
        Profile(
                commands=[MPlayer, X264, Faac, Wait, MP4Box],
+               mplayeropts=[],
                x264opts=["--crf", "20", "--bframes", "1"],
                faacopts=["-q", "100", "--mpeg-vers", "4"],
        ),
@@ -396,11 +393,11 @@ profiles = {
        "nokia-n97" :
        Profile(
                commands=[Mencoder, MencoderDemux, MP4Box],
+               mplayeropts=["-vf-add", "scale=640:-10"],
                vcodec="xvid",
-               vopts="bitrate=256:vhq=4:autoaspect:max_bframes=0",
+               vopts="bitrate=384:vhq=4:autoaspect:max_bframes=0",
                acodec="faac",
                aopts="br=64:mpeg=4:object=2",
-               extra=["-vf-add", "scale=640:-10"],
        ),
 }