News:

--

Main Menu

Frame Rate Incorrectly Reported

Started by Hushpower, November 15, 2023, 11:22:11 PM

Previous topic - Next topic

Hushpower

I've been playing around with a MTS file, which is attached. AVIDemux, in File Information, is reporting it as 50fps, but every other program I've got eg VideoRedo, Magix, Virtual Dub and Media Info is reporting it as 25fps.

When I do a "Copy Copy" on it, the resulting file shows 50fps in MediaInfo.

It seems AVIDemux is reading the frame rate incorrectly, and then applying that incorrect frame rate to the output file, even though it's only "copying" it.

I'm not an expert on this stuff so may be off on a tangent...

I've attached my version of AVIDemux and added a Google Drive link because the forum wouldn't accept an M2TS.

File:
https://drive.google.com/file/d/12AdNw4ZeF8UU1vJWejbnDGtWHK2ZsRC7/view?usp=sharing

eumagga0x2a

I'll try to look at the sample tomorrow, it might be a field-encoded interlaced video. In such a case, Avidemux must use the field rate when in copy mode (the frame rate is half the field rate).

Hushpower

Thank you, this problematic file came up (as an MTS) on the Magix forum. It looks like it was sourced from a DVB-T recording of some kind and Magix couldn't open it. I did a Copy Copy with AVIDemux into MP4 and it fixed it nicely. The only issue is the incorrect reported frame rate.

The general consensus was the MTS was weirdly encoded, hence the trouble with it.

eumagga0x2a

From the output of mediainfo:

Video
ID                                       : 4113 (0x1011)
Menu ID                                  : 807 (0x327)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Format settings, GOP                     : M=4, N=24
Codec ID                                 : 27
Duration                                 : 2 min 45 s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Active Format Description                : Full frame 16:9 image
Frame rate                               : 25.000 FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan type, store method                  : Separated fields
Scan order                               : Top Field First

As suspected, field-encoded video, hence the "framerate" is set to field rate = 50 fps. It works as it should.

Hushpower

Thanks for checking it out, Eumag. My point is that, after a "Copy Copy>Mp4" operation by AVIDemux, the output file is incorrectly coded by AVIDemux as 50fps. The original, and output, file is 25fps, TFF.

Shouldn't AVIDemux code the outputted file as 25fps (being frames per second) and not 50fps as it is currently doing?


eumagga0x2a

Actually, the original material is a mixture of 50 and 25 fps – mostly 25 fps, but the presenter in the studio is filmed at 50 fps: re-encode with deinterlacer outputting frame per field (which is the very purpose of encoding anything interlaced) to see.

Quote from: Hushpower on November 17, 2023, 12:34:42 AMMy point is that, after a "Copy Copy>Mp4" operation by AVIDemux, the output file is incorrectly coded by AVIDemux as 50fps.

Avidemux doesn't change anything in the stream except of repackaging bitstream from Annex B needed for MPEG-TS to ISO format needed for MP4. Technically, it doesn't matter at all whether a frame is a full picture or a field. All that matters is that the rate of data packets is 50 per second. ffmpeg handles it mostly the same way with a difference that it preserves the timebase denominator in MP4 at the standard timestamp accuracy of MPEG-TS of 90000 Hz (1800 / 90000) while Avidemux uses 500 / 25000 to express the same timing.

I've noticed that video stream extradata in the sample changes on-the-fly at frame 8248 (a frame in sense of a multi-media container; in sense of video stream it is a field, of course). This may result in broken files when edited and exported as MP4 or MKV as these formats require out-of-band extradata which never changes. At best, we will have a disagreement between video header and in-band extradata inside of video packets. With ffmpeg prioritizing in-band extradata and Avidemux preserving it when copying, the day will be saved, but nevertheless, it is a violation of the standard. I would generally recommend to deinterlace and re-encode such streams.