2

I have videos captured at 200fps and I'm trying to label each frame with it's frame number. However, looking at the original videos with the following command:

ffprobe.exe -i YR7-020320-B1-2.avi -print_format json -loglevel fatal -show_streams -count_frames -select_streams v

and I get the following output:

{
    "streams": [
        {
            "index": 0,
            "codec_name": "dvvideo",
            "codec_long_name": "DV (Digital Video)",
            "codec_type": "video",
            "codec_time_base": "1001/30000",
            "codec_tag_string": "dvsd",
            "codec_tag": "0x64737664",
            "width": 720,
            "height": 480,
            "coded_width": 720,
            "coded_height": 480,
            "closed_captions": 0,
            "has_b_frames": 0,
            "sample_aspect_ratio": "8:9",
            "display_aspect_ratio": "4:3",
            "pix_fmt": "yuv411p",
            "level": -99,
            "chroma_location": "topleft",
            "refs": 1,
            "r_frame_rate": "30000/1001",
            "avg_frame_rate": "200/1",
            "time_base": "1/200",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 67735,
            "duration": "338.675000",
            "bit_rate": "192003405",
            "nb_frames": "67735",
            "nb_read_frames": "55652",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ]
}

I was wondering what the difference between nb_frames and nb-read-frames is, to know which one denotes the real total number of frames.

Thanks!

Alex Willcox
  • 21
  • 1
  • 2

2 Answers2

3

nb_frames is the number of frames as indicated in the file metadata - this may not always be recorded. nb_read_frames is the no. of frames returned by the decoder, so it requires full decoding of the stream.

Gyan
  • 85,394
  • 9
  • 169
  • 201
0

nb_frames is written as metadata in the header of the video file; It might be in-accurate sometimes.

nb_read_frames are the real number of frames in the video file. ffmpeg/ffprobe actually read through the video file, decode every frame, count the frames, to achieve this number. It is slow to generate this number, but it is absolutely correct.

Ben L
  • 171
  • 1
  • 9