<ul>
<li><code>duration</code> is in seconds, e.g. <code>15.9</code></li>
<li><code>duration_ts</code> is in the media's <code>time_base</code>, e.g. <code>1/30014 * 479000 = 15.959219</code></li>
</ul>

CC BY-SA 4.0
2019-05-01T17:08:42.183Z
2020-05-22T02:46:24.950Z
2020-05-22T02:46:24.950Z
SlimSCSI
<p>I am relatively a beginner in <strong>ffmpeg</strong> and video production and was trying to extract duration of a video using <strong>ffprobe</strong>, using the following command:</p>

<pre><code>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
                }
            ]
        }
    ]
}
</code></pre>

<p>I have been trying to understand what is the difference between </p>

<p><strong>duration_ts</strong> and <strong>duration</strong></p>

<p>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 <code>duration_ts</code> here refers to.</p>

CC BY-SA 4.0
2019-05-01T10:24:45.860Z
`duration_ts` is in timebase units. See https://stackoverflow.com/questions/43333542/what-is-video-timescale-timebase-or-timestamp-in-ffmpeg/43337235#43337235
Gyan
<ffmpeg><ffprobe>
Difference between duration_ts and duration in ffprobe output?
pyvkd
# Difference between duration_ts and duration in ffprobe output?

(Asked by: username_0 on 2019-05-01)

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.

**Tags:** ffmpeg, ffprobe

> **Comments:**
> **username_1**: `duration_ts` is in timebase units. See https://stackoverflow.com/questions/43333542/what-is-video-timescale-timebase-or-timestamp-in-ffmpeg/43337235#43337235  

---

## 1 answers

### Answer by username_2 on 2019-05-01. Score: 12 | Accepted answer

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


---

