Do I firstly need to use something like mkvextract from mkvtoolnix, then for the videos with EAC3 audio tracks use eac3to to convert them to AC3, then use MP4box to package them as an MP4? Or am I missing any vital steps and tools there? I know there are plenty of GUI tools that do all this in one frontend without the need to use tools individually but I've found the ones I used were either outdated and barely worked or were just too confusing to use because they do too many things. I'd rather just use the individual tools myself.
Initially I found the tool MkvToMp4 which out of all of them seems to be the one I got on well enough with and it worked for a time, but it hasn't been updated in 7 years so is obviously no longer supported, and a handful of videos that I need to convert do have EAC3 audio tracks, and it fails whenever it tries to convert them (it just creates an MP4 video without any audio). The error it chucks out is also rather vague so I've no real clue as to what's wrong there.
I ended up trying FFMPEG's copy function too, which would have been good because it doesn't transcode, but due to the way these encoders all seem to be unable to handle constant 23.976 frame rates 100% accurately, it ends up producing a video with a variable frame rate. Ultimately the reason why I need to convert these videos to MP4 is because I need to edit them in Resolve which doesn't support Matroska. However Resolve evidently only likes constant frame rates in the imported clips (long story short it ****s up the videos). You'd think if FFMPEG has a copy function that doesn't re-encode then it shouldn't touch the frame rate either, but it does, even if I specify the frame rate. MkvToMp4 did not have this issue with the videos it actually worked with so I would have been happy to use it but as I say, it doesn't work with EAC3 audio tracks.
+ Reply to Thread
Results 1 to 10 of 10
MP4 is a container which (in contrast to e.g. AVI) supports variable frame rates at all. That doesn't mean that the frame rate of a specific file is indeed variable. Just that it does not only store one rate for the whole track (like AVI does), but instead timestamps for every frame. If Resolve requires a constant frame rate, did you ever try to load an elementary video stream not multiplexed in an MP4 container? They may have a header which stores one frame rate for the whole video stream. Just try if Resolve recognizes them at all, and using which file name extension...
PS: I remember there are two versions of MP4 (ISO Base Media v1 or v2). The first and slightly outdated format may differ in the handling of frame rates, I guess, but I am not sure. I wonder if either ffmpeg or MP4Box have parameters to force the legacy MP4 container format? Then it may be possible to enhance compatibility to picky software.
Also, mp4 usually uses a time base of 90,000. That's not evenly divisible by 23.976 (24000/1001) so muxers (even in copy mode) usually make the video VFR and alternate between 3753/90000 and 3754/90000 per frame. So 3/4 of the frames have a duration of 3754/9000 seconds, 1/4 have a duration of 3753/90000 seconds, for an average of 3753.75/90000 seconds.
Try my clever FFmpeg GUI.
Load your video mkv, click Main, click Multiplex, your mkv file is already selected as video source, select the same mkv as audio source, select the target file, set mp4 as container, select audio stream language, set Display ratio (DAR), click Multiplex. Done.
No encoding needed. Should also work with eac3 audio.
I'll try some things then, and report back.
In all likelihood the problem isn't the remuxing into mp4 but rather the software's inability to handle long GOP, out of order codecs. Most Resolve users are probably working with all i-frame codecs like ProRes.
I don't doubt Resolve is shite for this particular purpose but I have no other choice but to use it unfortunately. On the other hand, as I said before the videos I used mkvtomp4 to convert work in Resolve fine, basically it was only the videos with eac3 audio that I had to convert with something else (that of course ended up being FFMPEG) that Resolve has the problem with. That's why I just thought if I used the tools mkvtomp4 uses separately so I can deal with the eac3 videos I'd be good to go. I only realised it was the frame rate causing the problem when I was checking all the settings in Resolve for the added media. As I say though I'll try a few things and see what happens, I can think of a few things I can try here but can't until Friday.
I appear to have fixed my issue. I extract the video and audio with mkvextract from mkvtoolnix, then combine them in mp4box but with the correct fps set at 23.967. The resulting output mp4 plays fine and Resolve correctly identifies it as 23.976 instead of 24fps like it was with the converted videos made with ffmpeg.
Edit: Well, it would have fixed my issue but now mp4box refuses to mux one of the videos in particular, just one in particular, and whenever I try to run it through mp4box it chucks out the error "[MP4Mux] No timescale specified, guessing from media:0" and then seems to just quit without doing anything. I tried setting a timescale with -timescale and I've tried all sorts of values for the timescale but it doesn't work, I get the same error every single time.
While I try and fix that, I'm going to solve the absolute ultimate problem I had right from the very beginning, and kill the bastard who gave me these videos in mkv format.
Last edited by Xandros; 2nd Aug 2020 at 04:47.
You may also want to try mp4fpsmod to convert the 'VFR' of .mp4 files to CFR etc., without re-encoding.
See the discussion here:
I've looked into that before, but don't think I need it as this method I've concluded works well enough for me.
I've also now found out that the one particular video that doesn't work in the latest version of mp4box (the gpac version) does work with the version of mp4box mkvtomp4 uses. There must be some aspect to that one particular video stream, an error in the way it was originally encoded or something, that the newer gpac release of mp4box is having an issue with. I'll probably have to go on their github and tell them about that.