2

I'm making a little in-house utility using ffmpg and ffprobe. Works fine and does what is needed: give a count of the number of key frames in a video file plus some other details.

Alas, with the large video files this will be used on it can take many seconds for show_frames to return – and I then have to parse the JSON dump of frame data and keep a running count of the total key frames.

Is there a faster way? Perhaps it is listed in the "stream" or "format" data dumps and I am not recognizing what it is being called? I've been through the ffmpg and ffprobe docs and didn't find anything else.

spring
  • 18,009
  • 15
  • 80
  • 160
  • Have you found any solution to this problem ? Am also facing the same issue of parsing mp4 stss atom from http stream. – xyman Oct 12 '16 at 11:42

1 Answers1

1

For MP4 and MOV files, you can get this info by reading the contents of the STSS box

You can use a tool like MP4parser, which will generate a log file with an entry like this:

/moov/trak/mdia/minf/stbl/stss                              @ 0x1d7218e
  Box size: 0x74    version: 0x0    flags: 0x0
  entry_count:              0x19
    sample_number:
    0x1    0x86    0x180    0x27a    ....

That entry count (in Hex) is the number you want.

Alternatively, atomicparsley will also tell you of the location of the STSS within the file and you can then read it directly.

Gyan
  • 85,394
  • 9
  • 169
  • 201