Opened 11 years ago

Closed 9 years ago

#2161 closed defect (fixed)

Only one of two dvbsub streams decoded

Reported by: Carl Eugen Hoyos Owned by: Anshul
Priority: normal Component: avcodec
Version: git-master Keywords: videolan mpegts dvbsub
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

(videolan ticket 8054)
A vlc user provided a sample that contains two dvbsub subtitle streams that can be shown with mplayer -demuxer mpegts:

$ mplayer mentalist-1min-singleprogram.ts -demuxer mpegts -sid 0x96
$ mplayer mentalist-1min-singleprogram.ts -demuxer mpegts -sid 0x97

FFmpeg only decodes the first subtitle, the following command line produces a file with subtitles that can be shown with FFmpeg and MPlayer:

$ ffmpeg -i mentalist-1min-singleprogram.ts -qscale 2 -mbd 2 -map 0:0 -map 0:2 -map 0:5 -scodec dvdsub out.mpg

But the next command line produces an output file that shows no subtitles:

$ ffmpeg -i mentalist-1min-singleprogram.ts -qscale 2 -mbd 2 -map 0:0 -map 0:2 -map 0:6 -scodec dvdsub out.mpg
ffmpeg version N-49059-gbc15fcb Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 20 2013 18:01:12 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 15.100 / 52. 15.100
  libavcodec     54. 89.100 / 54. 89.100
  libavformat    54. 61.101 / 54. 61.101
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.101 /  3. 32.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpeg2video @ 0x26bcea0] 0x0 is invalid
    Last message repeated 7 times
[mpegts @ 0x2699060] max_analyze_duration 5000000 reached at 5016000 microseconds
[mpegts @ 0x2699060] PES packet size mismatch
    Last message repeated 3 times
Input #0, mpegts, from 'mentalist-1min-singleprogram.ts':
  Duration: 00:01:03.27, start: 74506.534033, bitrate: 2219 kb/s
  Program 1537
    Stream #0:0[0x78]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x82](fra): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2[0x83](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
    Stream #0:3[0x85](qad): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
    Stream #0:4[0x8c](fra): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:5[0x96](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
    Stream #0:6[0x97](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
  Program 1538
  Program 1539
  Program 1540
  Program 1541
  Program 1542
  Program 1543
  Program 1790
  Program 1791
  Program 1792
Please use -q:a or -q:v, -qscale is ambiguous
[mpeg @ 0x269b8e0] VBV buffer size not set, muxing may fail
Output #0, mpeg, to 'out.mpg':
  Metadata:
    encoder         : Lavf54.61.101
    Stream #0:0: Video: mpeg1video (hq), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Stream #0:1(eng): Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s
    Stream #0:2(eng): Subtitle: dvd_subtitle
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> mpeg1video)
  Stream #0:2 -> #0:1 (mp2 -> mp2)
  Stream #0:6 -> #0:2 (dvbsub -> dvdsub)
Press [q] to stop, [?] for help
Warning MVs not available size=     846kB time=00:00:25.08 bitrate= 276.3kbits/s dup=23 drop=0
[mpeg2video @ 0x26bcea0] concealing 15 DC, 15 AC, 15 MV errors in I frame
PES packet size mismatch0 size=    5464kB time=00:00:49.72 bitrate= 900.3kbits/s dup=23 drop=0
[mpeg2video @ 0x26bcea0] ac-tex damaged at 1 18
[mpeg2video @ 0x26bcea0] Warning MVs not available
[mpeg2video @ 0x26bcea0] concealing 810 DC, 810 AC, 810 MV errors in I frame
[mp2 @ 0x26c1540] incomplete frame
Error while decoding stream #0:2: Invalid data found when processing input
frame= 1535 fps=616 q=2.0 Lsize=   11394kB time=00:01:01.36 bitrate=1521.2kbits/s dup=25 drop=0
video:10370kB audio:946kB subtitle:0 global headers:0kB muxing overhead 0.683155%
$ ffmpeg -i out.mpg
ffmpeg version N-49059-gbc15fcb Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 20 2013 18:01:12 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 15.100 / 52. 15.100
  libavcodec     54. 89.100 / 54. 89.100
  libavformat    54. 61.101 / 54. 61.101
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.101 /  3. 32.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpeg @ 0x1e83460] max_analyze_duration 5000000 reached at 5000000 microseconds
Input #0, mpeg, from 'out.mpg':
  Duration: 00:01:01.33, start: 0.529978, bitrate: 1521 kb/s
    Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p, 720x576 [SAR 64:45 DAR 16:9], 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc
    Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 128 kb/s
At least one output file must be specified

Since mplayer -demuxer lavf -sid 2 shows no subtitles (-sid 1 works fine), this may be a demuxer issue.

Change History (18)

comment:2 by Cigaes, 11 years ago

mplayer -demuxer lavf shows a lot of video artifacts too, while mplayer -demuxer mpegts does not, so there is definitely something fishy with the demuxer.

comment:3 by Carl Eugen Hoyos, 11 years ago

I see the same artefacts at 74538 with mplayer -demuxer mpegts and mplayer -demuxer lavf - which other artefacts do you see?

comment:4 by Cigaes, 11 years ago

With -demuxer lavf, I see nothing but artifacts. The first line of macroblocks keeps blinking, and that is only the least of them. All parts with motion are blured as if error concealment happens. I am surprised you do not see them.

comment:5 by Carl Eugen Hoyos, 11 years ago

No additional artefacts here with -demuxer lavf (you are not on vdpau, are you?)

comment:6 by Cigaes, 11 years ago

I was about to ask the same question; no, pure [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2), and I get a lot of artifacts. If I add the following line in vd_ffmpeg.c after the call to avcodec_decode_video2:

printf("decode packet size %d/%d\n", ret, pkt.size);

I get very different results depending on whether I use -demuxer lavf or -demuxer mpegts: 4553/4553, 4185/4185, 14116/14116, vs. 38035/38035, 2345/2345, 33803/33803, etc.

OTOH, the video decodes fines with avplay, so maybe this is a problem in MPlayer's use of the demuxer and here would not be the place to talk about it, but this whole thing is highly confusing.

comment:7 by Carl Eugen Hoyos, 11 years ago

Still works fine here with mplayer -demuxer lavf - could you confirm which MPlayer version you are using and that you are calling it with "-noconfig all"?

comment:8 by Cigaes, 11 years ago

It is a fresh build of the SVN head + ffmpeg Git head. But I forgot the -noconfig all, I do not have anything in it that usually causes problems. But in this particular case -vf pp=hb:c/vb:c seems to be getting completely mad.

This is one problem solved, although I am still curious about the different packet sizes between the demuxers.

comment:9 by Carl Eugen Hoyos, 11 years ago

I should add that the artefact at 74538 that can be seen with -vc mpeg12 and -vc ffmpeg12 is not visible with vdpau although the hardware decoder usually is bad with error concealment, so there might still be something interesting about the sample.

comment:10 by Anshul, 10 years ago

I tested using gdb ffplay and wireshark.

and I find that page_id is equal to 1 of stream 6 and ancilary id = 0 and Composition ID is 0 for stream 6. so we never decode any segment in dvbsub decoder.

following is wireshark log for same file

Stream PID=0x0096

Stream type: ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data (0x06)

  1. .... .... .... = Reserved: 0x0007 ...0 0000 1001 0110 = Elementary PID: 0x0096 1111 .... .... .... = Reserved: 0x000f .... 0000 0000 1010 = ES Info Length: 0x000a Descriptor Tag=0x59

Descriptor Tag: Subtitling Descriptor (0x59)
Descriptor Length: 8
Language Code: fra
Subtitling Type: DVB subtitles (for the hard of hearing) with no monitor aspect ratio criticality (0x20)
Composition Page ID: 1
Ancillary Page ID: 0

Stream PID=0x0097

Stream type: ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES packets containing private data (0x06)

  1. .... .... .... = Reserved: 0x0007 ...0 0000 1001 0111 = Elementary PID: 0x0097 1111 .... .... .... = Reserved: 0x000f .... 0000 0000 1010 = ES Info Length: 0x000a Descriptor Tag=0x59

Descriptor Tag: Subtitling Descriptor (0x59)
Descriptor Length: 8
Language Code: eng
Subtitling Type: DVB subtitles (normal) with no monitor aspect ratio criticality (0x10)
Composition Page ID: 0
Ancillary Page ID: 0

my last git log 6d2df3c00a7899e9c06e3a460d64e4d0ccde0fae
following is br guide how i tested the value in ffplay(decoding)
(gdb) info br
Num Type Disp Enb Address What
1 breakpoint keep y 0x0831f95b in dvbsub_decode at libavcodec/dvbsubdec.c:1531

breakpoint already hit 244 times
silent
if (page_id == 1) && (ctx->composition_id == 0) && (ctx->ancillary_id == 0)

c

end

following is from dvbsub spec
page_id: The page_id identifies the subtitle service of the data contained in this subtitling_segment. Segments with a
page_id value signalled in the subtitling descriptor as the composition page id, carry subtitling data specific for one
subtitle service. Accordingly, segments with the page_id signalled in the subtitling descriptor as the ancillary page id,
carry data that may be shared by multiple subtitle services.

IMO If any sane player is able to show the second video, then only we should think it as defect.

This 0x6 can be extracted if we ignore page_id.
or Composition Page ID = 0 and Ancillary Page ID = 0 have special meaning (i did not found anything but i may have missed it in spec).

I have not tested with mplayer or vlc , please pardon me but i really did not find it worth since both of them were using ffmpeg.
As you said in discription it works in stream 5, it should since page_id match with composition ID.

comment:11 by Anshul, 10 years ago

Analyzed by developer: set
Owner: set to Anshul
Status: newopen

comment:12 by Carl Eugen Hoyos, 10 years ago

I am not sure I understand everything you wrote: Did you understand that MPlayer is able to show two different subtitle streams while FFmpeg only shows one?

comment:13 by Anshul, 10 years ago

but I see ffmpeg show two dvbsub stream(above logs) but able to reencode only one of them.
in both log ffmpeg show 2( mentalist-1min-singleprogram.ts) or none(output).
is there some missing logs?

comment:14 by Carl Eugen Hoyos, 10 years ago

I meant that MPlayer displays two different subtitles.

comment:15 by Michael Niedermayer, 9 years ago

Resolution: fixed
Status: openclosed

comment:16 by Carl Eugen Hoyos, 9 years ago

Cc: Michael Niedermayer added
Component: undeterminedavcodec
Resolution: fixed
Status: closedreopened

The given sample works fine with -dvb_substream -1 (the default), but both -dvb_substream 0 and -dvb_substream 1 fail (differently), I believe one of them is supposed to work.

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

Replying to cehoyos:

The given sample works fine with -dvb_substream -1 (the default), but both -dvb_substream 0 and -dvb_substream 1 fail (differently), I believe one of them is supposed to work.

Please explain what you expect and why
the descriptors refer to a page id of 0 the stream contains a page id of 1. I failed to find any special case for 0, so displaying nothing when a substream is selected seems "correct"

comment:18 by Carl Eugen Hoyos, 9 years ago

Resolution: fixed
Status: reopenedclosed

Thank you for the explanation!

Note: See TracTickets for help on using tickets.