"--start-time" does not work for *some* MPEG TS files (but --stop-time works for all)
Summary
When playing an MPEG TS file with --start-time=4
and --stop-time=8
options, VLC and libVLC do not take into account the --start-time
option for some TS files. The --stop-time
option works correctly for all my ts files.
Details
I'm using libVLC in my Java application through vlcj bindings.
There is a file server which generates ts files from live TV, Radio, etc. for every hour (the last file for current hour is generated as time goes by). I play those files successfully by passing a URL like this to VLC/libVLC:
file://192.168.1.2/tv/file-12-00.ts
The problem is that when I pass :start-time=x
and :stop-time=y
to libVLC or run VLC with --start-time=x
and --stop-time=y
options through CLI, the playback starts from 0 (zero) instead of the specified start time.
The problem also happens when placing ts files on my local machine too.
This problem happens only for TV ts files (that have video and audio) whether I play the last file that is being generated, or other files that have been created completely before. This problem does not happen when I play Radio ts files (which contain only audio) (whether live or completed).
The files are big (more than 700 MB) so I probably cannot share them here for reproducing the problem.
I tried to trim one of them with FFmpeg (./ffmpeg.exe -ss 0 -to 30 -i a.ts -c copy trimmed.ts
) but when playing the result with VLC/libVLC with start and stop options, the start option worked correctly (problem not reproduced).
I tried with VLC 3.0.18 and also VLC 3.0.19 (build 26fb05e9) and both of them had this bug. This is the output of the VLC (identical in both versions of VLC):
"C:/Program Files/VideoLAN/VLC/vlc.exe" --start-time=4 --stop-time=8 a.ts
[000001e9e10778c0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000001e9e30fc560] mpeg4audio packetizer: AAC channels: 1 samplerate: 24000
[000001e9e30f8920] avcodec decoder: Using D3D11VA (Intel(R) HD Graphics 630, vendor 8086(Intel), device 5912, revision 4) for hardware decoding
[h264 @ 000001e9e30fa540] mmco: unref short failure
[h264 @ 000001e9e30fa540] mmco: unref short failure
[h264 @ 000001e9e30fb2c0] reference picture missing during reorder
[h264 @ 000001e9e30fb2c0] Missing reference picture, default is 65721
[h264 @ 000001e9e30fa9c0] mmco: unref short failure
[000001e9e2cdd6f0] direct3d11 vout display error: SetThumbNailClip failed: 0x800706f4
This is the result of inspecting a TV ts file (which has start problem) with ffprobe:
...
[h264 @ 000002066d0c8f80] non-existing PPS 0 referenced
[h264 @ 000002066d0c8f80] decode_slice_header error
[h264 @ 000002066d0c8f80] no frame!
Input #0, mpegts, from 'file://192.168...':
Duration: 00:59:56.36, start: 92038.127000, bitrate: 1778 kb/s
Program 182
Stream #0:0[0x71c]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:11 DAR 20:11], 25 fps, 25 tbr, 90k tbn
Stream #0:1[0x71d]: Audio: aac_latm (HE-AACv2) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
This is the result of inspecting a Radio ts file (which worked correctly) with ffprobe:
[mpegts @ 000001e64118e640] PES packet size mismatch
[mpegts @ 000001e64118e640] Packet corrupt (stream = 0, dts = 17126278).
Input #0, mpegts, from 'file://192.168...':
Duration: 00:59:56.59, start: 92037.465667, bitrate: 67 kb/s
Program 482
Stream #0:0[0x12d5](Per): Audio: aac_latm (HE-AACv2) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
My system
- Windows 10 22H2 Build 19045.3086
- VLC 3.0.18 win64
- CPU Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
- GPU Intel(R) HD Graphics 630