mencoder to generate mp4 files for Motorola A1200
Hello. I am trying to convert DVD to be playable on Motorola A1200. A1200 can see the video format: default support RM, 3gp, MP4. According to the spec, MPEG4 video files: can support 320 to X240, 30fps, 350kbps. 3GP and rm video file to support the 320 X240, 15fps, 350kbps. It is not possible to generate 3GP at 320 x 240 because, according to: http://www-mobile.ecs.soton.ac.uk/peter/h263/h263.html This resolution is not acceptable to 3gp format. Closets would be 176x144, which is too small for subtitle which is part of the video stream (not separate). For MPEG4 I tried a lot of combinations which usually ends up the REALONE player in the mobile phone complaining not able to find plug-in. I was wondering if there is a shortcut than try-and-error because for number of options to tweak it seems too much work to do try-and-error. Or is there a command-line to generate most-likely-playable content that I can simply borrow by copy and pasting? Best regards Zhang Weiwu
2009/10/18 Zhang Weiwu <zhangweiwu@realss.com>:
MPEG4 video files: can support 320 to X240, 30fps, 350kbps.
Perhaps try copying a playable video from your phone that's already in that format to your computer. Play said file with mplayer and observe the output. Use said output to create a file using the same settings. That's how I do it. -- Ken echo 16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlb xq |dc
Ken Murray wrote:
2009/10/18 Zhang Weiwu <zhangweiwu@realss.com>:
MPEG4 video files: can support 320 to X240, 30fps, 350kbps.
Perhaps try copying a playable video from your phone that's already in that format to your computer. Play said file with mplayer and observe the output. Use said output to create a file using the same settings. That's how I do it.
Difficult. I tried bigbuckbunny ipod 5G vesion which is below this spec: http://www.bigbuckbunny.org/index.php/download/ And it dosn't play on mobile (No needed plugin) In fact I never saw any clip in mp4 that can playback on this mobile phone. I have a lot of 3gp format that works. The digital camera embeded also shoots clips in 3gp format, and surprisingly it can shoot in .3gp format at 320x240, violating the spec I read. If I follow this tutorial: http://www.niemueller.de/wiki/index.php?ConvertVideoTo3GP I can generate .3gp that plays on the mobile phone at 176x144, but I could not generate 3gp at 320x240, error (I know it is not an error of mencoder thus a bit OffTopic): $ mencoder dvd://01 -endpos 100 -nosound -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=320:240 -o movie.avi -ofps 12 [output snip, file generated OK to playback] $ mplayer -vo null -endpos 100 -ao pcm -af resample=8000 dvd://01 [output snip, file generated OK to playback] $ ffmpeg -i movie.avi -i audiodump.wav -b 48 -ac 1 -ab 12200 -map 0.0 -map 1.0 movie.3gp [snip output of copyright and what compile options are used] Input #0, avi, from 'movie.avi': Duration: 00:01:40.08, start: 0.000000, bitrate: 678 kb/s Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 12 tbr, 12 tbn, 12 tbc Input #1, wav, from 'audiodump.wav': Duration: 00:01:40.35, bitrate: 256 kb/s Stream #1.0: Audio: pcm_s16le, 8000 Hz, stereo, s16, 256 kb/s WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s Output #0, 3gp, to 'undo.3gp': Stream #0.0: Video: h263, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 0 kb/s, 90k tbn, 12 tbc Stream #0.1: Audio: libamr_nb, 8000 Hz, mono, s16, 12 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 [h263 @ 0x10072bb0]The specified picture size of 320x240 is not valid for the H.263 codec. Valid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+. Error while opening codec for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height Or, how can I generate 320x240 3gp file? e.g. using mencoder. I tried $ mencoder dvd://01 -endpos 100 -oac lavc -ovc lavc -lavcopts vcodec=h263p:acodec=amr_nb -of lavf -o movie.3gp [snip] ========================================================================== Audio LAVC, couldn't find encoder for codec amr_nb Exiting... Even though it looks like a codec library is missing, I do have libamrwb3 installed and don't know what other debian package should I also install.
Hi. To let you get update of what I achieved and for other who followed this thread from Google, here is my "solution". On Sun, 18 Oct 2009, Zhang Weiwu wrote:
Hello. I am trying to convert DVD to be playable on Motorola A1200.
A1200 can see the video format: default support RM, 3gp, MP4.
According to the spec, MPEG4 video files: can support 320 to X240, 30fps, 350kbps. 3GP and rm video file to support the 320 X240, 15fps, 350kbps.
I tried the following can create video playable on the device. $ mencoder dvd://01 -endpos 1800 -nosound -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=320:240 -o movie.avi -ofps 25 $ mplayer -vo null -endpos 1800 -ao pcm -af resample=8000 dvd://01 $ ffmpeg -i movie.avi -i audiodump.wav -b 48 -ac 1 -ab 12200 -map 0.0 -map 1.0 movie.mp4 However I am afraid I compressed the video twice, once with mencoder, once with ffmpeg. If I use 'ffmpeg -vcodec copy' to avoid second round compression, the resulting .mp4 file is big, 150MB for 1800 seconds, which is okay to me, but not possible to playback on mobile phone. The realone player simply say something like parameter is not ok. (in Chinese) This doesn't look like a perfect solution, I might follow up with a better one when I have.
On Fri, Oct 23, 2009 at 07:58:29AM +0800, Zhang Weiwu wrote:
Hi. To let you get update of what I achieved and for other who followed this thread from Google, here is my "solution".
On Sun, 18 Oct 2009, Zhang Weiwu wrote:
Hello. I am trying to convert DVD to be playable on Motorola A1200.
A1200 can see the video format: default support RM, 3gp, MP4.
According to the spec, MPEG4 video files: can support 320 to X240, 30fps, 350kbps. 3GP and rm video file to support the 320 X240, 15fps, 350kbps.
I tried the following can create video playable on the device. $ mencoder dvd://01 -endpos 1800 -nosound -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=320:240 -o movie.avi -ofps 25 $ mplayer -vo null -endpos 1800 -ao pcm -af resample=8000 dvd://01 $ ffmpeg -i movie.avi -i audiodump.wav -b 48 -ac 1 -ab 12200 -map 0.0 -map 1.0 movie.mp4
However I am afraid I compressed the video twice, once with mencoder,
Indeed, you are encoding twice. A way to avoid that is to specify the appropriate bitrate at the mencoder step, "-lavcopts vcodec=mpeg4:vbitrate=48". To get a better quality, you can also use two-pass encoding (one pass with -lavcopts vpass=1, discard output, second pass with -lavcopts vpass=2) if your player supports it (you might also want to look at vrc_maxrate if you go 2 pass). Also, please check ffmpeg's output, as -b option takes a number in bits/s, not kbits/s.
once with ffmpeg. If I use 'ffmpeg -vcodec copy' to avoid second round compression, the resulting .mp4 file is big, 150MB for 1800 seconds, which is okay to me, but not possible to playback on mobile phone. The realone player simply say something like parameter is not ok. (in Chinese)
This doesn't look like a perfect solution, I might follow up with a better one when I have.
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
Etienne Buira wrote:
On Fri, Oct 23, 2009 at 07:58:29AM +0800, Zhang Weiwu wrote:
I tried the following can create video playable on the device. $ mencoder dvd://01 -endpos 1800 -nosound -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=320:240 -o movie.avi -ofps 25 $ mplayer -vo null -endpos 1800 -ao pcm -af resample=8000 dvd://01 $ ffmpeg -i movie.avi -i audiodump.wav -b 48 -ac 1 -ab 12200 -map 0.0 -map 1.0 movie.mp4
However I am afraid I compressed the video twice, once with mencoder,
Indeed, you are encoding twice.
A way to avoid that is to specify the appropriate bitrate at the mencoder step, "-lavcopts vcodec=mpeg4:vbitrate=48".
Thank you for your example, that helps a lot. I played with various vbitrate options, make it as big as possible until Motorola A1200's realplayer fail to play, and ends up having vbitrate=250. Then I could use "ffmpeg -vcodec copy" to avoid second round of compression. So my procedure is now changed to this: $ mencoder dvd://01 -endpos 2000 -nosound -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=250 -vf scale=320:240 -o movie.avi $ mplayer -vo null -endpos 2000 -ao pcm -af resample=8000 dvd://01 $ ffmpeg -i movie.avi -i audiodump.wav -vcodec copy -ac 1 -ab 12200 -map 0.0 -map 1.0 movie.mp4 I now get satisfying video playback! The mobile phone can play some documentary movies to help me kill time on morning buses. Think I am very close to "the perfect solution" where I could use a single mencoder command line, this is what I tried: $ mencoder dvd://01 -endpos 2000 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=250 -vf scale=320:240 -oac lavc -lavcopts acodec=libfaac:abitrate=12 -af channels=1 -af lavcresample=8000 -of lavf -o movie.mp4 You can see I am trying to let mencoder does the 'ffmpeg -ac 1 -ab 12200 movie.mp4" part. I don't know why the resulting file always fail to play, and real play doesn't give more detailed information except that it cannot play. More or less this problem is now "solved" thanks for your tip of not doing compression twice. Hence I change the subject. Still trying to get the 'perfect procedure' some time.
Also, please check ffmpeg's output, as -b option takes a number in bits/s, not kbits/s. Thank you for the information. The misuse was mislead by this article:
http://www.niemueller.de/wiki/index.php?ConvertVideoTo3GP (search for '-b 48') By the way the above article also compressed video twice.
On Sun, Oct 25, 2009 at 08:35, Zhang Weiwu <zhangweiwu@realss.com> wrote:
Think I am very close to "the perfect solution" where I could use a single mencoder command line, this is what I tried:
$ mencoder dvd://01 -endpos 2000 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=250 -vf scale=320:240 -oac lavc -lavcopts acodec=libfaac:abitrate=12 -af channels=1 -af lavcresample=8000 -of lavf -o movie.mp4
You can see I am trying to let mencoder does the 'ffmpeg -ac 1 -ab 12200 movie.mp4" part. I don't know why the resulting file always fail to play, and real play doesn't give more detailed information except that it cannot play.
I don't know if it will make any difference but you might try to combine your separate "-lavcopts" and "-af" options into one, e.g.: $ mencoder dvd://1 -endpors 2000 -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:vbitrate=250:acodec=libfaac:abitrate=12 -af channels=1:lavcresample=8000 -vf scale=320:240 -of lavf -ofps 23.976 -o movie.mp4 seems cleaner in any case.
...and forget the "-ofps 23.976", that was just part of my command line because of the source material I used for testing.
On Sun, Oct 25, 2009 at 02:35:23PM +0800, Zhang Weiwu wrote:
Etienne Buira wrote:
On Fri, Oct 23, 2009 at 07:58:29AM +0800, Zhang Weiwu wrote:
I tried the following can create video playable on the device. $ mencoder dvd://01 -endpos 1800 -nosound -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=320:240 -o movie.avi -ofps 25 $ mplayer -vo null -endpos 1800 -ao pcm -af resample=8000 dvd://01 $ ffmpeg -i movie.avi -i audiodump.wav -b 48 -ac 1 -ab 12200 -map 0.0 -map 1.0 movie.mp4
However I am afraid I compressed the video twice, once with mencoder,
Indeed, you are encoding twice.
A way to avoid that is to specify the appropriate bitrate at the mencoder step, "-lavcopts vcodec=mpeg4:vbitrate=48".
Thank you for your example, that helps a lot. I played with various vbitrate options, make it as big as possible until Motorola A1200's realplayer fail to play, and ends up having vbitrate=250. Then I could use "ffmpeg -vcodec copy" to avoid second round of compression.
So my procedure is now changed to this:
$ mencoder dvd://01 -endpos 2000 -nosound -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=250 -vf scale=320:240 -o movie.avi $ mplayer -vo null -endpos 2000 -ao pcm -af resample=8000 dvd://01 $ ffmpeg -i movie.avi -i audiodump.wav -vcodec copy -ac 1 -ab 12200 -map 0.0 -map 1.0 movie.mp4
I now get satisfying video playback! The mobile phone can play some documentary movies to help me kill time on morning buses.
Think I am very close to "the perfect solution" where I could use a single mencoder command line, this is what I tried:
$ mencoder dvd://01 -endpos 2000 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=250 -vf scale=320:240 -oac lavc -lavcopts acodec=libfaac:abitrate=12 -af channels=1 -af lavcresample=8000 -of lavf -o movie.mp4
As Kasper said, it would be safer to group all -lavcopts together.
You can see I am trying to let mencoder does the 'ffmpeg -ac 1 -ab 12200 movie.mp4" part. I don't know why the resulting file always fail to play, and real play doesn't give more detailed information except that it cannot play.
I am not sure, but it might be the presence of two -lavcopts, or the presence of B-frames (look at mencoder's output, there should be a warning). Try vmax_b_frames=0 in -lavcopts if grouping does not solves your problem.
More or less this problem is now "solved" thanks for your tip of not doing compression twice. Hence I change the subject. Still trying to get the 'perfect procedure' some time.
Also, please check ffmpeg's output, as -b option takes a number in bits/s, not kbits/s. Thank you for the information. The misuse was mislead by this article:
http://www.niemueller.de/wiki/index.php?ConvertVideoTo3GP (search for '-b 48')
By the way the above article also compressed video twice.
_______________________________________________ MEncoder-users mailing list MEncoder-users@mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
participants (4)
-
Etienne Buira -
Kasper Bonne -
Ken Murray -
Zhang Weiwu