Opened 16 months ago

Last modified 2 months ago

#7939 new defect

The concat demuxer changes a constant frame rate into variable one

Reported by: RigacciOrg Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: concat
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The file "clip_mpeg2.ts" is an MPEG-2 transport stream in constant frame rate (as reported by ffprobe -show_format -show_streams):

codec_time_base=1001/60000
r_frame_rate=30000/1001
avg_frame_rate=30000/1001

If I concatenate it twice, to produce an mp4 file, I get a variable frame rate file! The concat command is:

ffmpeg -f concat -safe 0 -i clip-list.txt -c copy clip-concat.mp4

where the clip-list.txt contains just two lines with file 'clip_mpeg2.ts

In the resulting file, the codec_time_base is changed, r_frame_rate and avg_frame_rate are not exact:

codec_time_base=607/36000
r_frame_rate=179/6
avg_frame_rate=18000/607

I suspect that the source file has some bits which triggers this bug, because I was used to concatenate clips, but I never encountered this problem.

May be it is related to ticket #5380, because the input file is produced using -bsf:v h264_mp4toannexb.

If instead I use an mkv container as destination, the problem does not exist.

Attachments (3)

clip_mpeg2.ts (2.3 MB) - added by RigacciOrg 16 months ago.
MPEG-2 transport stream causing frame rate problem with concat demuxer
ffmpeg-20190604-130007.log (40.1 KB) - added by RigacciOrg 16 months ago.
The -report produced by ffmpeg execution
ffmpeg-20200723-180051.log (558.2 KB) - added by dprestegard 2 months ago.
example of concatenating 3 ProRes? MOV files

Change History (6)

Changed 16 months ago by RigacciOrg

MPEG-2 transport stream causing frame rate problem with concat demuxer

comment:1 Changed 16 months ago by cehoyos

  • Keywords h264_mp4toannexb codec_time_base avg_frame_rate removed

Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

Changed 16 months ago by RigacciOrg

The -report produced by ffmpeg execution

comment:2 Changed 2 months ago by dprestegard

Yeah, this does definitely happen for me too. I end up re-muxing the concatenated output with mp4box. This produces a clean CFR output.

I'm actually currently trying to find a solution for ProRes? in MOV. I have the same problem with that, and mp4box doesn't like it :(

Changed 2 months ago by dprestegard

example of concatenating 3 ProRes? MOV files

comment:3 Changed 2 months ago by dprestegard

In case anyone is struggling, I found a workaround with the shiny new version of mp4box which understands prores!

First, demux to an elementary prores stream like this

mp4box -raw 1 input.mov

(you'll get a file with an apch extension etc

Then, remux to your target frame rate like this (23.976 in my case):

mp4box -add demuxed.apch:fps=24000/1001 remux.mov

Note: See TracTickets for help on using tickets.