From 2bdce59493dd95e8bc78e5455b22be8976f82c0d Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Wed, 22 Feb 2012 20:48:43 +0100 Subject: [PATCH 1/2] adapted encoding command to ffmpeg --- n900-encode.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/n900-encode.py b/n900-encode.py index cc3087e..7264cd8 100755 --- a/n900-encode.py +++ b/n900-encode.py @@ -120,16 +120,16 @@ def calculate(input): # Get characteristics using mplayer cmd=[mpbin, "-ao", "null", "-vo", "null", "-frames", "0", "-identify", input] mp = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() - + try: s = re.compile("^ID_VIDEO_ASPECT=(.*)$", re.M) - m = s.search(mp[0]) + m = s.search(bytes.decode(mp[0])) orig_aspect = m.group(1) s = re.compile("^ID_VIDEO_WIDTH=(.*)$", re.M) - m = s.search(mp[0]) + m = s.search(bytes.decode(mp[0])) orig_width = m.group(1) s = re.compile("^ID_VIDEO_HEIGHT=(.*)$", re.M) - m = s.search(mp[0]) + m = s.search(bytes.decode(mp[0])) orig_height = m.group(1) except: print("Error: unable to identify source video, exiting!") @@ -195,13 +195,16 @@ def convert(input, output, res, abitrate, vbitrate, threads, mpopts): "-f", "yuv4mpegpipe", "-i", vfifo, "-i", afifo, - "-acodec", "libfaac", + "-acodec", "aac", + "-strict", "experimental", "-ac", "2", "-ab", str(abitrate), - "-ar", "22500", + "-ar", "44100", "-vcodec", "libx264", "-threads", str(threads), - "-b", str(vbitrate), + "-vprofile", "baseline", + "-tune", "animation", + "-b:v", str(vbitrate), "-flags", "+loop", "-cmp", "+chroma", "-partitions", "+parti4x4+partp8x8+partb8x8", "-subq", "5", "-trellis", "1", "-refs", "1", @@ -211,7 +214,7 @@ def convert(input, output, res, abitrate, vbitrate, threads, mpopts): "-bt", "640", "-bufsize", "10M", "-maxrate", "1000000", "-rc_eq", "'blurCplx^(1-qComp)'", "-qcomp", "0.62", "-qmin", "10", "-qmax", "51", - "-level", "30", "-f", "mp4", + "-x264opts", "level=3.0", "-f", "mp4", output ] # Start mplayer decoding processes in background From 8ad7149f262600507095397034717b3376bea8b3 Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Wed, 22 Feb 2012 20:50:25 +0100 Subject: [PATCH 2/2] Changed Prequisites in README --- README | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README b/README index 75219be..c34cbc8 100644 --- a/README +++ b/README @@ -6,8 +6,7 @@ PREQUISITES: The following components are needed: * mplayer - * mencoder - * MP4Box (from gpac package) + * ffmpeg (tested with version 0.10, older versions may or may not work) * python USAGE: