[MEncoder-users] mencoder size and aspect ratios for H.264 video

Etienne Buira etienne.buira.lists at free.fr
Sun Oct 4 23:47:53 CEST 2009


On Sun, Oct 04, 2009 at 05:12:57PM -0400, John Ratliff wrote:
> Etienne Buira wrote:
> > On Sat, Oct 03, 2009 at 05:45:00PM -0400, John Ratliff wrote:
> >   
> >> I'm using mencoder to convert a DVD to a matroska file with H.264 video
> >> and Vorbis audio. But when I play the file, the aspect ratio is 2.43:1,
> >> when it should be 16:9.
> >>
> >> mkvmerge tells me it extracted the aspect ratio from the AVC video data
> >> as 2.43:1.
> >> "'video.x264' track 0: Extracted the aspect ratio information from the
> >> MPEG-4 layer 10 (AVC) video data and set the display dimensions to 854/352."
> >>
> >> mplayer tells me the aspect ratio is 16:9 on the original source DVD.
> >> "Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
> >> VO: [xv] 720x480 => 854x480 Planar YV12"
> >>
> >> I would like to resize the video to 640x360 (or maybe 624x352 - some
> >> articles tell me both dimensions must be multiples of 16 - wasn't sure
> >> if that was correct). I am using MPlayer SVN-r29463-4.3.2 and mkvtoolnix
> >> 2.98 on 64-bit Linux.
> >>
> >> Here are the commands I used:
> >>
> >> # dump the movie
> >> mplayer -dvd-device movie.iso dvd://1 -dumpstream -dumpfile
> >> /tmp/dvd-encode/movie.vob
> >>
> >> # first video encoder pass
> >> mencoder /tmp/dvd-encode/movie.vob -oac copy -vf
> >> pullup,softskip,crop=720:352:0:62,scale=640:360,harddup
> >> -force-avi-aspect 16:9 -ovc x264 -ofps 24000/1001 -x264encopts
> >> pass=1:threads=auto:bitrate=${VBITRATE}:subq=6:8x8dct:frameref=5:bframes=3:b_pyramid:weight_b:turbo=1
> >> -o /dev/null
> >>
> >> # second video encoder pass
> >> mencoder /tmp/dvd-encode/movie.vob -oac copy -vf
> >> pullup,softskip,crop=720:352:0:62,scale=640:360,harddup
> >> -force-avi-aspect 16:9 -ovc x264 -ofps 24000/1001 -x264encopts
> >> pass=2:threads=auto:bitrate=${VBITRATE}:subq=6:8x8dct:frameref=5:bframes=3:b_pyramid:weight_b:turbo=1
> >> -o /tmp/dvd-encode/video.x264
> >>
> >> # mux matroska container
> >> mkvmerge -A video.x264 audio.ogg -o movie.mkv
> >>
> >>
> >>
> >> mplayer movie.mkv tells me:
> >> "Movie-Aspect is 2.43:1 - prescaling to correct movie aspect.
> >> VO: [xv] 624x352 => 854x352 Planar YV12"
> >>
> >> mplayer video.x264 tells me:
> >> "Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
> >> VO: [xv] 624x352 => 626x352 Planar YV12"
> >>
> >>
> >> Thanks,
> >>     
> >
> > So, I assume the question is you want to know how to make a mkv with all
> > informations in it to play with correct AR.
> >
> > Just read man mkvmerge.
> >   
> 
> I have actually. There are three interesting options
> --aspect-ratio
> --aspect-ratio-factor
> --display-dimensions
> 
> However, all three of these switches are ignored in favor of this:
> 
> "'video.x264' track 0: Extracted the aspect ratio information from the MPEG-4 layer 10 (AVC) video data and set the display dimensions to 854/352."
> 
> What I would like to know is where mencoder sets this information, and how to change it.
> -aspect doesn't do it.
> -force-avi-aspect is only useful for mplayer on the original AVI, which I'm discarding. mkvmerge doesn't read the AVI header (which doesn't set it apart from most programs other than mplayer I've read).
> 
> Any other suggestions?

I have no trouble with the following cmdline:
$ mkvmerge -o mkv.mkv --aspect-ratio 0:16/9 tst.avi

The video plays well in 16/9 (tst.avi's AR is 4/3).

Other unrelated suggestions:
- do you really need pullup,softskip,harddup filters?
- I would not scale the movie before encoding, but let the reader do this
- I think you forgot to remove turbo=1 from 2nd pass cmdline
Those are just suggestions, I actually have no clue about what you are
doing, so what are your needs.

> 
> --John Ratliff
> 
> 
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users


More information about the MEncoder-users mailing list