[FFmpeg-trac] #9315(undetermined:new): MXF lgop created by ffmpeg plays out of order frames in Premiere Pro
FFmpeg
trac at avcodec.org
Tue Jul 6 16:37:33 EEST 2021
#9315: MXF lgop created by ffmpeg plays out of order frames in Premiere Pro
-------------------------------------+-------------------------------------
Reporter: Alex | Owner: (none)
Type: defect | Status: new
Priority: normal | Component:
| undetermined
Version: git-master | Resolution:
Keywords: MXF H264 | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by Tomas Härdin):
I took a quick look using mxfdump and ffprobe
ffprobe -show_packets -select_streams v:0 mxf_xavc_long_gop_input.mxf
{{{
[PACKET]
codec_type=video
stream_index=0
pts=2
pts_time=0.066733
dts=-1
dts_time=-0.033367
duration=1
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=72613
pos=111104
flags=K_
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=1
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=96750
pos=204800
flags=__
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=1
pts_time=0.033367
dts=1
dts_time=0.033367
duration=1
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=10779
pos=323072
flags=__
[/PACKET]
}}}
mxfdump -i mxf_xavc_long_gop_input.mxf
{{{
Bytestream Order:
EditUnit 0 for stream 0 is at 0x00000000, Flags=c4 *Exact*
EditUnit 0 for stream 1 is at 0x00000200, Flags=c4 *Exact*
EditUnit 0 for stream 2 is at 0x00011e00, Flags=c4 *Exact*
EditUnit 0 for stream 3 is at 0x00013200, Flags=c4 *Exact*
EditUnit 0 for stream 4 is at 0x00014600, Flags=c4 *Exact*
EditUnit 0 for stream 5 is at 0x00015a00, Flags=c4 *Exact*
EditUnit 1 for stream 0 is at 0x00016e00, Flags=13 *Exact*
EditUnit 1 for stream 1 is at 0x00017000, Flags=13 *Exact*
EditUnit 1 for stream 2 is at 0x0002ec00, Flags=13 *Exact*
EditUnit 1 for stream 3 is at 0x00030000, Flags=13 *Exact*
EditUnit 1 for stream 4 is at 0x00031400, Flags=13 *Exact*
EditUnit 1 for stream 5 is at 0x00032800, Flags=13 *Exact*
EditUnit 2 for stream 0 is at 0x00033c00, Flags=13 *Exact*
EditUnit 2 for stream 1 is at 0x00033e00, Flags=13 *Exact*
EditUnit 2 for stream 2 is at 0x00036a00, Flags=13 *Exact*
EditUnit 2 for stream 3 is at 0x00037e00, Flags=13 *Exact*
EditUnit 2 for stream 4 is at 0x00039200, Flags=13 *Exact*
EditUnit 2 for stream 5 is at 0x0003a600, Flags=13 *Exact*
[snip]
Presentation Order:
EditUnit 0 for stream 0 is at 0x00000000, Flags=c4 *Exact*
EditUnit 0 for stream 1 is at 0x00017000, Flags=13 *Exact*
EditUnit 0 for stream 2 is at 0x00011e00, Flags=c4 *Exact*
EditUnit 0 for stream 3 is at 0x00013200, Flags=c4 *Exact*
EditUnit 0 for stream 4 is at 0x00014600, Flags=c4 *Exact*
EditUnit 0 for stream 5 is at 0x00015a00, Flags=c4 *Exact*
EditUnit 1 for stream 0 is at 0x00016e00, Flags=13 *Exact*
EditUnit 1 for stream 1 is at 0x00033e00, Flags=13 *Exact*
EditUnit 1 for stream 2 is at 0x0002ec00, Flags=13 *Exact*
EditUnit 1 for stream 3 is at 0x00030000, Flags=13 *Exact*
EditUnit 1 for stream 4 is at 0x00031400, Flags=13 *Exact*
EditUnit 1 for stream 5 is at 0x00032800, Flags=13 *Exact*
EditUnit 2 for stream 0 is at 0x00033c00, Flags=13 *Exact*
EditUnit 2 for stream 1 is at 0x00000200, Flags=c4 *Exact*
EditUnit 2 for stream 2 is at 0x00036a00, Flags=13 *Exact*
EditUnit 2 for stream 3 is at 0x00037e00, Flags=13 *Exact*
EditUnit 2 for stream 4 is at 0x00039200, Flags=13 *Exact*
EditUnit 2 for stream 5 is at 0x0003a600, Flags=13 *Exact*
}}}
From this we know the first three packets are one IDR frame followed by
two non-referenced backward-prediction-only B frames. PTSes are: 2, 0, 1.
ffprobe -show_packets -select_streams v:0 ffmpeg_mxf_output.mxf
{{{
[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=1
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=72613
pos=7168
flags=K_
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=1
pts_time=0.033367
dts=1
dts_time=0.033367
duration=1
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=96750
pos=83968
flags=__
[/PACKET]
[PACKET]
codec_type=video
stream_index=0
pts=2
pts_time=0.066733
dts=2
dts_time=0.066733
duration=1
duration_time=0.033367
convergence_duration=N/A
convergence_duration_time=N/A
size=10779
pos=185344
flags=__
[/PACKET]
}}}
Here the packets are in the same bytestream order as the original file,
but the PTSes are messed up. mxfdump agrees with this:
mxfdump -i ffmpeg_mxf_output.mxf
{{{
Bytestream Order:
EditUnit 0 for stream 0 is at 0x00000000, Flags=c4 *Exact*
EditUnit 0 for stream 1 is at 0x00000200, Flags=c4 *Exact*
EditUnit 0 for stream 2 is at 0x00011e00, Flags=c4 *Exact*
EditUnit 1 for stream 0 is at 0x00012c00, Flags=33 *Exact*
EditUnit 1 for stream 1 is at 0x00012e00, Flags=33 *Exact*
EditUnit 1 for stream 2 is at 0x0002aa00, Flags=33 *Exact*
EditUnit 2 for stream 0 is at 0x0002b800, Flags=33 *Exact*
EditUnit 2 for stream 1 is at 0x0002ba00, Flags=33 *Exact*
EditUnit 2 for stream 2 is at 0x0002e600, Flags=33 *Exact*
[snip]
Presentation Order:
EditUnit 0 for stream 0 is at 0x00000000, Flags=c4 *Exact*
EditUnit 0 for stream 1 is at 0x00000200, Flags=c4 *Exact*
EditUnit 0 for stream 2 is at 0x00011e00, Flags=c4 *Exact*
EditUnit 1 for stream 0 is at 0x00012c00, Flags=33 *Exact*
EditUnit 1 for stream 1 is at 0x00012e00, Flags=33 *Exact*
EditUnit 1 for stream 2 is at 0x0002aa00, Flags=33 *Exact*
EditUnit 2 for stream 0 is at 0x0002b800, Flags=33 *Exact*
EditUnit 2 for stream 1 is at 0x0002ba00, Flags=33 *Exact*
EditUnit 2 for stream 2 is at 0x0002e600, Flags=33 *Exact*
}}}
The flags have also changed, but this is because mxfenc.c parses the H.264
packets to find out what they should be. I'm not sure what effect changing
13 to 33 has, if it's correct or not. Someone with knowledge of H.264
slice types should chime in.
More importantly the PTSes have changed to 0, 1, 2. I took a look at what
PTSes are coming into mxfenc.c, and they're 0, 1, 2. So the error is not
in mxfenc.c.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9315#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list