Convert mkv/h264 video so it can be played on a "mid-range" Sony Ericsson phone. (using Ubuntu).
Posted
by Johan
on Super User
See other posts from Super User
or by Johan
Published on 2009-08-29T07:55:07Z
Indexed on
2010/05/12
15:04 UTC
Read the original article
Hit count: 410
Hi
As a little experiment I thinking of converting some video/movies/tv-series into a format that could be playable on my K850, but to be a little bit more generic in this question let's say "mid range Sony Ericsson" phone since they all more or less behave the same and has the same screen resolution (240 x 320).
I am looking for command line based tools (for Ubuntu), since I am thinking about writing a "convert and move" script later if it is successful.
A lot of the video I have is encoded in mkv/h264, but since that is not supported by the phone I guess that I need to convert it into some mp4/mpeg4 low quality video.
After some googling it seems like a good candidate for the job is ffmpeg, but that seems to be a very versatile tool with a lot of magic tricks.
Am I on the right track? And if so how do I use ffmpeg to do this?
Thanks Johan
Update: After plating a little bit with ffmeg I noticed that it only uses 1 of my 4 cores, so the transcoding takes forever. I found a arg called -threads but that did not change much, maybe I got it wrong.
I also found that something like this plays in the phone.
ffmpeg -i Mythbusters\ S1D1_1.mkv -threads 4 -t 180 -vcodec mpeg4 -r 15 -s 320x240 Mythbusters\ S1D1_1_mini.mp4
It was possible to use 3gp/h263, but the quality was really useless.
ffmpeg -i Mythbusters\ S1D1_1.mkv -t 180 -vcodec h263 -acodec libfaac -s cif Mythbusters\ S1D1_1_cif.3gp
And it seems like mp4/h264 is also possible and the result is ok, thanks to this question, this one seem to use more than one core as well so it was a little bit faster for me.
ffmpeg -i Mythbusters_S1D1_1.mkv -t 180 -acodec libfaac -ab 60k -s 320x240 -vcodec libx264 -b 500k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +mixed_refs -me_method umh -subq 6 -trellis 1 -refs 5 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 500k -maxrate 768k -bufsize 2M -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -threads 0 -f mp4 Mythbusters_S1D1_1_qvga.mp4
Update: I have tried to use HandBrakeCLI and it is no problem creating a new file that seem to be the same as the one created with ffmpeg with something like this.
HandBrakeCLI -i Mythbusters_S1D1_1.mkv --size 100 -E faac -B 60 --maxHeight 240 -r 15 -e x264 -o Mythbusters_S1D1_1_hand.mp4
But that one did not play in the phone...
I found this in the official manual:
If you transfer video clips using another program than Media Go™, we recommend that you select H.264 Baseline profile video, up to QVGA at 30 fps, VBR 384 kbps (max 768 kps) with AAC+ audio at 128 kbps (max 255 kbps), 48 kHz and stereo audio in mp4 file format.
So the idea to use H264 seems to be correct.
© Super User or respective owner