Jump to content

Looking for the best way to convert MKV to MP4 keeping all video, audio, subtitles and chapter markers

GiSWiG

I've been using Handbrake to convert DVDs to use in tablets for traveling. Although I have no issue with my Nexus 7, the two Samsung tablets complain about MKV files. I have VLC on the Samsungs and it will play them fine as long as I go into VLC to open them but not through the file manager. On the Nexus, opening the file opens VLC without issues. If the movies are in MP4 then the Samsungs work fine. Without going through the hassle of a full re-encode, I'd rather convert them to MP4 without losing chapter info, audio tracks, etc. The movies I want to convert typically have an AC3 6-ch track, ACC Dolby/Stereo track, and will have chapter markers. These all come from Handbrake.

 

I've tried extracting the MKV streams and muxing them to MP4 using MP4Box GUI but the audio track are out of sync and chapter markers are lost

I've tried using VLC to convert but I lose secondary audio tracks and still loose chapter markers. Audio stays in sync.

 

 

MkvToMp4 seems to be doing the trick as long as I remember to set the audio tracks correctly. I have to make sure the AC3 is set to passthru and set the second audio track to a delay of 0, otherwise it defaults to 65515ms delay, which is a little over a minute. It will do batch too.

 

So, my questions:

Is MkvToMP4 a good method? Will I have (or have you had) any problems?

Are there any other methods that will work, keeping the audio tracks and chapter markers, preferably free?

 

Thanks

Link to comment
Share on other sites

Link to post
Share on other sites

Handbrake will transcode MKV files to MP4.

 

ETA: I'll have to check to see if chapter info was lost or not. i may not have opted for that last go around.

[FS][US] Corsair H115i 280mm AIO-AMD $60+shipping

 

 

System specs:
Asus Prime X370 Pro - Custom EKWB CPU/GPU 2x360 1x240 soft loop - Ryzen 1700X - Corsair Vengeance RGB 2x16GB - Plextor 512 NVMe + 2TB SU800 - EVGA GTX1080ti - LianLi PC11 Dynamic
 

Link to comment
Share on other sites

Link to post
Share on other sites

Re-encoding (or transcoding) is truly the only way. I personally use Adobe Media Encoder.

Spoiler alert: even VLC reencodes files, even if it needs to do it real time, which is why when playing certain video clips, CPU usage spikes.

"Not breaking it or making it worse is key."

"Bad choices make good stories."

Link to comment
Share on other sites

Link to post
Share on other sites

both mkv and mp4 are just containers, what's in them gives you problem playing them corectly

Link to comment
Share on other sites

Link to post
Share on other sites

i think this might help you out 

 

"

you don't need to encode anything, you just change the "wrapping" around the video. This doesn't lose quality.

You can swap containers easily with FFmpeg – you just have to tell it to copy the video and audio bitstreams:

ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4

Note that this only works if the audio and video codecs are supported in the MP4 container, which is the case for H.264/H.265 and AAC, for example, but not for many others.

"

orginal post

http://superuser.com/questions/472420/handbrake-settings-to-convert-mkv-to-mp4-while-retaining-the-original-quality

Link to comment
Share on other sites

Link to post
Share on other sites

14 hours ago, yamileon said:

i think this might help you out 

 

"

you don't need to encode anything, you just change the "wrapping" around the video. This doesn't lose quality.

You can swap containers easily with FFmpeg – you just have to tell it to copy the video and audio bitstreams:


ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4

Note that this only works if the audio and video codecs are supported in the MP4 container, which is the case for H.264/H.265 and AAC, for example, but not for many others.

"

orginal post

http://superuser.com/questions/472420/handbrake-settings-to-convert-mkv-to-mp4-while-retaining-the-original-quality

Thanks. I didn't think ffmpeg would do it without complex command line but it copies the chapters over perfectly except it adds them a second time as a text menu. Through Mediainfo, the chapters are listed twice, both under a Menu type but one specifies that it is English text. If you enable subtitles in VLC, you see the chapter name throughout the chapter. Not sure how players on tablets will handle that but I use VLC so I assume no problems there. I'll try to find a way to prevent that. 

 

Thanks again!

Link to comment
Share on other sites

Link to post
Share on other sites

16 hours ago, knightslugger said:

Handbrake will transcode MKV files to MP4.

 

ETA: I'll have to check to see if chapter info was lost or not. i may not have opted for that last go around.

 

16 hours ago, kimsejin5 said:

Re-encoding (or transcoding) is truly the only way. I personally use Adobe Media Encoder.

Spoiler alert: even VLC reencodes files, even if it needs to do it real time, which is why when playing certain video clips, CPU usage spikes.

As zMeul said, MKV and MP4 are just containers. The audio and video streams are the same, no need for transcoding; you'll lose quality. Think of text in Word .DOC and a DOCX files. Both can containt the exact same text and format, DOCX just has more features and might not be 100% backward compatible with DOC (I have yet to come accross any for my uses.) 

 

Converting anything to MKV is easy thanks to MKVToolkitNIX. I was trying to find a way to demux/extract the video and audio streams and remux them to an MP4 container which seems difficult, at least to find a good utility to do so. MkvToMp4 kinda works but not 100%. ffmpeg is working out great. It actually converted a full length movie 1h 41m @ 1.5GB to an MP4 with the same audio and video tracks in less than a minute.

Link to comment
Share on other sites

Link to post
Share on other sites

I found what I needed in ffmpeg:

 

ffmpeg -i "INPUT.mkv" -c copy -map 0 -movflags disable_chpl -f mp4 "OUTPUT.mp4"

 

Makes a MP4 copy of the MKV with all streams and omits creating Nero style chapters. Converts all my MKVs in less than a minute. This is very useful indeed. If a movie is split across discs, it is quite easy to output to MKV, join them using MKVToolNix and use ffmpeg to convert to MP4.

 

Easy peasy!

(ok, that's my daughter talking)

Link to comment
Share on other sites

Link to post
Share on other sites

Guest
This topic is now closed to further replies.

×