I have a VFR video for which I am trying to extract all frames to .jpg's.
Applying ffprobe -i Video_Stream_0.mp4 -print_format json -loglevel fatal -show_streams -count_frames -select_streams v
shows me there are 7,387 frames in total:
Frame Count.
Applying ffmpeg -i Video_Stream_0.mp4 -vf vfrdet -an -f null -
tells me how bad the VFR is:
Lots of VFR.
The output generated with that command may provide a clue to the future problem: A clue. It's a little bewildering to me that the earlier line reports andan average frame rate of 6.02 fps while the later reports 6 fps.
Applying ffprobe -show_frames -of compact=p=0 -select_streams v:0 -f lavfi "movie=Video_Stream_0.mp4" > Output_Data.txt 2>&1
aggregates all the frame information. Frame 66 will be the problematic one, although I don't see anything pathological about the pts or dts: Frame 66 info.
The only thing unique about Frame 66 is that it has the shortest duration, coming in hot with a 32 ms duration: Frame 66 has 32 ms duration. Here I have sorted all frames by duration. The frame with the longest duration is 0.504 seconds, while most hover around 1/6 seconds per frame.
When applying ffmpeg -i Video_Stream_0.mp4 out-%03d.jpg
File Explorer says I have a folder with 7,364 .jpg's, 23 frames less than I expect. Yet the first file in the folder is out-001.jpg and the last file is out-7363.jpg, so perhaps there is one duplicate, or File Explorer is buggy. A clue is found in the ffmpeg output: Frame export clues.
We see dup=3 and drop=27. According to this thread: Why total frame count is different in ffmpeg than ffprobe? dup happens when there are two frames that are more than 1/FPS seconds apart. Looking at my Excel file, I have way more than 3 frames that are spaced far longer than 1/6.02 seconds per frame, so that doesn't make much sense. But the numbers add up in terms of 7,387 (expected) - 27 (dropped) + 3 (duplicated) = 7,363 frames.
Applying ffmpeg -i Video_Stream_0.mp4 -vsync vfr outVFR-%03d.jpg
gives me 7,359 frames. Not sure why not 7,360 since it is supposed to not duplicate.
Finally, the command ffmpeg -i Video_Stream_0.mp4 -vsync passthrough outVSYNCPass-%03d.jpg
gives me all the stills including frame 66 and then quits: Conversion Failed!.
So, how can I get out all 7,387 frames?