[MEncoder-users] mkv to hard sub avi to m4v command line options and sync problems

Mike Castle dalgoda+mplayer at gmail.com
Sat Jan 16 21:07:21 CET 2010


mencoder can read .mkv files, there should be no need to separate with
mkvextract first.

Have you simply tried:

mencoder -oac copy -ovc copy -o output.avi input.mkv


Start with that simple example first, then start trying new parameters.

-aid or -alang to select audio track . Try different ones, even ones
you don't want in the end, just to get the experience.


If your input is AAC, try something like:
-oac pcm

For a 2.5m movie that I have, it went from an AAC mkv of 11M to PCM avi of 37M.

Depending on your needs (just a temp copy to watch then delete), maybe
this is all you need.

Otherwise, look at something like:
-oac faac
-oac lavc -lavcopts acodec=libfaac
-oac lavc -lavcopts acodec=ac3
-oac lavc -lavcopts acodec=flac

You'll have to experiment to get something you like.  It's the
standard speed vs size trade off, mixed in with what your portable
players actually support.  Are you happy with a big file that you're
not going to keep forever?  Or is space limited that you can't accept
any growth in the size?

For hardcoding in subtitles, well, that pretty much means having to
remux the video, and that always results in a loss of video quality.
That's just the way it is.  You can minimize it, but not eliminate it.

Try something like:
-ovc lavc -lavcopts vcodec=mpeg4 -sid 1

You may want to do mplayer -identify -frames 0 input.mkv   to make
sure you get the right value for -sid, depending on what you want.

Once you get the basic thing going, then you can look at fine tuning
for quality.  For everything that I do, I just use:
-lavcopts vcodec=mpeg4:vqscale=4:mbd=2:trell:mv0:v4mv

And that's good enough for me.

If you're already having to remux for hard subs, you may as well want
to resize for your target platform as well.   If you do some web
searches for [mencoder ipod], you'll get some good hits that talk
about converting DVDs, and most of that applies to MKVs as well, at
least the scaling bits.  I imagine that if you prescale the video to
your target platform, it will use less battery power because it won't
have to do the scaling locally.

So, for a test for you, you might try something like:

mencoder -sid 0 -oac lavc -ovc lavc -lavcopts
acodec=libmp3lame:vcodec=mpeg4 -o output.avi input.mkv

And see if that gives you a good starting point.  After that, then you
can tweak the options to get the quality that you want.

I tend to prefer mpeg4 over x264 because, from what I can see, the
quality is about the same, and mpeg4 is much faster.  Perhaps if I
played with more options, I'd see a different quality/performance
ratio.  Others probably have different opinions on choice of vcodec,
but that shouldn't matter for your original question of making hard
subs.

Finally, the MKV format really is superior in all ways to AVI.  You
really should push the vendors to support the format, not have to work
around it like this.

mrc


More information about the MEncoder-users mailing list