So, without further ado, here are some working commandlines to get video that works on a Sony Ericsson phone (my input files are mpeg2 files recorded with GBPVR low quality setting, possibly your mileage may vary if you have other types of input files), and also gives reasonable file sizes:
ffmpeg -y -iinfile -acodec aac -ab 32k -ar 32000 -vcodec mpeg4 -g 300 -s 320x240 -qscale 10 outfile.mp4
If you want to run the movie on lower powered devices (smaller screen for instance) adapt the size like this:
ffmpeg -y -iinfile -acodec aac -ab 32k -ar 32000 -vcodec mpeg4 -g 300 -s qcif -qscale 10 outfile.mp4
The latter line gave a file that played fine on a Sony Ericsson Z1010. To get better sound quality you could use "-ab 64k" instead and then probably lose the "-ar 32000" part for best quality (not sure, but I think so), but don't go higher than that as there are some limitations in the phones when you have video files with audio (which usually is the case with TV recordings). The "-qscale 10" is a parameter you could play with (values are 2-31, 2 is best quality) and for some inputs it's overkill as the default video bit rate of 200 kbps is more than enough to get good quality, It depends on the amount of movement present in the video.
Also, you might want to use two-pass encoding but in my limited experience it doesn't matter much - but it will depend on the original input.
You can output .3gp files (just use a .3gp file extension), but I sometimes have problems with those, so in that case I just run:
mp4box -tmp path-to-temp-dir -add 3gp-file -3gp new-3gp-file
For some reason that often works... Anyway, 3gp files are just mp4 files but without extra information and tracks so you might save a few K, but with my files that is not much so the mp4 format is fine at least for local playback. mp4box does no further transcoding so it has something to do with how the container is written. The reason to use the -tmp flag is to make sure that mp4box' temp files are written to someplace where you have rights to write, otherwise you'll get strange errors ("failed to clone input stream" or some such). If you run with administrative rights you can leave out that flag.
Good luck!
No comments:
Post a Comment