[MEncoder-users] How to convert mkv to mkv?

The Wanderer inverseparadox at comcast.net
Thu Jun 28 22:18:38 CEST 2007


Carlo Wood wrote:

> On Thu, Jun 28, 2007 at 05:34:27PM +0200, Moritz Barsnick wrote:
> 
>> On Thu, Jun 28, 2007 at 15:09:46 +0200, Carlo Wood wrote:
>> 
>>> Yes, I found that (even before I mailed the first time) on the
>>> net; and then I tried to find what to pass to mencoder to use
>>> mpeg4, but I cannot find it.
>> 
>> Mencoder doesn't support MPEG4 containers natively, but uses
>> libavformat to create them.
>> -of lavf -lavfopts format=mp4
> 
> Actually, I had already found and tried that too... but it tells me
> that it is buggy etc... I started to be so insecure about being able
> to figure this out on my own that I subbed to this list with the
> hopes to be sure I wasn't doing something totally wrong.
> 
> The error I get when using this option is:
> 
> hikaru:/opt/large/movies/The.Matrix.1999.DVD9.720p.HDDVD.x264-hV>mencoder 
> the.matrix.1999.dvd9.720p.hddvd.x264-hv.mkv -vf 
> crop=1254:528:13:0,scale=608:256,hqdn3d=2:1:2 -ofps 24000/1001 -oac 
> copy -ovc x264 -x264encopts 
> subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:threads=4:bitrate=3697:pass=1 
> -of lavf -lavfopts format=mp4 -o /dev/null

> ** MUXER_LAVF *****************************************************************
> If you wish to use libavformat muxing, you must ensure that your video stream
> does not contain B frames (out of order decoding) and specify:
>     -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames
> on the command line.
> REMEMBER: MEncoder's libavformat muxing is presently broken and will generate
> INCORRECT files in the presence of B frames. Moreover, due to bugs MPlayer
> will play these INCORRECT files as if nothing were wrong!
> *******************************************************************************

> I have no idea if the input file has "B frames" whatever they are -
> or that the above warning only refers to the output file(?).
> 
> How can I find out if the original mkv file has B frames? And does
> this warning refer to the input file at all?

The message refers to anything being muxed by lavf. If the original
contained B frames, then -ovc copy will produce B frames; whether or not
the original contained B frames, if your video-encoding options told it
to use B frames then the result will contain B frames.

In this case, your command line contains the x264encopts suboptions

bframes=3:b_pyramid:weight_b

and so your output video will contain B frames.

I know of no easy (or even difficult-but-reliable) way to determine
whether the original file contains B frames, short of parsing it - and
the tools I know capable of parsing such files tend not to simply report
frame types but to do considerably more (e.g., play the file).

> [...]
> 
>>> Also, I read that H.264 had extensions that go beyond mpeg4, so I
>>> am confused :/. I want those extensions, of course. Is there
>>> anything else wrong with my commandline?
>> 
>> Are you confusing container format and codec now? If you're
>> encoding into Matroska (a container format), you should ignore the
>> above. :-)
> 
> Uhuh - there are two different things with the same name? The file
> that I have ends on .mkv, I believe it is a Matroska container.
> Doesn't that mean that it is x264 ?

No. Matroska can contain almost any kind of video - H.264 (of which x264
is one implementation) is one of them, but it is not by any means the
only one. (For that matter, Matroska is not the only container which can
contain H.264.)

>> From the file name I'd expect it is:
>> the.matrix.1999.dvd9.720p.hddvd.x264-hv.mkv
> 
> There is a 'x264' in the name ;)
> 
> How can I find out what the codec of the original is then?

It should be given in the output of any MPlayer or MEncoder command
which takes the original as input. For the most information, the
generally suggested command is

mplayer -identify -frames 0

-- 
       The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

Secrecy is the beginning of tyranny.



More information about the MEncoder-users mailing list