0

Recently I have been playing a lot of MPEG-TS videos on MPlayer. The sources of the videos are unclear to me, so I have no idea of with which software these TS videos were created.

The problem is that MPlayer's OSD often reports the wrong timestamp and duration; this seems to be MPEG-TS specific since I have never encountered (or at least I cannot recall encountering) such problems with MPEG-4 or H.264.

For instance, I have cut (with FFmpeg) the following sample from one of my TS videos: sample.ts hosted on Google Drive (no copyright infridgement intended). ffprobe sample.ts prints

Input #0, mpegts, from 'sample.ts':
  Duration: 00:00:09.99, start: 1.423344, bitrate: 2827 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], max. 104857 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x101]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 123 kb/s

When I play this video with MPlayer (no options passed), the osd timestamp begins at around 00:00:01, while the duration reported is 00:03:40 (note that this video is only 10 seconds long!).

I have also tested this on ffplay (with -vf showinfo), and the timestamp issue is consistent with MPlayer: the info shown for the first frame is

[Parsed_showinfo_0 @ 0x7fbd5242c620] n:0 pts:129003 pts_time:1.43337 pos:564 fmt:yuv420p sar:1/1 s:1920x1080 i:P iskey:1 type:I checksum:405DDE4C plane_checksum:[58C83B11 F8FAD95C B874C9D0]

Note that the pts_time is 1.43337 instead of the expected 0. So I guess the problem is related to libav*. Anyway, at least ffplay reports the correct duration, while MPlayer gets it wrong, which makes the scene more puzzling for me.

So my questions are

  1. Is this a known issue/bug?

  2. Is there any option to fix this?

This is really annoying for me since I need to extract frame timestamps for FFmpeg seeking from time to time. Any help is greatly appreciated.


For your reference, my MPlayer is MPlayer UNKNOWN-4.2.1 installed on OS X 10.9.3 from the mplayer-devel @36449_4+osd port of MacPorts.

1 Answer 1

1

Clearly I asked this question due to lack of knowledge of MPEG-TS. The behavior is expected, since MPEG-TS was simply designed this way. According to Etienne Buira on MPlayer-users mailing list,

AFAIK the format does not allow to reliably know where it is in the stream (designed to be continuous, and as the timestamps cannot grow forever, there is a need to cycle them).

Recreate the timestamps with FFmpeg:

ffmpeg -i input.ts -c:a copy -c:v copy -fflags +genpts output.ts

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .