Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
18th February 2014, 00:49 | #1 | Link |
Registered User
Join Date: Jun 2005
Posts: 10
|
Convert .mkv to .mp4 with FFmpeg, how?
I've got some .mkv videos that (according to MediaInfo) contain these formats: Video = VC-1, Audio = WMA.
The videos play fine on my Windows machine, but I want to convert them so they can be played on my Android phone as well. Usually I can convert one container format to another by just copying the streams, like this: Code:
FFmpeg -i input.wmv -vcodec copy -acodec copy output.mp4 I guessed track 1 is the sound, so I kept the -vcodec copy and used "-acodec aac", that didn't work either: "Codec is experimental but experimental codecs are not enabled, see -strict -2". Instead, I tried "-acodec libvorbis" and that seemed to work, but it still can't be played on my Android phone. I assume I have to transcode the video stream as well. But I have no idea what to fill in there, or what encoding params to specify (or even how to specify them). The aac and libvorbis for audio were more or less guesses (after looking through the help). What command line should I use to convert input.mkv to output.mp4 so that the output file uses some more compatible audio & video formats? For example, x264 for video and mp3 or aac for audio? Thanks! |
18th February 2014, 02:58 | #2 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
|
Try something like this:
Code:
FFmpeg -i input.wmv -crf 20.0 -vcodec libx264 -acodec libvo_aacenc -ar 48000 -b:a 128k output.mp4 If you are not fixated on using ffmpeg, MkvToMp4 by Oreons is an excellent alternative. Cheers manolito |
19th February 2014, 12:57 | #3 | Link |
Registered User
Join Date: Jun 2005
Posts: 10
|
Awesome, thank you very much sir!
Just for my understanding, is there a description somewhere of these parameters and their values? From what I've read, the -crf 20.0 thing is a quality parameter. What does 20 mean, is that better than 10 or 30? And could I also specify something like "same quality as input"? (well, that's hard to do when transcoding, but I mean roughly the same average bitrate or something) Last edited by phabian; 19th February 2014 at 12:59. |
27th February 2014, 11:46 | #5 | Link |
Registered User
Join Date: Oct 2001
Location: Thailand
Posts: 259
|
-crf 20.0 is about recommended optimum for quality vs file size.
Using lower crf such as 19.0-16.0 will produce higher quality, but also higher file size. The x264 docs don't recommend using any lower number than 16.0 because you'll only get bigger file size, but not really noticeable improvement in quality. The difference is only measurable with tools such as PSNR, but when you actually watch it, you won't see any difference because they're so minuscule. If file size isn't an issue for you, then you could use crf=16. This will more or less equal "same quality as input". |
|
|