MPEG-PS: incorrect total time
For some MPEG program streams (.mpg file), VLC may show an incorrect total time in the lower right corner. Some examples are (actual durations provided by MediaInfo):
- 14:20:28 (51628 s) shown for a 42:57 file (2577 s, 1301049344 bytes)
- 13:00:08 (46808 s) shown for a 38:56 file (2336 s, 1179578368 bytes)
- 13:33:41 (48821 s) shown for a 40:44 file (2444 s, 1230305280 bytes)
- 13:17:58 (47878 s) shown for a 1:00:11 file (3611 s, 1206548480 bytes)
I am using VLC 3.0.20 on openSUSE Leap 15.5.
- The issue also occurs with VLC 3.0.20 on Windows 10.
- The issue has existed for several years, although I don't know which VLC versions I were using then (most likely 3.0.x).
- kaffeine 2.0.18, which uses libvlc, is also affected by this issue.
- MPC-HC 1.7.13 on Windows 7 shows the correct duration.
- ffprobe 4.4.4 on Leap 15.5 shows the correct duration.
The first three files above contain MPEG video (.m2v) and MPEG audio (.mp2); the fourth file contains MPEG video (.m2v), MPEG audio (.mp2) and AC-3 audio (.ac3).
- The .mpg files were created by recording a show from German DVB-C (standard definition), demultiplexing with ProjectX (no errors), cutting with Cuttermaran 1.70, and multiplexing with mplex 2.2.4 (in Cuttermaran).
- In all four cases, the file size in bits divided by the VLC total time is 201.6 kbit/s, and that happens to be 1/50 of the program mux rate announced in the Pack headers (10.08 Mbit/s, DVD standard) -- which may or may not be a coincidence.
- The ratio between VLC total time and actual duration is ~20 for the first three files, and ~13.25 for the fourth file, so this ratio does not seem to be a constant.
The incorrect total time may appear to be a minor inconvenience, but it also makes seeking a position on the progress bar a bit of a challenge; the behaviour is similar to the one seen in issue #27314.
I am attaching a minimal example .mpg file, plus a .log file which contains the vlc -vvv output.
- Here, 02:39 (159 s) is shown for a 00:08 (8 s) .mpg file.
- The file size is 4030464 bytes, and 4030464*8/201600 = 159.94.
- The .mpg file contains three elementary streams: 0xE0 (MPEG video), 0xC0 (MPEG audio), and 0xBE (padding). There are 3944 packets.
- I checked the timestamps (SCR, PTS, DTS) I found in the packets, in particular those at the end of the file; they all looked fine to me.
Sample and log: https://streams.videolan.org/issues/28442/