Opened 14 months ago

Last modified 13 months ago

#10607 new defect

Remuxing MXF to MOV without re-encoding cannot find timecode framerate on some source files

Reported by: electron.rotoscope Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: mxf mov timecode
Cc: electron.rotoscope Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

For certain MXF source files, when using -c:v copy and creating an MOV, the muxer returns the error

[mov @ 0000023a49b5d140] Valid timecode frame rate must be specified. Minimum value is 1

and does not recreate source timecode in destination file. The ffmpeg terminal output actually does include a timecode : entry, but the actual file itself when read doesn't have timecode that Mediainfo or Blackmagic Davinci Resolve or ffmpeg can read

Three elements seem to be required for this error to occur:

1 - The file does not show an fps entry in the Stream #0:0: Video: part of ffmpeg's terminal output. I don't know what determines whether this happens, I created several test MXF files and I can't find a pattern for which ones include fps in ffmpeg and which don't. I'll include an attached .mxf file that doesn't have fps show up in the latest ffmpeg.

So for instance, this file has the problem

Stream #0:0: Video: dnxhd (DNXHR LB), yuv422p(tv, bt709, progressive), 3840x2160, SAR 1:1 DAR 16:9, 23.98 tbr, 23.98 tbn

And this file does not

Stream #0:0: Video: dnxhd (DNXHR LB), yuv422p(tv, bt709, progressive), 3840x2160, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23.98 tbn

2 - The -c:v copy flag is used. If it's not included, and ffmpeg defaults to transcoding to h264, then the issue doesn't come up and the output file has timecode

3 - The output file is an MOV. If it's remuxing to another MXF, the issue doesn't come up and the output file has timecode

How to reproduce:

C:\temp>ffmpeg -i dnxhr-lb-uhd_2fr.mxf -c:v copy remux.mov
ffmpeg version 2023-10-02-git-9e531370b3-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --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-libcodec2 --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      58. 27.100 / 58. 27.100
  libavcodec     60. 27.100 / 60. 27.100
  libavformat    60. 13.100 / 60. 13.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mxf, from 'dnxhr-lb-uhd_2fr.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : 8613ab7c-affe-466b-95c0-41b627d2407f
    generation_uid  : a1468d1c-ceaf-4bc5-9421-ccc1f027fe68
    company_name    : Blackmagic Design
    product_name    : DaVinci Resolve
    product_version : 18.1.4
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T20:02:02.616000Z
    application_platform: DaVinci Resolve
    material_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDB7E99060E2B347F7F2A80
    material_package_name: dnxhr-lb-uhd_2fr
    timecode        : 01:02:03:04
  Duration: 00:00:00.08, start: 0.000000, bitrate: 169262 kb/s
  Stream #0:0: Video: dnxhd (DNXHR LB), yuv422p(tv, bt709, progressive), 3840x2160, SAR 1:1 DAR 16:9, 23.98 tbr, 23.98 tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDC7E99060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd_2fr
      track_name      : dnxhr-lb-uhd_2fr_v1
[mov @ 0000022db61f8200] Valid timecode frame rate must be specified. Minimum value is 1
Output #0, mov, to 'remux.mov':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : 8613ab7c-affe-466b-95c0-41b627d2407f
    generation_uid  : a1468d1c-ceaf-4bc5-9421-ccc1f027fe68
    timecode        : 01:02:03:04
    material_package_name: dnxhr-lb-uhd_2fr
    material_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDB7E99060E2B347F7F2A80
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T20:02:02.616000Z
    application_platform: DaVinci Resolve
    encoder         : Lavf60.13.100
  Stream #0:0: Video: dnxhd (DNXHR LB) (AVdn / 0x6E645641), yuv422p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 23.98 tbr, 24k tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDC7E99060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd_2fr
      track_name      : dnxhr-lb-uhd_2fr_v1
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/mov @ 0000022db5d28840] video:1464kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.054298%
frame=    2 fps=0.0 q=-1.0 Lsize=    1465kB time=00:00:00.04 bitrate=287705.0kbits/s speed=15.5x

The file created does not have timecode ffmpeg can read

C:\temp>ffmpeg -i remux.mov
ffmpeg version 2023-10-02-git-9e531370b3-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --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-libcodec2 --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      58. 27.100 / 58. 27.100
  libavcodec     60. 27.100 / 60. 27.100
  libavformat    60. 13.100 / 60. 13.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'remux.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf60.13.100
  Duration: 00:00:00.08, start: 0.000000, bitrate: 143850 kb/s
  Stream #0:0[0x1]: Video: dnxhd (DNXHR LB) (AVdh / 0x68645641), yuv422p(tv, bt709), 3840x2160, 143773 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
At least one output file must be specified

Three ways this problem doesn't occur

This source has an fps entry

C:\temp>ffmpeg -i dnxhr-lb-uhd_24fr.mxf -c:v copy remux_has_fps.mov
ffmpeg version 2023-10-02-git-9e531370b3-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --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-libcodec2 --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      58. 27.100 / 58. 27.100
  libavcodec     60. 27.100 / 60. 27.100
  libavformat    60. 13.100 / 60. 13.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mxf, from 'dnxhr-lb-uhd_24fr.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : ae1cd8e5-1516-41ff-8c2d-650896c47bcc
    generation_uid  : a6fcbbfa-e0fa-4aa4-830e-e50016b89b56
    company_name    : Blackmagic Design
    product_name    : DaVinci Resolve
    product_version : 18.1.4
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T19:53:03.908000Z
    application_platform: DaVinci Resolve
    material_package_umid: 0x060A2B340101010501010D4313000000651B1F9F5A697E98060E2B347F7F2A80
    material_package_name: dnxhr-lb-uhd
    timecode        : 01:02:03:04
  Duration: 00:00:01.00, start: 0.000000, bitrate: 146077 kb/s
  Stream #0:0: Video: dnxhd (DNXHR LB), yuv422p(tv, bt709, progressive), 3840x2160, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23.98 tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B1F9F5A6A7E98060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd
      track_name      : dnxhr-lb-uhd_v1
Output #0, mov, to 'remux_has_fps.mov':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : ae1cd8e5-1516-41ff-8c2d-650896c47bcc
    generation_uid  : a6fcbbfa-e0fa-4aa4-830e-e50016b89b56
    timecode        : 01:02:03:04
    material_package_name: dnxhr-lb-uhd
    material_package_umid: 0x060A2B340101010501010D4313000000651B1F9F5A697E98060E2B347F7F2A80
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T19:53:03.908000Z
    application_platform: DaVinci Resolve
    encoder         : Lavf60.13.100
  Stream #0:0: Video: dnxhd (DNXHR LB) (AVdn / 0x6E645641), yuv422p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 24k tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B1F9F5A6A7E98060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd
      track_name      : dnxhr-lb-uhd_v1
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/mov @ 000002019a77bc00] video:17568kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.008449%
frame=   24 fps=0.0 q=-1.0 Lsize=   17569kB time=00:00:00.95 bitrate=150036.9kbits/s speed=79.4x

This is a transcode to h264

C:\temp>ffmpeg -i dnxhr-lb-uhd_2fr.mxf transcode.mov
ffmpeg version 2023-10-02-git-9e531370b3-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --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-libcodec2 --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      58. 27.100 / 58. 27.100
  libavcodec     60. 27.100 / 60. 27.100
  libavformat    60. 13.100 / 60. 13.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mxf, from 'dnxhr-lb-uhd_2fr.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : 8613ab7c-affe-466b-95c0-41b627d2407f
    generation_uid  : a1468d1c-ceaf-4bc5-9421-ccc1f027fe68
    company_name    : Blackmagic Design
    product_name    : DaVinci Resolve
    product_version : 18.1.4
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T20:02:02.616000Z
    application_platform: DaVinci Resolve
    material_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDB7E99060E2B347F7F2A80
    material_package_name: dnxhr-lb-uhd_2fr
    timecode        : 01:02:03:04
  Duration: 00:00:00.08, start: 0.000000, bitrate: 169262 kb/s
  Stream #0:0: Video: dnxhd (DNXHR LB), yuv422p(tv, bt709, progressive), 3840x2160, SAR 1:1 DAR 16:9, 23.98 tbr, 23.98 tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDC7E99060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd_2fr
      track_name      : dnxhr-lb-uhd_2fr_v1
Stream mapping:
  Stream #0:0 -> #0:0 (dnxhd (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0000023d658406c0] using SAR=1/1
[libx264 @ 0000023d658406c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0000023d658406c0] profile High 4:2:2, level 5.1, 4:2:2, 8-bit
[libx264 @ 0000023d658406c0] 264 - core 164 r3107 a8b68eb - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=30 lookahead_threads=5 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mov, to 'transcode.mov':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : 8613ab7c-affe-466b-95c0-41b627d2407f
    generation_uid  : a1468d1c-ceaf-4bc5-9421-ccc1f027fe68
    timecode        : 01:02:03:04
    material_package_name: dnxhr-lb-uhd_2fr
    material_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDB7E99060E2B347F7F2A80
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T20:02:02.616000Z
    application_platform: DaVinci Resolve
    encoder         : Lavf60.13.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv422p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 24k tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDC7E99060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd_2fr
      track_name      : dnxhr-lb-uhd_2fr_v1
      encoder         : Lavc60.27.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[out#0/mov @ 0000023d65788240] video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 52.509931%
frame=    2 fps=0.0 q=-1.0 Lsize=       4kB time=00:00:00.04 bitrate= 810.0kbits/s speed=0.294x
[libx264 @ 0000023d658406c0] frame I:1     Avg QP:12.00  size:  1840
[libx264 @ 0000023d658406c0] frame P:1     Avg QP:13.00  size:   239
[libx264 @ 0000023d658406c0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0000023d658406c0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%
[libx264 @ 0000023d658406c0] 8x8 transform intra:0.0%
[libx264 @ 0000023d658406c0] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0000023d658406c0] i16 v,h,dc,p: 99%  0%  1%  0%
[libx264 @ 0000023d658406c0] i8c dc,h,v,p: 96%  0%  4%  0%
[libx264 @ 0000023d658406c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000023d658406c0] kb/s:199.38

This remuxes to MXF

C:\temp>ffmpeg -i dnxhr-lb-uhd_2fr.mxf -c:v copy remux.mxf
ffmpeg version 2023-10-02-git-9e531370b3-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --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-libcodec2 --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      58. 27.100 / 58. 27.100
  libavcodec     60. 27.100 / 60. 27.100
  libavformat    60. 13.100 / 60. 13.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mxf, from 'dnxhr-lb-uhd_2fr.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : 8613ab7c-affe-466b-95c0-41b627d2407f
    generation_uid  : a1468d1c-ceaf-4bc5-9421-ccc1f027fe68
    company_name    : Blackmagic Design
    product_name    : DaVinci Resolve
    product_version : 18.1.4
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T20:02:02.616000Z
    application_platform: DaVinci Resolve
    material_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDB7E99060E2B347F7F2A80
    material_package_name: dnxhr-lb-uhd_2fr
    timecode        : 01:02:03:04
  Duration: 00:00:00.08, start: 0.000000, bitrate: 169262 kb/s
  Stream #0:0: Video: dnxhd (DNXHR LB), yuv422p(tv, bt709, progressive), 3840x2160, SAR 1:1 DAR 16:9, 23.98 tbr, 23.98 tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDC7E99060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd_2fr
      track_name      : dnxhr-lb-uhd_2fr_v1
Output #0, mxf, to 'remux.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Untitled Project
    uid             : 8613ab7c-affe-466b-95c0-41b627d2407f
    generation_uid  : a1468d1c-ceaf-4bc5-9421-ccc1f027fe68
    timecode        : 01:02:03:04
    material_package_name: dnxhr-lb-uhd_2fr
    material_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDB7E99060E2B347F7F2A80
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2023-10-02T20:02:02.616000Z
    application_platform: DaVinci Resolve
    encoder         : Lavf60.13.100
  Stream #0:0: Video: dnxhd (DNXHR LB), yuv422p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 23.98 tbr, 23.98 tbn
    Metadata:
      file_package_umid: 0x060A2B340101010501010D4313000000651B21BA2CDC7E99060E2B347F7F2A80
      file_package_name: dnxhr-lb-uhd_2fr
      track_name      : dnxhr-lb-uhd_2fr_v1
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/mxf @ 00000296fd5e8180] video:1464kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.549450%
frame=    2 fps=0.0 q=-1.0 Lsize=    1472kB time=00:00:00.04 bitrate=289128.8kbits/s speed=  18x

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

dnxhr-lb-uhd_2fr.mxf (1.7 MB ) - added by electron.rotoscope 14 months ago.
File that does recreate this issue. I don't have an example file that doesn't recreate this issue, I couldn't make one small enough and I can't figure out the pattern of what does or doesn't have this problem

Download all attachments as: .zip

Change History (3)

by electron.rotoscope, 14 months ago

Attachment: dnxhr-lb-uhd_2fr.mxf added

File that does recreate this issue. I don't have an example file that doesn't recreate this issue, I couldn't make one small enough and I can't figure out the pattern of what does or doesn't have this problem

comment:1 by Tomas Härdin, 13 months ago

This is due to movenc.c using avg_frame_rate for timecode rate, which it shouldn't. See mov_check_timecode_track(). avg_frame_rate relies on heuristics which is why you're finding the behavior hard to trigger. The fundamental issue is due to lavf passing timecode data around in metadata strings.

Short debugging log:
Does mxf_read_timecode_component() pick up RoundedTimecodeBase? Yes.
Does av_timecode_init() get the RoundedTimecodeBase? Yes, in the second call to av_timecode_init() in mxf_parse_structural_metadata() (line 2699).

So the issue is not in mxfdec per se, and movenc is definitely wrong. RoundedTimecodeBase should be passed unaltered from demuxer to muxer in case of stream copy and also in case of transcoding. If frame rate is changed then the metadata should be dropped and the user required to explicitly specify what the timecode data should be. Side data might be a more appropriate mechanism for timecodes.

comment:2 by Tomas Härdin, 13 months ago

I forgot to mention, one way the situation could be made better is if RoundedTimecodeBase were carried from demuxer to muxer as metadata also, as a string. But it'd be best to carry the entire TimecodeComponent as a unit I think, perhaps as side data.

Note: See TracTickets for help on using tickets.