9

I am relatively a beginner in ffmpeg and video production and was trying to extract duration of a video using ffprobe, using the following command:

ffprobe -loglevel error -select_streams v -show_entries stream -of json filename.mp4
Output:
{
    "programs": [

    ],
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "Baseline",
            "codec_type": "video",
            "codec_time_base": "250/15007",
            "codec_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 640,
            "height": 352,
            "coded_width": 640,
            "coded_height": 352,
            "has_b_frames": 0,
            "pix_fmt": "yuv420p",
            "level": 30,
            "chroma_location": "left",
            "refs": 1,
            "is_avc": "true",
            "nal_length_size": "4",
            "r_frame_rate": "15007/500",
            "avg_frame_rate": "15007/500",
            "time_base": "1/30014",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 479000,
            "duration": "15.959219",
            "bit_rate": "1826913",
            "bits_per_raw_sample": "8",
            "nb_frames": "479",
            "disposition": {
                "default": 1,
                "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
            },
            "tags": {
                "rotate": "90",
                "language": "und"
            },
            "side_data_list": [
                {
                    "side_data_type": "Display Matrix",
                    "displaymatrix": "\n00000000:            0       65536           0\n00000001:       -65536           0           0\n00000002:            0           0  1073741824\n",
                    "rotation": -90
                }
            ]
        }
    ]
}

I have been trying to understand what is the difference between

duration_ts and duration

Can someone just point me in the right direction to understand what each of them means? I understand that the duration stands for run time of video but don't know what duration_ts here refers to.

1

1 Answer 1

10
  • duration is in seconds, e.g. 15.9
  • duration_ts is in the media's time_base, e.g. 1/30014 * 479000 = 15.959219

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.