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.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th February 2014, 00:49   #1  |  Link
phabian
Registered User
 
phabian's Avatar
 
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
This doesn't seem to work for files with VC-1 / WMA content: it says "track 1: could not find tag, codec not currently supported in container".

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!
phabian is offline   Reply With Quote
Old 18th February 2014, 02:58   #2  |  Link
manolito
Registered User
 
manolito's Avatar
 
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
Change the video CRF value and the audio bitrate according to your needs.

If you are not fixated on using ffmpeg, MkvToMp4 by Oreons is an excellent alternative.


Cheers
manolito
manolito is offline   Reply With Quote
Old 19th February 2014, 12:57   #3  |  Link
phabian
Registered User
 
phabian's Avatar
 
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.
phabian is offline   Reply With Quote
Old 19th February 2014, 14:32   #4  |  Link
smok3
brontosaurusrex
 
smok3's Avatar
 
Join Date: Oct 2001
Posts: 2,392
x264 --fullhelp
or
http://mewiki.project357.com/wiki/X264_Settings
__________________
certain other member
smok3 is offline   Reply With Quote
Old 27th February 2014, 11:46   #5  |  Link
Mole
Registered User
 
Mole's Avatar
 
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".
Mole is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.