Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I simply want to convert files, any format to any format (at the moment, I need to convert MKV to MP4-h264), without losing quality. I don't want to resize (scale) the video, I don't want to change its aspect ratio and I don't want it to lose quality (this is very important); all I want is "to change the format", that's all. Reason: my DVD player won't recognize any formats other than AVI or MP4. I don't care about file size, unless the difference between the input and the output files is absurdly huge. So, how do I do that?

I've already tried programs such as WinFF, Arista, Format Junkie, but their presets always change something which I don't want to be changed (size, aspec ratio, etc.). I'm not really sure, but I think the best way to get what I want is to go with the pure ffmpeg commands. But how?

By the way, Ubuntu 13.04 (64-bit), here. Thanks for your time, guys.

share|improve this question

marked as duplicate by djeikyb, minerz029, don.joey, Jorge Castro, karel Dec 30 '13 at 5:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
    
It seems to be interesting, vivid_vibe. I'll give it a try. Let's see what it can do. Thanks. :) –  user229552 Dec 28 '13 at 17:42
    
Dumindu Mahawela, I followed the link you provided and came across this command: "avconv -i input.mkv -codec copy output.mp4". This worked like a charm for me. Thanks for your time. :) –  user229552 Dec 28 '13 at 18:46
    
Post it as a answer here. –  user224082 Dec 29 '13 at 3:58

2 Answers 2

If you only want to convert mkv to mp4 then you will save quality and a lot of time rather by just changing the containers. Both of these are just wrappers over the same content so the cpu only needs to do a little work. Don't re encode as you will definitely lose quality.

It's very straight forward using ffmpeg: ffmpeg -i LostInTranslation.mkv -vcodec copy -acodec copy LostInTranslation.mp4

Here, you are copying the video codec and audio codec so nothing is being encoded.

Tip:

To convert all the mkv files in current directory, run a simple loop in terminal:

for i in $(ls *mkv); do ffmpeg -i $i -vcodec copy -acodec copy $i.mp4; done;

For future conversions, like from avi to mp4, checkout handrake.

share|improve this answer
    
Sayem, I tried your suggestion, but got this result: "[mp4 @ 0x134da20] Application provided invalid, non monotonically increasing dts to muxer in stream 0: -2 >= -2 av_interleaved_write_frame(): Invalid argument". Anyway, I've got what I want with the following command: "avconv -i input.mkv -codec copy output.mp4" which is pretty similar to the one you suggested. Thanks a lot for your time. :) –  user229552 Dec 28 '13 at 18:45
    
That for-loop dies when there are spaces in the file names ;-; –  EaterOfCode Sep 26 at 10:54
    
Replace $i by "$i"in the loop and it will work with filenames with spaces. –  Xavier Nov 30 at 4:18

Here is one you haven't tried. Handbrake

share|improve this answer
    
TheHerk, I couldn't install it. Added PPA, updated sources, tried to install "handbrake" package, but it says there's no such package to be installed. Go figure! –  user229552 Dec 28 '13 at 19:36
1  
Never mind, TheHerk. I found the correct name of the package: handbrake-gtk. Installed it, but didn't like it. But thanks anyway. :) –  user229552 Dec 28 '13 at 20:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.