0

I am currently trying to learn a bit about multimedia containers, notably M2TS. To get a lot of information about the tracks that are contained in such files in a human readable format, I found the following command very convenient:

"c:\program files\ffmpeg\bin\ffprobe.exe" -print_format json -loglevel fatal -show_entries format:packet:stream -show_streams -count_frames -i input.m2ts > output.json

In the resulting JSON file, there are entries for the duration of each audio track as well as for the number of audio frames (among others). However, when computing the duration of an audio track from the number of frames read, I get another result than the duration in the JSON file.

An example (unimportant lines replaced by ...):

...
       {
            "index": 1,
            "codec_name": "dts",
            "codec_long_name": "DCA (DTS Coherent Acoustics)",
            "profile": "DTS-HD MA",
            "codec_type": "audio",
            "codec_tag_string": "[134][0][0][0]",
            "codec_tag": "0x0086",
            "sample_fmt": "s32p",
            "sample_rate": "48000",
            "channels": 8,
            "channel_layout": "7.1",
            "bits_per_sample": 0,
            "initial_padding": 0,
            "ts_packetsize": "192",
            "id": "0x1100",
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/90000",
            "start_pts": 1048560,
            "start_time": "11.650667",
            "duration_ts": 5247360,
            "duration": "58.304000",
            "bits_per_raw_sample": "24",
            "nb_read_frames": "5467",
            "nb_read_packets": "5467",
            ...
        },
...

Here is my problem:

This is a DTSHD-MA audio track. Hence, there are 93.750 frames/s. According to the JSON output, there are 5467 frames. The duration then should be (5467 / 93.750) = 58.315 s.

However, the duration according to the JSON output is 58.304 s.

The situation is similar with the other audio tracks in that file, and also with other audio tracks in other M2TS files. I can't imagine that every file I have test is corrupt or has errors; every file I have looked into is a MT2S file from a professionally mastered Blu-Ray disc (HD, not UHD).

Can somebody please explain where the difference comes from? What am I missing?

Binarus
  • 2,039
  • 14
  • 27

0 Answers0