Lossless conversion of MKV to MP4 with Handbrake
Asked Answered
F

4

26

What is the argument that I need to provide to prevent Handbrake from losing the quality of the source video when converting to MP4. I've read over all the documentation and I can see where it throttles but I can't find how to tell Handbrake to just ignore the default settings and keep the existing settings.

Fitment answered 10/2, 2015 at 21:17 Comment(0)
T
48

If I understand you correctly, you just want to change the video from mkv to mp4 without changing the actual video. in this case, handbrake is the wrong tool for you, as it can only re-encode the video. But in yourcase, copying the video (and audio) would be more efficient. To do that, use ffmpeg. Google ffmpeg, and install the version for you OS. On windows, use the included batch file to open the ffmpeg prompt, on Linux just use the terminal. In both cases use this:

ffmpeg -i /path/to/video.mkv -c:v copy -c:a copy /path/to/save/video.mp4

That will create a copy of your video in .mp4 format, andgoes as fast as just copying the file would go.

In case you want to re-encode your video lossless, just use handbrake with constant quality andset the crf value to 18. It's not actually lossless that way, but you wouldn't be able to tell the difference.

Thomasinathomasine answered 10/2, 2015 at 23:46 Comment(4)
Tried several times and always messes up the audio sample and bit rate :\Anticipant
What if the mkv has multiple audio tracks?Paratyphoid
If you don't like to use command line, Install WinFF, it's free and open source, it's a front end for ffmpeg for Windows.Ninanincompoop
What if you have subtitles?Nashner
S
7

Handbrake does not Remux MKV or MP4.

REMUX: A rip of Blu-ray or HD DVD disk to another container format or just stripping the disc of menus and bonus material while keeping the contents of its audio and video streams intact, guaranteeing the exact 1:1 movie quality as on original disk.

MKV and MP4 are just containers.

Looks like you just want to Remux the video and audio into a new container, without re-converting the video and audio.

To do so just download Xmedia Recode and it will allow you to Remux your video file, (basically it just places the contents of whats in your MKV file into a new MP4 container, or vise-versa.

Check out this Xmedia Recode How to guide MKV to MP4: http://www.dvd-guides.com/guides/mobile-video/249-rip-dvd-convert-avi-mkv-to-android

And it will only take seconds or minutes depending on the file.

Also you can look at MKVToolNix for remuxing video and audio.

Survey answered 5/3, 2015 at 20:22 Comment(7)
Great tool, but tried several conversion / copy processes and always messes up the audio sample and bit rate :\Anticipant
When using Xmedia Recode you need to set BOTH the video and audio to copy from both dropdowns, then it just remux's the video and audio from MKV to MP4.Survey
That's what i've done! COPY on both! used 2 different video / audio sources, same result! :\ The problem is not this tool, cause i have the same problems using ffmpegAnticipant
@Anticipant that is weird, i never had that issue using Xmedia Recode. Keep in mind that if there is more than one audio source you have to do COPY for each audio source. But that is very weird indeed.Survey
@Anticipant Try and see if you can bring the file in MKVToolNix and see what is inside that file that might be causing this issue with it. videohelp.com/software/mkvtoolnixSurvey
After many hours of searching, i found a GUI for FFmpeg that does the trick! sourceforge.net/projects/ffmpegyagAnticipant
Thanks for sharing @Anticipant :)Survey
N
3

If you're using from OBS Studio, it recommends writing .mkv files. Because of this, it also comes with a built-in Remux tool which does what you want:

OBS Studio Remux Recordings

Using this tool gets you a lossless conversion of MKV to MP4. The reason they recommend MKV files is because they're better about saving in the event of a power-outage or sudden program crash. Once you've finished recording, remuxing back to MP4 is safe.

Nashner answered 27/1, 2021 at 2:21 Comment(0)
A
2

After many hours searching, i found a GUI for FFmpeg that does the trick! https://sourceforge.net/projects/ffmpegyag/

That is the only tool i found that will do the container conversion without messing up the audio file (it uses the right FFmpeg CMD, that can be SAVED as SCRIPT for later use!).

I set the interface parameters of VIDEO and AUDIO CODEC to COPY (other parameters stay as DEFAULT / NO CHANGE)

Anticipant answered 1/3, 2017 at 5:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.