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

v4r4n console.cowboy at gmail.com
Sun Jan 17 06:47:23 CET 2010


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

doesn't work, "Audio format 0x4134504d is incompatible with '-oac copy',
please try '-oac pcm' instead or use '-fafmttag' to override it.", etc.

$> mencoder -oac pcm -ovc copy -o output.avi input.mkv

Works but uses the wrong audio track.  Interesting to note, Video stream
size is listed as 1516.350 secs while the audio stream is 1516.544 secs.

What is a simple mencoder command that lists the track IDs?  I know mkvmerge
-i works, but I'd like to know the mencoder version.  When that first
command fails, track IDs are listed, but I'd rather not have to generate
data to see track IDs.

$> mencoder -oac pcm -aid 0 -ovc copy -o output.avi input.mkv

Gives me the audio track I want, but the file is huge and the rendering is
cumbersome (blocky/buggy).

I used

$> mencoder -oac copy -ovc raw -sub subtitles.srt -sub-bg-alpha 255 -utf8 -o
output.srt.avi input.avi

to make a large raw with baked subtitles, then Handbrake to re-encode that
into an iPod .m4v file.  This works well enough, but the original visual
artifacts that I saw in the raw are still there.

$> mencoder -sid 0 -oac faac -aid 0 -ovc lavc -lavcopts vcodec=mpeg4 -o
output.mc.test.avi input.mkv

results in low quality video, broken audio, but the subtitles work?

I tried to use the faac, libfaac, ac3, flac or libmp3lame options but my
mencoder couldn't find those libraries on my Ubuntu 9.10 system.  Not sure
how that got messed up or how to fix it since Synaptic says they're there..
anyways

$> mencoder -sid 0 -oac pcm -aid 0 -aid 0 -ovc lavc -lavcopts
vcodec=mpeg4:vqscale=4:mbd=2:trell:mv0:v4mv -o output.avi input.mkv

Actually solves the visual artifacts and video quality problems, and gives
me a 'good enough' .avi to feed Handbrake.

Trust me, I have no issues with MKV personally, I'm just trying my best to
be agnostic about all this and just find/use the right tools to get the job
done and make it work 'now' for my less technical friends.

Thanks for your thorough response to my earlier questions.

On Sat, Jan 16, 2010 at 12:07 PM, Mike Castle
<dalgoda+mplayer at gmail.com<dalgoda%2Bmplayer at gmail.com>
> wrote:

> 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
> _______________________________________________
> 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