Opened 8 weeks ago

Last modified 8 weeks ago

#11339 new defect

ffmpeg misdetecting framerate of dv

Reported by: dave rice Owned by:
Priority: normal Component: undetermined
Version: 7.1 Keywords: dv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

make a sample dv. Here I note that the output is 29.97 fps.

$ ffmpeg -y -f lavfi -i testsrc2=r=30000/1001:s=720x480 -f lavfi -i sine -pix_fmt yuv411p -c:v dvvideo -t 2 -ac 2 -ar 48000 test.dv
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/7.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.100 / 61. 19.100
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
Input #0, lavfi, from 'testsrc2=r=30000/1001:s=720x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, yuv420p, 720x480 [SAR 1:1 DAR 3:2], 29.97 fps, 29.97 tbr, 29.97 tbn
Input #1, lavfi, from 'sine':
  Duration: N/A, start: 0.000000, bitrate: 705 kb/s
  Stream #1:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> dvvideo (native))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[dvvideo @ 0x7fd195f17840] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd195f181c0] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd195f18b00] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd195f19480] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd195f19dc0] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd195f1a740] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd195f1b080] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd196a07d80] Only top-left chroma location is supported in DV, input value is: unspecified
[dvvideo @ 0x7fd195f0a440] Only top-left chroma location is supported in DV, input value is: unspecified
Output #0, dv, to 'test.dv':
  Metadata:
    encoder         : Lavf61.7.100
  Stream #0:0: Video: dvvideo, yuv411p(tv, progressive), 720x480 [SAR 1:1 DAR 3:2], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn
      Metadata:
        encoder         : Lavc61.19.100 dvvideo
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
      Metadata:
        encoder         : Lavc61.19.100 pcm_s16le
[out#0/dv @ 0x7fd195f090c0] video:7031KiB audio:375KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=   60 fps=0.0 q=-0.0 Lsize=    6914KiB time=00:00:02.00 bitrate=28320.0kbits/s speed=45.3x  

When I read the output back into ffmpeg, the frame rate is now 60K!

$ ffmpeg -i test.dv
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/7.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.100 / 61. 19.100
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[dv @ 0x7f9d7f804540] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'test.dv':
  Metadata:
    timecode        : 00:00:00:00
  Duration: 00:00:01.97, start: 0.000000, bitrate: 28771 kb/s
  Stream #0:0: Video: dvvideo, yuv411p, 720x480 [SAR 8:9 DAR 4:3], 28771 kb/s, 60k fps, 29.97 tbr, 60k tbn
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
At least one output file must be specified

The framerate thus causes fails when rewrapping the dv, such as ffmpeg -i test.dv -map 0 -c copy test.mov gives a fps 60000 is too large error.

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

Change History (4)

comment:1 by dave rice, 8 weeks ago

Am noting that in ffmpeg@5.1.6 the frame rate is as expected at 29.97 fps, rather than 60k fps.

e$ ffmpeg -i test.dv
ffmpeg version 5.1.6 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix='/usr/local/Cellar/ffmpeg@5/5.1.6_3' --datadir='/usr/local/Cellar/ffmpeg@5/5.1.6_3/share/ffmpeg' --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[dv @ 0x7fef5e805240] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'test.dv':
  Metadata:
    timecode        : 00:00:00:00
  Duration: 00:00:01.97, start: 0.000000, bitrate: 28771 kb/s
  Stream #0:0: Video: dvvideo, yuv411p, 720x480 [SAR 8:9 DAR 4:3], 25000 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
At least one output file must be specified

comment:2 by dave rice, 8 weeks ago

Ah this seems to be a duplicate of https://trac.ffmpeg.org/ticket/11338

comment:4 by dave rice, 8 weeks ago

I ran a bisect in git and the regression in the frame rate reporting happens in https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/c7a852b638b88f129790af31fc47c870c329eaaa.

Note: See TracTickets for help on using tickets.