News:

--

Main Menu

24 fps mkv to mp4 copy mode inconsistency

Started by Amey8a, July 15, 2020, 02:24:18 PM

Previous topic - Next topic

Amey8a

Hi, I was muxing some of my 24 fps mkv files to mp4 using avidemux. For checking the consistency, I took two mkv files of same video as follows.

1. Source MKV made with avidemux
2. MKV made with raw codec extracted from source mkv and muxed using mkvtoolnix.

I have muxed them to mp4 using avidemux and now I have these two results.

1. Avidemux mkv is correctly detected as 24 fps and also follows ffmpeg constant frame rate.
2. MKVtoolnix mkv frame detection is non-trivial. Avidemux detects it as variable frame rate and takes 1/90000 as a time base also the output mp4 shows many dts errors and vfr as seen from ffmpeg vfr response.

I have attached admlogs and ffmpeg vfr response for the test above.

eumagga0x2a

Before I get to looking into the content of the attachment, is it about possible shortcomings of mkvtoolnix?

Amey8a

Not exactly, out of 7 files 5 had constant 24fps which are clean after muxing (following the steps below) and only two had variable 24fps (bitstream timestamps not found), so I encoded those two files to 24fps resampled mkv using avidemux. Both of the encoded files have same issue as I have described in previous comment. Since they both are encoded using avidemux, I think it is something about avidemux.

these were the exact steps,
1. Extract raw codec from source mkv
2. Mux them using MKVtoolnix
3. Mux MKV to MP4 using avidemux
4. If constant fps, then end task

if variable then,
5. Encode them to mkv using avidemux with 24fps resampling
6. Extract raw codec from mkv
7. Mux them using MKVtoolnix
8. Mux MKV to MP4 using avidemux

eumagga0x2a

#3
The problem is

Scale : 1000000, tick=20833, fps=24000

You say the raw H.264 stream was created with Avidemux?

(Maybe the "Resample" video filter doesn't work right with 24 fps, only with "Film" fps which is 24000/1001)

The moral is: don't invoke MkvToolNix if the time base of the stream is wrong.

Amey8a

Quote from: eumagga0x2a on July 15, 2020, 03:28:40 PM
You say the raw H.264 stream was created with Avidemux?

Yes

Quote from: eumagga0x2a on July 15, 2020, 03:28:40 PM(Maybe the "Resample" video filter doesn't work right with 24 fps, only with "Film" fps which is 24000/1001)

It does work, when video is encoded 24fps resampled using avidemux, I get true constant fps verified with ffmpeg vfr weather encoded directly to avidemux mp4 or encoded to avidemux mkv followed by changing container to avidemux mp4.

It just when I extract the raw codec from avidemux encoded constant 24fps mkv and mux them with mkvtoolonix followed by changing container to mp4 using avidemux I get this issue.

I think I need to do more testing and see if the issue is reproducible using different settings.

Quote from: eumagga0x2a on July 15, 2020, 03:28:40 PM
The moral is: don't invoke MkvToolNix if the time base of the stream is wrong.

It is the exact same reason I use MKVtoolnix in the first place. Just to verify if raw stream have any issue or not since ffmpeg takes relatively more time to give me the warning.

eumagga0x2a

IMVHO, the whole procedure is unnecessarily complex. You get all the info already from loading the source MKV into Avidemux.

Amey8a

#6
Quote from: eumagga0x2a on July 15, 2020, 04:28:53 PM
IMVHO, the whole procedure is unnecessarily complex. You get all the info already from loading the source MKV into Avidemux.

Yes, the procedure was unnecessarily complex, but it taught me something today. From now on the admlog is the first option for file verification.

Found the Issue. It Seems that when muxing raw codec in mkvtoolnix, one needs to select the default duration/FPS for some video stream to be safe. MKVtoolnix might have some issue with fps detection of raw streams and that was causing the issue in container level. After selecting fps option in MKVtoolnix, everything is clean and verified successfully. There is no issue from avidemux side for muxing or encoding. Thanks for replying and have a nice day.

eumagga0x2a

There is an issue either in "Resample" or in the functions used by video encoder plugins in Avidemux. We are indeed culpable for the wrong timebase for 24 fps. Looking into options, thank you for your report.

Amey8a

Quote from: eumagga0x2a on July 15, 2020, 05:35:49 PM
There is an issue either in "Resample" or in the functions used by video encoder plugins in Avidemux. We are indeed culpable for the wrong timebase for 24 fps. Looking into options, thank you for your report.

I really appreciate your quick response on any query. I am glad to be a part of an active forum with active moderators.

eumagga0x2a


Amey8a

Quote from: eumagga0x2a on July 15, 2020, 06:36:41 PM
Should be fixed now, thank you again for your report.

That's good know. I will try the next latest build. Also 60 fps will be a good addition along 59.94fps though it is not used by many peoples other than streaming sites of course.

eumagga0x2a


Amey8a

#12
Quote from: eumagga0x2a on July 16, 2020, 03:38:36 PM
60 fps have been added ~ two weeks ago.

As a default option or as a support for 60fps detection?. In current build 60fps is not a selectable default option, though if a 60fps video is opened in avidemux I can put 60 as custom resampler fps or avidemux sets it automatically.

eumagga0x2a

Not as a predefined option in the "Resample" filter, but the function translating time increment to a fraction, needed by most encoders, which uses that array of time increment ranges matching standard fps values, will translate time increment resulting from custom fps of 60.00 in the "Resample" filter into correct 1000/60000 time base.

Amey8a

#14
That's much better from frame time detection perspective. Hope everyone use the same fraction based timescale. Thanks for informing the latest changes. I will look for new builds.