Opened 9 years ago

Last modified 4 years ago

#2516 new defect

pgssub produce warnings and are blinking

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: pgssub regression videolan
Cc: DoomBot Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

(Sample from videolan ticket 8521)
Original sample: http://streams.videolan.org/issues/TS/kagero.ts
The sample contains three subtitle streams, they play fine with the following MPlayer commands:
$ mplayer kagero.ts -sid 4608
$ mplayer kagero.ts -sid 4609
$ mplayer kagero.ts -sid 4610
The following commands show many warnings, but the subtitles also play fine:
$ mplayer kagero.ts -demuxer lavf -sid 0
$ mplayer kagero.ts -demuxer lavf -sid 1
$ mplayer kagero.ts -demuxer lavf -sid 2

The same warnings are shown with ffmpeg (and ffplay), additionally, the subtitles are shown with heavy blinking:

$ ffmpeg -analyzeduration 21M -probesize 11M -i kagero.ts -filter_complex [#0x1011][#0x1200]overlay -qscale 2 out.avi
ffmpeg version N-52577-g2609434 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr 30 2013 11:10:11 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 27.101 / 52. 27.101
  libavcodec     55.  6.100 / 55.  6.100
  libavformat    55.  3.100 / 55.  3.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 61.101 /  3. 61.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55822799, dts=55822820, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=3, pts=55822794, dts=55822820, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=4, pts=55822775, dts=55822820, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55834811, dts=55834832, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=3, pts=55834806, dts=55834832, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=4, pts=55834787, dts=55834832, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=4, pts=55846799, dts=55846844, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=3, pts=55846818, dts=55846844, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55846822, dts=55846844, size=13
Input #0, mpegts, from 'kagero.ts':
  Duration: 00:03:34.82, start: 600.000000, bitrate: 7583 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s
    Stream #0:2[0x1200](chi): Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:3[0x1201](jpn): Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:4[0x1202]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.3.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 200 kb/s, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 (mpeg2video) -> overlay:main (graph 0)
  Stream #0:2 (pgssub) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (mpeg4)
  Stream #0:1 -> #0:1 (ac3 -> ac3)
Press [q] to stop, [?] for help
Invalid timestamps stream=2, pts=55822799, dts=55822820, size=13te=4410.4kbits/s
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55834811, dts=55834832, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55846822, dts=55846844, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55855831, dts=55855853, size=13
Invalid timestamps stream=2, pts=55867843, dts=55867865, size=13te=4186.9kbits/s dup=0 drop=1
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55879855, dts=55879877, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55891867, dts=55891889, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55900876, dts=55900898, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55912888, dts=55912910, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55924900, dts=55924922, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55936912, dts=55936934, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55945921, dts=55945943, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55957933, dts=55957955, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55969945, dts=55969967, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55981957, dts=55981979, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=55990966, dts=55990988, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56002978, dts=56003000, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56014990, dts=56015012, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56027002, dts=56027024, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56036011, dts=56036033, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56048023, dts=56048045, size=13
Invalid timestamps stream=2, pts=56060035, dts=56060057, size=13te=4077.8kbits/s dup=0 drop=5
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56072047, dts=56072069, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56081056, dts=56081078, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56093068, dts=56093090, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56105080, dts=56105102, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56117092, dts=56117114, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56126101, dts=56126123, size=13
[mpegts @ 0x1de8a60] Invalid timestamps stream=2, pts=56138113, dts=56138135, size=13
frame=  707 fps=188 q=2.0 Lsize=   12003kB time=00:00:24.16 bitrate=4070.0kbits/s dup=0 drop=6
video:11400kB audio:559kB subtitle:0 global headers:0kB muxing overhead 0.374166%
$ ffplay -analyzeduration 21M -probesize 11M kagero.ts
ffplay version N-52577-g2609434 Copyright (c) 2003-2013 the FFmpeg developers
  built on Apr 30 2013 11:10:11 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 27.101 / 52. 27.101
  libavcodec     55.  6.100 / 55.  6.100
  libavformat    55.  3.100 / 55.  3.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 61.101 /  3. 61.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mpegts @ 0x7f997c000920] Invalid timestamps stream=2, pts=55822799, dts=55822820, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=3, pts=55822794, dts=55822820, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55822775, dts=55822820, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=2, pts=55834811, dts=55834832, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=3, pts=55834806, dts=55834832, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55834787, dts=55834832, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55846799, dts=55846844, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=3, pts=55846818, dts=55846844, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=2, pts=55846822, dts=55846844, size=13
Input #0, mpegts, from 'kagero.ts':
  Duration: 00:03:34.82, start: 600.000000, bitrate: 7583 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s
    Stream #0:2[0x1200](chi): Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:3[0x1201](jpn): Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
    Stream #0:4[0x1202]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55822775, dts=55822820, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55834787, dts=55834832, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55846799, dts=55846844, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55855808, dts=55855853, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55867820, dts=55867865, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55879832, dts=55879877, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55891844, dts=55891889, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55900853, dts=55900898, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55912865, dts=55912910, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55924877, dts=55924922, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55936889, dts=55936934, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55945898, dts=55945943, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55957910, dts=55957955, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55969922, dts=55969967, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55981934, dts=55981979, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=55990943, dts=55990988, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=56002955, dts=56003000, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=56014967, dts=56015012, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=56026979, dts=56027024, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=56035988, dts=56036033, size=13
[mpegts @ 0x7f997c000920] Invalid timestamps stream=4, pts=56048000, dts=56048045, size=13
 622.56 A-V:  0.002 fd=   0 aq=    5KB vq=  131KB sq=538447B f=0/0

The subtitles played fine with ffplay 0.6, regression since 931856a

Attachments (2)

kagero_cut.ts (2.4 MB ) - added by Carl Eugen Hoyos 9 years ago.
patchpgs.diff (2.1 KB ) - added by Carl Eugen Hoyos 9 years ago.
Hack from Reimar to show the reason for the problem

Change History (15)

by Carl Eugen Hoyos, 9 years ago

Attachment: kagero_cut.ts added

by Carl Eugen Hoyos, 9 years ago

Attachment: patchpgs.diff added

Hack from Reimar to show the reason for the problem

comment:1 by DoomBot, 9 years ago

Is this the same problem as the PGS subtitles in stand alone m2ts files, they would flash on screen really fast and vanish?
If so i see the same thing in the xbmc Gotham builds, this issue was fixed and then patched in frodo. The problem is back and very annoying. I could provide a sample if need be.

Thanks

in reply to:  1 comment:2 by Carl Eugen Hoyos, 9 years ago

Cc: DoomBot added

Replying to DoomBot:

Is this the same problem as the PGS subtitles in stand alone m2ts files, they would flash on screen really fast and vanish?

Please test 931856a and c5cb9c9 to confirm.

If so i see the same thing in the xbmc Gotham builds, this issue was fixed and then patched in frodo. The problem is back and very annoying. I could provide a sample if need be.

If it is a different issue reproducible with FFmpeg, it will (probably) not be fixed without a sample.
That being said, a second sample often does not hurt.

comment:3 by DoomBot, 9 years ago

Here's a sample file http://www.mediafire.com/?ey6l4qn2y9a69c8

If the link doesn't work please let me know.

Last edited 9 years ago by DoomBot (previous) (diff)

comment:4 by DoomBot, 9 years ago

Some info about what was done last time for the fix by ffmpeg http://trac.xbmc.org/ticket/12074#comment:6

in reply to:  3 comment:5 by Carl Eugen Hoyos, 9 years ago

Replying to DoomBot:

Here's a sample file http://www.mediafire.com/?ey6l4qn2y9a69c8

The file works fine here with both ffplay and ffmpeg (and MPlayer).

comment:6 by DoomBot, 9 years ago

Cool then this means it's xbmc thanks for checking.

comment:7 by Michael Niedermayer, 8 years ago

for ffmpeg the flickering can be fixed with:
this needs more investigation though

diff --git a/ffmpeg.c b/ffmpeg.c
index 5a47510..508a630 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2025,11 +2025,11 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
     if (!*got_output)
         return ret;
 
-    sub2video_update(ist, &subtitle);
-
     if (!subtitle.num_rects)
         goto out;
 
+    sub2video_update(ist, &subtitle);
+
     ist->frames_decoded++;
 
     for (i = 0; i < nb_output_streams; i++) {

comment:8 by Nicolas George, 8 years ago

I am afraid this change would break rendering of DVB subtiles, since an empty subtitle frame is used to mark the end of the previous one. I need to have a look at this issue.
(Fortunately, I will have more time soon to get back working on ffmpeg.)

in reply to:  8 comment:9 by Michael Niedermayer, 8 years ago

Replying to Cigaes:

I am afraid this change would break rendering of DVB subtiles, since an empty subtitle frame is used to mark the end of the previous one. I need to have a look at this issue.

yes, i had a bad feeling about my patch already ...

(Fortunately, I will have more time soon to get back working on ffmpeg.)

\o/

comment:10 by JohnAStebbins, 8 years ago

Has anyone confirmed that kagero_cut.ts has a *valid* PGS stream. I just took a closer look and it is violating the PGS spec or at least abusing it horribly. The spec states that the presentation time for a PGS sub is the PTS of the PES containing the presentation segment. The spec also states that only one presentation segment may be active at any point in time. This stream has multiple presentation segments that have the same PTS.

The fix that was committed for this appears very wrong to me, though it might be working around problems created by this broken stream.

comment:11 by Carl Eugen Hoyos, 8 years ago

Priority: importantnormal

The ffplay issue was fixed by Michael in e5eff191
The issue is still reproducible with the overlay filter, no regression (the overlay filter was added two weeks after the pgs code was changed in 2010).

in reply to:  10 comment:12 by Carl Eugen Hoyos, 8 years ago

Replying to JohnAStebbins:

Has anyone confirmed that kagero_cut.ts has a *valid* PGS stream.

I don't think this matters (much): If possible, FFmpeg also decodes invalid streams. Especially if other open source software plays the sample (or in this case the subtitles).

Only with a non-default strict level should an invalid stream be rejected.

The fix that was committed for this appears very wrong to me

Please write to the development mailing list, patches should not be discussed here.

comment:13 by Elon Musk, 4 years ago

Is issue still reproducible with overlay filter?

Note: See TracTickets for help on using tickets.