Opened 2 years ago
Last modified 2 years ago
#9315 new defect
MXF lgop created by ffmpeg plays out of order frames in Premiere Pro
Reported by: | Alex | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | MXF H264 |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
Remuxing h.264 L-Gop video streams in MXF containers created by Premiere Pro with FFmpeg using "ffmpeg -i input.mxf -vcodec copy output.mxf" creates MXF files that play out of order frames in Premiere Pro.
The same output files play fine in vlc and ffplay.
How to reproduce:
Create an MXF h.264 L-GOP file in Premiere Pro (also from my Canon C70 Camera).
I'm including a file: *mxf_xavc_long_gop_input.mxf* as a sample since it has frame numbers.
% ffmpeg -i mxf_xavc_long_gop_input.mxf -vcodec copy ffmpeg_mxf_output.mxf ffmpeg version 2021-06-30-git-de8e6e67e7-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.3.0 (Rev2, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 3.100 / 59. 3.100 libavformat 59. 3.101 / 59. 3.101 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.103 / 8. 0.103 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Guessed Channel Layout for Input Stream #0.1 : mono Guessed Channel Layout for Input Stream #0.2 : mono Guessed Channel Layout for Input Stream #0.3 : mono Guessed Channel Layout for Input Stream #0.4 : mono Input #0, mxf, from 'mxf_xavc_long_gop_input.mxf': Metadata: operational_pattern_ul: 060e2b34.04010101.0d010201.01010900 toolkit_version_num: 5.3.0.0.1 uid : 4d96ec40-dc9b-11eb-8de7-00d861c7e796 generation_uid : 4d96ec41-dc9b-11eb-94dc-00d861c7e796 company_name : Adobe Inc. product_name : Premiere Pro product_version_num: 1.0.0.0.1 product_version : 15.2.0 application_platform: win32 product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f modification_date: 2021-07-04T07:41:54.468000Z material_package_umid: 0x060A2B340101010501010D1213000000A2E9A60199930597D73500D861C7E796 timecode : 00:00:00;00 Duration: 00:00:01.00, start: 0.000000, bitrate: 12083 kb/s Stream #0:0: Video: h264 (High 4:2:2), yuv422p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 29.97 tbn Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 2 Stream #0:1: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 3 Stream #0:2: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 4 Stream #0:3: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 5 Stream #0:4: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 6 File 'ffmpeg_mxf_output.mxf' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help Output #0, mxf, to 'ffmpeg_mxf_output.mxf': Metadata: operational_pattern_ul: 060e2b34.04010101.0d010201.01010900 toolkit_version_num: 5.3.0.0.1 uid : 4d96ec40-dc9b-11eb-8de7-00d861c7e796 generation_uid : 4d96ec41-dc9b-11eb-94dc-00d861c7e796 timecode : 00:00:00;00 material_package_umid: 0x060A2B340101010501010D1213000000A2E9A60199930597D73500D861C7E796 product_version_num: 1.0.0.0.1 modification_date: 2021-07-04T07:41:54.468000Z application_platform: win32 product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f encoder : Lavf59.3.101 Stream #0:0: Video: h264 (High 4:2:2), yuv422p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 29.97 tbn Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 2 Stream #0:1: Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 3 encoder : Lavc59.3.100 pcm_s16le frame= 30 fps=0.0 q=-1.0 Lsize= 775kB time=00:00:01.00 bitrate=6342.9kbits/s speed= 262x video:638kB audio:94kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.974101%
I will include the resuling MXF files that plays fine in vlc and ffplay, but plays out of order in premiere.
I will also include a render, from premiere pro, of the resulting file that shows the out of order frames
Attachments (3)
Change History (7)
by , 2 years ago
Attachment: | mxf_xavc_long_gop_input.mxf added |
---|
by , 2 years ago
Attachment: | ffmpeg_mxf_output.mxf added |
---|
result mxf file created by ffmpeg -vcodec copy
by , 2 years ago
Attachment: | ffmpeg_mxf_output_Premiere_Pro_Frames.mp4 added |
---|
how Premiere Pro sees the frames in this file
comment:2 by , 2 years ago
Re-encoding still produces out-of-order frames in Premiere Pro, although in a different order
I just tried re-encoding the original file with:
ffmpeg -i .\mxf_xavc_long_gop_input.mxf -c:v libx264 ffmpeg_mxf_re_encoded.mxf ffmpeg version 2021-06-30-git-de8e6e67e7-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.3.0 (Rev2, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 3.100 / 59. 3.100 libavformat 59. 3.101 / 59. 3.101 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.103 / 8. 0.103 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Guessed Channel Layout for Input Stream #0.1 : mono Guessed Channel Layout for Input Stream #0.2 : mono Guessed Channel Layout for Input Stream #0.3 : mono Guessed Channel Layout for Input Stream #0.4 : mono Input #0, mxf, from '.\mxf_xavc_long_gop_input.mxf': Metadata: operational_pattern_ul: 060e2b34.04010101.0d010201.01010900 toolkit_version_num: 5.3.0.0.1 uid : 4d96ec40-dc9b-11eb-8de7-00d861c7e796 generation_uid : 4d96ec41-dc9b-11eb-94dc-00d861c7e796 company_name : Adobe Inc. product_name : Premiere Pro product_version_num: 1.0.0.0.1 product_version : 15.2.0 application_platform: win32 product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f modification_date: 2021-07-04T07:41:54.468000Z material_package_umid: 0x060A2B340101010501010D1213000000A2E9A60199930597D73500D861C7E796 timecode : 00:00:00;00 Duration: 00:00:01.00, start: 0.000000, bitrate: 12083 kb/s Stream #0:0: Video: h264 (High 4:2:2), yuv422p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 29.97 tbn Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 2 Stream #0:1: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 3 Stream #0:2: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 4 Stream #0:3: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 5 Stream #0:4: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 6 File 'ffmpeg_mxf_re_encoded.mxf' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (pcm_s24le (native) -> pcm_s16le (native)) Press [q] to stop, [?] for help [libx264 @ 0000023e5c0b6580] using SAR=1/1 [libx264 @ 0000023e5c0b6580] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0000023e5c0b6580] profile High 4:2:2, level 4.0, 4:2:2, 10-bit Output #0, mxf, to 'ffmpeg_mxf_re_encoded.mxf': Metadata: operational_pattern_ul: 060e2b34.04010101.0d010201.01010900 toolkit_version_num: 5.3.0.0.1 uid : 4d96ec40-dc9b-11eb-8de7-00d861c7e796 generation_uid : 4d96ec41-dc9b-11eb-94dc-00d861c7e796 timecode : 00:00:00;00 material_package_umid: 0x060A2B340101010501010D1213000000A2E9A60199930597D73500D861C7E796 product_version_num: 1.0.0.0.1 modification_date: 2021-07-04T07:41:54.468000Z application_platform: win32 product_uid : 0c3919fe-46e8-11e5-a151-feff819cdc9f encoder : Lavf59.3.101 Stream #0:0: Video: h264, yuv422p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbn Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 2 encoder : Lavc59.3.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D12139EDD55A8E9A601999305974D7F00D861C7E796 file_package_name: Source Package track_name : Track 3 encoder : Lavc59.3.100 pcm_s16le frame= 30 fps=0.0 q=-1.0 Lsize= 243kB time=00:00:01.00 bitrate=1989.1kbits/s speed=2.71x video:107kB audio:94kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 20.969059% [libx264 @ 0000023e5c0b6580] frame I:1 Avg QP:28.41 size: 17644 [libx264 @ 0000023e5c0b6580] frame P:23 Avg QP:33.75 size: 3518 [libx264 @ 0000023e5c0b6580] frame B:6 Avg QP:41.81 size: 1848 [libx264 @ 0000023e5c0b6580] consecutive B-frames: 63.3% 26.7% 10.0% 0.0% [libx264 @ 0000023e5c0b6580] mb I I16..4: 52.7% 35.5% 11.8% [libx264 @ 0000023e5c0b6580] mb P I16..4: 1.4% 4.3% 1.7% P16..4: 0.9% 0.4% 0.2% 0.0% 0.0% skip:91.2% [libx264 @ 0000023e5c0b6580] mb B I16..4: 0.2% 0.3% 0.7% B16..8: 4.0% 0.4% 0.1% direct: 0.0% skip:94.3% L0:34.9% L1:63.5% BI: 1.6% [libx264 @ 0000023e5c0b6580] 8x8 transform intra:49.6% inter:14.1% [libx264 @ 0000023e5c0b6580] coded y,uvDC,uvAC intra: 11.7% 0.0% 0.0% inter: 0.3% 0.0% 0.0% [libx264 @ 0000023e5c0b6580] i16 v,h,dc,p: 70% 26% 4% 0% [libx264 @ 0000023e5c0b6580] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 20% 41% 1% 0% 0% 0% 0% 0% [libx264 @ 0000023e5c0b6580] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 20% 26% 4% 3% 3% 4% 3% 4% [libx264 @ 0000023e5c0b6580] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0000023e5c0b6580] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0000023e5c0b6580] ref P L0: 74.1% 16.7% 9.2% [libx264 @ 0000023e5c0b6580] ref B L0: 84.7% 13.3% 2.0% [libx264 @ 0000023e5c0b6580] kb/s:876.32
Digging a bit deeper, it seems that the original file has all the frames in order, whereas the resulting files have the frames out of order, and Premiere Pro doesn't seem to want to deal with it.
Original file:
ffprobe -show_frames -select_streams v:0 .\mxf_xavc_long_gop_input.mxf [FRAME] media_type=video stream_index=0 key_frame=0 pkt_pts=0 pkt_pts_time=0.000000 pkt_dts=0 pkt_dts_time=0.000000 best_effort_timestamp=0 best_effort_timestamp_time=0.000000 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=204800 pkt_size=96750 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=B coded_picture_number=1 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [/FRAME] [FRAME] media_type=video stream_index=0 key_frame=0 pkt_pts=1 pkt_pts_time=0.033367 pkt_dts=1 pkt_dts_time=0.033367 best_effort_timestamp=1 best_effort_timestamp_time=0.033367 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=323072 pkt_size=10779 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=B coded_picture_number=2 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [/FRAME] ... etc
Result file (of remux)
ffprobe -show_frames -select_streams v:0 .\ffmpeg_mxf_output.mxf [FRAME] media_type=video stream_index=0 key_frame=0 pkt_pts=1 pkt_pts_time=0.033367 pkt_dts=1 pkt_dts_time=0.033367 best_effort_timestamp=1 best_effort_timestamp_time=0.033367 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=83968 pkt_size=96750 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=B coded_picture_number=1 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [/FRAME] [FRAME] media_type=video stream_index=0 key_frame=0 pkt_pts=2 pkt_pts_time=0.066733 pkt_dts=2 pkt_dts_time=0.066733 best_effort_timestamp=2 best_effort_timestamp_time=0.066733 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=185344 pkt_size=10779 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=B coded_picture_number=2 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [/FRAME] [FRAME] media_type=video stream_index=0 key_frame=1 pkt_pts=0 pkt_pts_time=0.000000 pkt_dts=N/A pkt_dts_time=N/A best_effort_timestamp=0 best_effort_timestamp_time=0.000000 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=7168 pkt_size=72613 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=I coded_picture_number=0 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [/FRAME] etc...
Re-Encoded file
ffprobe -show_frames -select_streams v:0 .\ffmpeg_mxf_re_encoded.mxf [FRAME] media_type=video stream_index=0 key_frame=1 pkt_pts=0 pkt_pts_time=0.000000 pkt_dts=2 pkt_dts_time=0.066733 best_effort_timestamp=0 best_effort_timestamp_time=0.000000 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=7168 pkt_size=17644 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=I coded_picture_number=0 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [SIDE_DATA] side_data_type=H.26[45] User Data Unregistered SEI message [/SIDE_DATA] [/FRAME] [FRAME] media_type=video stream_index=0 key_frame=0 pkt_pts=2 pkt_pts_time=0.066733 pkt_dts=3 pkt_dts_time=0.100100 best_effort_timestamp=2 best_effort_timestamp_time=0.066733 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=50176 pkt_size=2227 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=B coded_picture_number=2 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [/FRAME] [FRAME] media_type=video stream_index=0 key_frame=0 pkt_pts=1 pkt_pts_time=0.033367 pkt_dts=4 pkt_dts_time=0.133467 best_effort_timestamp=4 best_effort_timestamp_time=0.133467 pkt_duration=1 pkt_duration_time=0.033367 pkt_pos=29184 pkt_size=16777 width=1920 height=1080 pix_fmt=yuv422p10le sample_aspect_ratio=1:1 pict_type=P coded_picture_number=1 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=unknown color_primaries=unknown color_transfer=unknown chroma_location=left [/FRAME] etc
comment:3 by , 2 years ago
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.
comment:4 by , 2 years ago
If it helps diagnose the issue, I also had the same problem with h.264 l-gop .MXF files from my Canon C70 Cinema Camera.
In fact, my original issue was trying to remux files from my C70, and I was surprised that h.264 .MXF files created by Premiere Pro have the same issue.
If there is anything I can do to help further diagnose this, please let me know!
Input MXF h.264 lgop file, created by premiere pro