[FFmpeg-user] 'incorrect' number of extracted frames in a non-VFR video

Jon Beyer jbeyer at gmail.com
Wed Aug 11 04:34:17 EEST 2021


I have a video that is supposedly not VFR (ffmpeg vfrdet command and output
pasted at the very bottom), but the number of extracted frames, or
frame count with ffprobe, doesn't match what would be expected based on
frame rate and duration by a large margin (off by a factor of nearly 3x).
Please note that this video comes from an older camera, and could well be
corrupted.

If I try to force a frame rate with the following, I still have an
incorrect number of frames.  Any ideas on how I can force the video to
29.97 and actually extract the number of frames that would be correct for a
CFR video of that duration and fps?


./ffmpeg -i 0578ad6d7c6e.original.mp4 -r 30000/1001 -vsync 2 -qscale 1
0578ad6d7c6e_img/%d.jpg
ffmpeg version N-103117-g1f58503013-tessus
https://evermeet.cx/ffmpeg/  Copyright
(c) 2000-2021 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg
--extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl
--enable-libaom --enable-libass --enable-libbluray --enable-libdav1d
--enable-libfreetype --enable-libgsm --enable-libmodplug
--enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg
--enable-libopus --enable-librubberband --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora
--enable-libtwolame --enable-libvidstab --enable-libvmaf
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3
--pkg-config-flags=--static --disable-ffplay
  libavutil      57.  3.100 / 57.  3.100
  libavcodec     59.  3.102 / 59.  3.102
  libavformat    59.  4.101 / 59.  4.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  1.103 /  8.  1.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mpeg, from '0578ad6d7c6e.original.mp4':
  Duration: 00:26:10.77, start: 0.218556, bitrate: 789 kb/s
  Stream #0:0[0x1bf]: Data: dvd_nav_packet
  Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m, top
first), 480x480 [SAR 4:3 DAR 4:3], Closed Captions, 29.97 fps, 29.97 tbr,
90k tbn
    Side data:
      cpb: bitrate max/min/avg: 2252800/0/0 buffer size: 1835008 vbv_delay:
N/A
  Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
Please use -q:a or -q:v, -qscale is ambiguous
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0x7fcc30008000] deprecated pixel format used, make sure you did
set range correctly
Output #0, image2, to '0578ad6d7c6e_img/%d.jpg':
  Metadata:
    encoder         : Lavf59.4.101
  Stream #0:0: Video: mjpeg, yuvj420p(pc, smpte170m, top first), 480x480
[SAR 4:3 DAR 4:3], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn
    Metadata:
      encoder         : Lavc59.3.102 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[mpeg2video @ 0x7fcc6f417200] ac-tex damaged at 25 26bitrate=N/A speed=  43x
[mpeg2video @ 0x7fcc6f417200] Warning MVs not available
[mpeg2video @ 0x7fcc6f417200] concealing 120 DC, 120 AC, 120 MV errors in I
frame
0578ad6d7c6e.original.mp4: corrupt decoded frame in stream 1
frame=14671 fps=1294 q=1.0 Lsize=N/A time=00:08:09.52 bitrate=N/A
speed=43.2x
video:235031kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown


> ./ffmpeg -i 0578ad6d7c6e.mp4 -vf vfrdet -an -f null -

ffmpeg version N-103117-g1f58503013-tessus
https://evermeet.cx/ffmpeg/  Copyright
(c) 2000-2021 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg
--extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl
--enable-libaom --enable-libass --enable-libbluray --enable-libdav1d
--enable-libfreetype --enable-libgsm --enable-libmodplug
--enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg
--enable-libopus --enable-librubberband --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora
--enable-libtwolame --enable-libvidstab --enable-libvmaf
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3
--pkg-config-flags=--static --disable-ffplay
  libavutil      57.  3.100 / 57.  3.100
  libavcodec     59.  3.102 / 59.  3.102
  libavformat    59.  4.101 / 59.  4.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  1.103 /  8.  1.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '0578ad6d7c6e.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:08:09.52, start: 0.000000, bitrate: 685 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
852x480 [SAR 1:1 DAR 71:40], Closed Captions, 602 kb/s, 29.97 fps, 29.97
tbr, 30k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 73 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.4.101
  Stream #0:0(und): Video: wrapped_avframe, yuv420p(progressive), 852x480
[SAR 1:1 DAR 71:40], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.3.102 wrapped_avframe
frame=14671 fps=8595 q=-0.0 Lsize=N/A time=00:08:09.52 bitrate=N/A speed=
287x
video:6304kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
[Parsed_vfrdet_0 @ 0x7f9c6cf064c0] VFR:0.000000 (0/14670)


More information about the ffmpeg-user mailing list