25 July 2010

Optimized FFMPEG with AoTuV

Newer binary ffmpeg 0.9 moved here

In my previous post I have demonstrate a wacky batch conversion from mp3 to ogg (vorbis). Unfortunately today aac is in charge to unset mp3. So this time let's set it once for all, Let's convert all kind of inferior lossy format to ogg vorbis! Alright.

This time I compile a special FFMPEG that use AoTuV instead of vanilla libvorbis. The change was dramatic, when encoding very low bitrate (32, 48 Kbps or quality -2,-1) AoTuV is up to 4x faster, higher quality and regular vorbis simply can't do that low bitrates. Thus with ogg emerged as one of prefered format for HTML5 AudioVideo, it will provide bandwidth-starved streaming ability in.

FFMPEG-SVN-r24538 w/ AoTuV 2.67MB (win32 binary with MT and proc. runtime detection)
VorbisGain (from rarewares)
FFMPEG docs and presets file

License: GPLv3

Put them (vorbisgain.exe & ffmpeg.exe) to a comfortable place like C:\Windows or anywhere you've defined in PATH variable. Use ffplay to test WebM video

A simple batch to convert know audio files (excluding lossless/flat format like flac, wav):
from command prompt under root folder where your music located, type:
for /r %f in (*.mp3 *.aac *.m4a *.vqf *.mp2 *.ac3 *.wma *.ra) do ffmpeg -loglevel quiet -i "%f" -acodec libvorbis -aq 0 -map_meta_data 0:0 -y "%~dpnf.ogg" && vorbisgain -q -s -f "%~dpnf.ogg" && del "%f"

Meaning: for every those kind of files in current folder and all subfolders, run ffmpeg silently to convert it into ogg vorbis at quality 0  also copy source's tag (metadata) into target file, after that run vorbisgain to apply replaygain on encoded file then if everything is fine delete source file.

Or you can do it over video clip files too:
for /r %f in (*.avi *.wmv *rm *.asf *.mov *.mpg) do ffmpeg -loglevel quiet -i "%f" -vn -acodec libvorbis -aq 0 -map_meta_data 0:0 -y "%~dpnf.ogg" && vorbisgain -q -s -f "%~dpnf.ogg"

Output will have tag fully transfered and replaygain enabled. -aq 0 is roughly equal to 64kbps (-ab 64k)

Notes for audiophile people:
- I'm aware that vorbisgain have somewhat lower than expected value (loudness) but IMO it's more likely a safe bet.
- I've no HQ ears nor sound system so IMH ears those quality between SOX and FFMPEG is not too dissimilar.

Notes for existing ffmpeg user:
- This build is roughly the same as official autobuild one except I use vorbiscommet patch and AoTuV instead vanilla libvorbis else it also bundling latest encoders: x264, Theora, Lame, WebM and so on. see the msg for detail

No comments:

Post a Comment