Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm new to ffmpeg (windows), and need some help. I want to convert my MKVs to MP4 with as little loss in quality as possible. The MKVs are made with makemkv, and contains among others DTS soundtrack. They are lossless. The reason I want to convert, is that I plan on stream it to iPads and apple tv. iPads don't support DTS and MKVs. The MKVs are both DVDs and BR. The MKVs contain video, soundtracks and subtiteles.

I have tried this, but get no sound due to DTS soundtrack: ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4

Can anybody help me?

What codecs should I use? MP4 is the best for apple?

share|improve this question
1  
Are there specific iPad and Apple TV versions you are targeting, or do you want to support all of them? –  LordNeckbeard May 24 at 0:42
1  
Note: MP4 is not a codec. It's just a file format (a "container"). –  slhck May 24 at 6:43
    
I have the newest iPod Air. I have the newest Apple TV. I know MP4 is a container and not a codec :) –  Striky May 24 at 8:14
    
Please include some information about one of your typical inputs. The complete console output of ffmpeg -i input.mkv will suffice. –  LordNeckbeard May 24 at 23:11
    
I have tried ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4 This did play but got no sound since apple does not play DTS. Have also tried ffmpeg -i input.mkv -strict experimental -c:v copy -c:a aac -b:a 192k -q:a 6 output.mp4 but the film (both video and sound) was not playing smooth on my iPad Air (both stream and downloaded). –  Striky May 25 at 7:44

1 Answer 1

up vote 0 down vote accepted

MP4 is indeed the best format for Apple devices and software. DTS is also indeed not supported, many MP4 video files contain two audio tracks, one DTS and one AAC.

There are multiple encoders available, all of them documented on the ffmpeg wiki. Which codec is available depends on how ffmpeg was compiled. libfdk_aac will give you the best results, but due to this codec being non-free it's not always available.

Things you can try (I put them in the order of my perceived quality, best first)

ffmpeg -i input.mkv -c:v copy -c:a libfdk_aac -b:a 128k output.mp4
ffmpeg -i input.mkv -strict experimental -c:v copy -c:a aac -b:a 192k output.mp4
ffmpeg -i input.mkv -c:v copy -c:a libfaac -b:a 192k output.mp4

If you want to retain the DTS track too, use the -map flag.

Not directly of use for OP, but the OS X program subler makes this process very easy.

EDIT: Comments tl;dr? OP solved problem with the following command

ffmpeg -i input.mkv -strict experimental -map 0:0 -map 0:1 -map 0:2 -map 0:3 -c:v copy -c:a aac -b:a 384 -c:s copy output.mp4

TIP: if -c:s copy for subtitles doesn't work, try -c:s mov_text.
Saved me on multiple occasions.

share|improve this answer
    
I don't think the internal AAC encoder's VBR mode works as intended. Last time I checked it was broken. Better go with CBR, and use VBR for the other encoders (libfdk and libfaac) –  slhck May 24 at 6:44
    
I have also read that libfdk_aac will give the best result. I have downloaded the 32-bit static version for Windows (git-9722a6a (2014-05-24)). How can I check if I have the libfdk codec? Edit: I get unknown encoder 'libfdk_aac'. WHere can I download it, or is there a almost as good audio codec? –  Striky May 24 at 8:58
    
Have tried both ffmpeg -i input.mkv -c:v copy -c:a libfdk_aac -b:a 128k output.mp4 and ffmpeg -i input.mkv -c:v copy -c:a libfaac -b:a 192k output.mp4 No go :( –  Striky May 24 at 9:11
    
@Striky "No go :(" I tried the last command with a fresh ffmpeg from Homebrew, works for me. Can you give more details on why it doesn't work for you? –  yorn May 24 at 10:11
    
@slhck: I just tried the -c:a aac -q:a 6 settings and compared the result with -c:a libfaac -b:a 192k, in my opinion the aac codec gives better results than libfaac, but since the codecs are under development, this may change. libfdk_aac will probably give even better results, but I don't have it available right now. –  yorn May 24 at 10:22

protected by Community Aug 21 at 2:14

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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