


And be forewarned: HEVC/x265 is very CPU intensive so if your machine doesn’t have a lot of CPU power it can take as long as a day or so to encode 90 minutes of video. Just be sure your hardware and OS supports HEVC/x265 playback. Note that I prefer to scale iOS videos to 720 when using HEVC/x265 the quality for playback without too much noise is solid on my MacBook, iPad and iPhone. This is similar to the above x264 command, but instead uses the HEVC/x265 to get a smaller file size with the same - if not better quality - video from the source MKV. ffmpeg -i input.mkv \Īn HEVC/x265 video encoded MP4 with AAC audio from an MKV I like doing this in cases where there are multiple audio tracks so I could do something like select -map 0:3 to get the third track. Note the mappings: -map 0:0 means the first ( 0) track from the source input ( 0) and the -map 0:1 means the second ( 1) track from the same source input ( 0).

An x264 video encoded MP4 with AAC audio from an MKVīasic conversion of an MKV with an MP4 in it but converting the audio to AAC at 128k. I know this is an old question - and already has an answer – but I wanted to share some commands I am using with FFmpeg on macOS. TIP: if -c:s copy for subtitles doesn't work, try -c:s mov_text. Not directly of use for OP, but the OS X program subler makes this process very easy.ĮDIT: 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 If you want to retain the DTS track too, use the -map flag. 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įfmpeg -i input.mkv -strict experimental -c:v copy -c:a aac -b:a 192k output.mp4įfmpeg -i input.mkv -c:v copy -c:a libfaac -b:a 192k output.mp4

libfdk_aac will give you the best results, but due to this codec being non-free it's not always available. Which codec is available depends on how ffmpeg was compiled. There are multiple encoders available, all of them documented on the ffmpeg wiki. DTS is also indeed not supported, many MP4 video files contain two audio tracks, one DTS and one AAC. MP4 is indeed the best format for Apple devices and software.
