4

I have some videos files where a few frames were missing. I can verify that by playing it in a video player and advance frame-by-frame, or by extracting all frames with ffpeg then check the output images

ffmpeg -loglevel trace -i myfile.mp4 myframes/frame%5d.png

At the end of the extraction I can see something like

frame= 2260 fps= 24 q=-0.0 Lsize=N/A time=00:01:15.33 bitrate=N/A dup=74 drop=0 speed=0.812x
video:2714746kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (myfile.mp4):
  Input stream #0:0 (video): 2221 packets read (57126959 bytes); 2186 frames decoded;
  Total: 2221 packets (57126959 bytes) demuxed
Output file #0 (myframes/frame%5d.png):
  Output stream #0:0 (video): 2260 frames encoded; 2260 packets muxed (2779899741 bytes);
  Total: 2260 packets (2779899741 bytes) muxed
2186 frames successfully decoded, 0 decoding errors

We can see dup=74 which means there are 74 duplicated frames. There are also 74 lines containing *** 1 dup! in the output log. However there's no information about those frames. How can I get the frame number (or time) of the duplicated frames? And why are there only 2221 packets being demuxed when the total number of muxed packets is already correct: 2186 + 74 = 2260?

phuclv
  • 26,555
  • 15
  • 113
  • 235
  • `dup=74` means ffmpeg has duplicated 74 frames. It does this when the output format requires constant frame rate and there are gaps in the input stream. To detect dupes in the input, see the freezedetect filter. – Gyan Mar 12 '21 at 17:06
  • @Gyan how can there be gaps in the input stream? The input file is at constant 30fps and I expect each frame will be extracted to a single image file – phuclv Mar 12 '21 at 17:12
  • `2186 frames decoded` instead of 2260 so ffmpeg has encountered gaps. – Gyan Mar 12 '21 at 17:27
  • 1
    @Gyan whatever, I'd like to know the positions of those gaps. How to do that? – phuclv Mar 13 '21 at 01:14

0 Answers0