[FFmpeg-user] how to control quality of subtitles

Francois Visagie francois.visagie at gmail.com
Mon May 25 17:42:22 EEST 2020


> -----Original Message-----
> From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of
> Peter Münster
> Sent: 25 May 2020 13:43
> To: ffmpeg-user at ffmpeg.org
> Subject: Re: [FFmpeg-user] how to control quality of subtitles
> 
> On Mon, May 25 2020, Moritz Barsnick wrote:
> 
> > Please try to build from latest git master,
> 
> Unfortunately it does not help. VLC still displays the subtitles with yellow
> letters and black outlines and the Samsung TV with ugly white.
> I've tried now also with mplayer: nice subtitles in white with black outlines.

Part of the problem seems to be controlling the palette to be used for rendering - you're getting three different results on three different players.

As an (ugly) work-around, have you looked for a subtitle palette setting on your TV where the problem seems to be most annoying?

And/or, if subtitles from other material display acceptably on your TV you could also compare palettes with those and work from there.

> Here is the output of my test:
> 
> --8<---------------cut here---------------start------------->8---
> peter at ws:/tmp/ffmpeg-tests> ~/tmp/FFmpeg/ffmpeg -y -i orig-dvbsub.ts -
> map 0:0 -map 0:1 -map 0:2 -c:v libx264 -c:a copy -c:s dvdsub -palette
> "0d00ee,ee450d,101010,eaeaea,0ce60b,ec14ed,ebff0b,0d617a,7b7b7b,d1d1
> d1,7b2a0e,0d950c,0f007b,cf0dec,cfa80c,7c127b" dvbsub2dvdsub.mkv ffmpeg
> version N-97937-g82bf41f3ab Copyright (c) 2000-2020 the FFmpeg
> developers
>   built with gcc 7 (SUSE Linux)
>   configuration: --enable-gpl --enable-libx264
>   libavutil      56. 49.100 / 56. 49.100
>   libavcodec     58. 87.101 / 58. 87.101
>   libavformat    58. 43.100 / 58. 43.100
>   libavdevice    58.  9.103 / 58.  9.103
>   libavfilter     7. 83.100 /  7. 83.100
>   libswscale      5.  6.101 /  5.  6.101
>   libswresample   3.  6.100 /  3.  6.100
>   libpostproc    55.  6.100 / 55.  6.100
> [mpegts @ 0x298c840] PES packet size mismatch [mpegts @ 0x298c840]
> Packet corrupt (stream = 2, dts = NOPTS).
> Input #0, mpegts, from 'orig-dvbsub.ts':
>   Duration: 00:00:46.24, start: 3496.892811, bitrate: 3882 kb/s
>   Program 132
>     Stream #0:0[0xa6]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
> yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn,
> 50 tbc
>     Side data:
>       cpb: bitrate max/min/avg: 8000000/0/0 buffer size: 1835008 vbv_delay:
> N/A
>     Stream #0:1[0x80](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz,
> stereo, fltp, 192 kb/s
>     Stream #0:2[0x4b](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
> (hearing impaired)
>     Stream #0:3[0x44]: Data: bin_data ([6][0][0][0] / 0x0006) Stream mapping:
>   Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
>   Stream #0:1 -> #0:1 (copy)
>   Stream #0:2 -> #0:2 (dvb_subtitle (dvbsub) -> dvd_subtitle (dvdsub)) Press
> [q] to stop, [?] for help
> [libx264 @ 0x2ab9040] using SAR=64/45
> [libx264 @ 0x2ab9040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
> AVX FMA3 BMI2 AVX2
> [libx264 @ 0x2ab9040] profile High, level 3.0, 4:2:0, 8-bit
> [libx264 @ 0x2ab9040] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft
> 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3
> deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
> mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0
> deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18
> lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0
> bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
> b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
> keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
> mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
> aq=1:1.00 Output #0, matroska, to 'dvbsub2dvdsub.mkv':
>   Metadata:
>     encoder         : Lavf58.43.100
>     Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 720x576
> [SAR 64:45 DAR 16:9], q=-1--1, 25 fps, 1k tbn, 25 tbc
>     Metadata:
>       encoder         : Lavc58.87.101 libx264
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
>     Stream #0:1(deu): Audio: mp2 (P[0][0][0] / 0x0050), 48000 Hz, stereo, fltp,
> 192 kb/s
>     Stream #0:2(deu): Subtitle: dvd_subtitle (dvdsub) ([255][255][255][255] /
> 0xFFFFFFFF) (hearing impaired)
>     Metadata:
>       encoder         : Lavc58.87.101 dvdsub
> [mpegts @ 0x298c840] Packet corrupt (stream = 0, dts = 315404353).e=
> 318.3kbits/s speed=13.2x
> [mpeg2video @ 0x2a96380] ac-tex damaged at 33 14 [mpeg2video @
> 0x2a96380] Warning MVs not available [mpeg2video @ 0x2a96380]
> concealing 765 DC, 765 AC, 765 MV errors in B frame
> orig-dvbsub.ts: corrupt decoded frame in stream 0 [mpegts @ 0x298c840]
> PES packet size mismatch [mpegts @ 0x298c840] Packet corrupt (stream = 1,
> dts = 315373878).
> [mpegts @ 0x298c840] PES packet size mismatch [mpegts @ 0x298c840]
> Packet corrupt (stream = 1, dts = 315460278).
> [mpegts @ 0x298c840] Packet corrupt (stream = 0, dts = 315490753).
> [mpeg2video @ 0x2a96380] ac-tex damaged at 6 22 [mpeg2video @
> 0x2a96380] Warning MVs not available [mpeg2video @ 0x2a96380]
> concealing 360 DC, 360 AC, 360 MV errors in B frame
> orig-dvbsub.ts: corrupt decoded frame in stream 0 [mpegts @ 0x298c840]
> PES packet size mismatch [mpegts @ 0x298c840] Packet corrupt (stream = 1,
> dts = 315641718).
> [mpegts @ 0x298c840] Packet corrupt (stream = 0, dts = 315670753).
> [mpeg2video @ 0x2a96380] skipped MB in I-frame at 5 16 [mpeg2video @
> 0x2a96380] Warning MVs not available [mpeg2video @ 0x2a96380]
> concealing 180 DC, 180 AC, 180 MV errors in I frame
> orig-dvbsub.ts: corrupt decoded frame in stream 0 [mpegts @ 0x298c840]
> Packet corrupt (stream = 0, dts = 315843553).
> [mpegts @ 0x298c840] PES packet size mismatch [mpegts @ 0x298c840]
> Packet corrupt (stream = 1, dts = 315823158).
> [mpeg2video @ 0x2a96380] ac-tex damaged at 31 29 [mpeg2video @
> 0x2a96380] 00 motion_type at 2 14 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 5 15 [mpeg2video @ 0x2a96380] ac-tex damaged at 8 16
> [mpeg2video @ 0x2a96380] ac-tex damaged at 19 32 [mpeg2video @
> 0x2a96380] ac-tex damaged at 8 17 [mpeg2video @ 0x2a96380] slice
> mismatch [mpeg2video @ 0x2a96380] 00 motion_type at 22 33 [mpeg2video
> @ 0x2a96380] 00 motion_type at 15 19 [mpeg2video @ 0x2a96380] 00
> motion_type at 5 20 [mpeg2video @ 0x2a96380] 00 motion_type at 5 21
> [mpeg2video @ 0x2a96380] ac-tex damaged at 4 22 [mpeg2video @
> 0x2a96380] Invalid mb type in P-frame at 12 23 [mpeg2video @ 0x2a96380] 00
> motion_type at 9 24 [mpeg2video @ 0x2a96380] 00 motion_type at 28 25
> [mpeg2video @ 0x2a96380] 00 motion_type at 1 26 [mpeg2video @
> 0x2a96380] 00 motion_type at 9 34 [mpeg2video @ 0x2a96380] 00
> motion_type at 16 27 [mpeg2video @ 0x2a96380] 00 motion_type at 31 35
> [mpeg2video @ 0x2a96380] 00 motion_type at 35 28 [mpeg2video @
> 0x2a96380] 00 motion_type at 4 29 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 35 30 [mpeg2video @ 0x2a96380] ac-tex damaged at 17 31
> [mpeg2video @ 0x2a96380] Warning MVs not available [mpeg2video @
> 0x2a96380] concealing 990 DC, 990 AC, 990 MV errors in P frame
> orig-dvbsub.ts: corrupt decoded frame in stream 0
> [mpegts @ 0x298c840] PES packet size mismatchme=00:00:12.92 bitrate=
> 649.0kbits/s speed=12.9x
> [mpegts @ 0x298c840] Packet corrupt (stream = 1, dts = 315909558).
> [mpegts @ 0x298c840] Packet corrupt (stream = 0, dts = 315951553).
> [mpeg2video @ 0x2a96380] skipped MB in I-frame at 13 13 [mpeg2video @
> 0x2a96380] Warning MVs not available [mpeg2video @ 0x2a96380]
> concealing 360 DC, 360 AC, 360 MV errors in I frame
> orig-dvbsub.ts: corrupt decoded frame in stream 0 [mpegts @ 0x298c840]
> PES packet size mismatch [mpegts @ 0x298c840] Packet corrupt (stream = 1,
> dts = 316090998).
> [mpegts @ 0x298c840] Packet corrupt (stream = 0, dts = 316124353).
> [mpeg2video @ 0x2a96380] 00 motion_type at 3 23 [mpeg2video @
> 0x2a96380] 00 motion_type at 7 29 [mpeg2video @ 0x2a96380] 00
> motion_type at 8 27 [mpeg2video @ 0x2a96380] ac-tex damaged at 18 25
> [mpeg2video @ 0x2a96380] 00 motion_type at 6 34 [mpeg2video @
> 0x2a96380] ac-tex damaged at 2 35 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 32 22 [mpeg2video @ 0x2a96380] 00 motion_type at 7 24
> [mpeg2video @ 0x2a96380] 00 motion_type at 1 32 [mpeg2video @
> 0x2a96380] Invalid mb type in P-frame at 7 8 [mpeg2video @ 0x2a96380] slice
> mismatch [mpeg2video @ 0x2a96380] 00 motion_type at 1 28 [mpeg2video
> @ 0x2a96380] 00 motion_type at 12 31 [mpeg2video @ 0x2a96380] 00
> motion_type at 34 33 [mpeg2video @ 0x2a96380] ac-tex damaged at 8 8
> [mpeg2video @ 0x2a96380] 00 motion_type at 10 26 [mpeg2video @
> 0x2a96380] 00 motion_type at 10 9 [mpeg2video @ 0x2a96380] 00
> motion_type at 1 10 [mpeg2video @ 0x2a96380] 00 motion_type at 1 11
> [mpeg2video @ 0x2a96380] 00 motion_type at 9 12 [mpeg2video @
> 0x2a96380] 00 motion_type at 8 13 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 2 14 [mpeg2video @ 0x2a96380] ac-tex damaged at 4 15
> [mpeg2video @ 0x2a96380] 00 motion_type at 27 16 [mpeg2video @
> 0x2a96380] 00 motion_type at 34 17 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 1 18 [mpeg2video @ 0x2a96380] ac-tex damaged at 18 19
> [mpeg2video @ 0x2a96380] 00 motion_type at 7 20 [mpeg2video @
> 0x2a96380] 00 motion_type at 2 21 [mpeg2video @ 0x2a96380] 00
> motion_type at 4 22 [mpeg2video @ 0x2a96380] Warning MVs not available
> [mpeg2video @ 0x2a96380] concealing 1305 DC, 1305 AC, 1305 MV errors in P
> frame
> orig-dvbsub.ts: corrupt decoded frame in stream 0 [mpeg2video @
> 0x2a96380] skipped MB in I-frame at 1 32 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 0 33 [mpeg2video @ 0x2a96380] ac-tex damaged at 0 34
> [mpeg2video @ 0x2a96380] ac-tex damaged at 0 35 [mpeg2video @
> 0x2a96380] ac-tex damaged at 41 31 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 0 15 [mpeg2video @ 0x2a96380] ac-tex damaged at 0 16
> [mpeg2video @ 0x2a96380] ac-tex damaged at 0 17 [mpeg2video @
> 0x2a96380] ac-tex damaged at 0 18 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 0 19 [mpeg2video @ 0x2a96380] ac-tex damaged at 0 20
> [mpeg2video @ 0x2a96380] ac-tex damaged at 0 21 [mpeg2video @
> 0x2a96380] ac-tex damaged at 0 22 [mpeg2video @ 0x2a96380] ac-tex
> damaged at 0 23 [mpeg2video @ 0x2a96380] ac-tex damaged at 1 24
> [mpeg2video @ 0x2a96380] Invalid mb type in I-frame at 0 25 [mpeg2video @
> 0x2a96380] Invalid mb type in I-frame at 0 26 [mpeg2video @ 0x2a96380]
> skipped MB in I-frame at 1 27 [mpeg2video @ 0x2a96380] ac-tex damaged at
> 0 28 [mpeg2video @ 0x2a96380] ac-tex damaged at 0 29 [mpeg2video @
> 0x2a96380] ac-tex damaged at 0 30 [mpeg2video @ 0x2a96380] skipped MB
> in I-frame at 1 31 [mpeg2video @ 0x2a96380] Warning MVs not available
> [mpeg2video @ 0x2a96380] concealing 945 DC, 945 AC, 945 MV errors in I
> frame [mpegts @ 0x298c840] PES packet size mismatch [mpegts @
> 0x298c840] Packet corrupt (stream = 1, dts = 316186038).
> orig-dvbsub.ts: corrupt decoded frame in stream 0 [mpegts @ 0x298c840]
> PES packet size mismatch [mpegts @ 0x298c840] Packet corrupt (stream = 1,
> dts = 316272438).
> [mpegts @ 0x298c840] Packet corrupt (stream = 0, dts = 316307953).
> [mpegts @ 0x298c840] PES packet size mismatch [mpegts @ 0x298c840]
> Packet corrupt (stream = 2, dts = 316064783).
> [NULL @ 0x2994f40] Junk in packet
> [dvbsub @ 0x29b1080] Invalid object location! 210-720 44-44 11 [dvbsub @
> 0x29b1080] Unknown/unsupported pixel block 0x88 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x72 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x0 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0xf [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x13 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x0 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x1 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x7 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0xdc [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x0 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x3 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x40 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x3 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0xe9 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0x3 [dvbsub @ 0x29b1080]
> Unknown/unsupported pixel block 0xeb [dvbsub @ 0x29b1080] Invalid
> object location! 210-720 45-44 11
> [mpegts @ 0x298c840] PES packet size mismatchme=00:00:43.64 bitrate=
> 816.9kbits/s speed=14.5x
> [mpegts @ 0x298c840] Packet corrupt (stream = 2, dts = 318937583).
> frame= 1153 fps=349 q=-1.0 Lsize=    5053kB time=00:00:46.21 bitrate=
> 895.7kbits/s speed=  14x
> video:3912kB audio:1079kB subtitle:39kB other streams:0kB global
> headers:0kB muxing overhead: 0.458955%
> [libx264 @ 0x2ab9040] frame I:13    Avg QP:17.93  size: 26035
> [libx264 @ 0x2ab9040] frame P:331   Avg QP:20.85  size:  6893
> [libx264 @ 0x2ab9040] frame B:809   Avg QP:23.28  size:  1712
> [libx264 @ 0x2ab9040] consecutive B-frames:  1.7%  4.3% 29.4% 64.5%
> [libx264 @ 0x2ab9040] mb I  I16..4: 14.4% 77.0%  8.7%
> [libx264 @ 0x2ab9040] mb P  I16..4:  4.3% 12.4%  0.5%  P16..4: 34.2% 10.8%
> 7.0%  0.0%  0.0%    skip:30.8%
> [libx264 @ 0x2ab9040] mb B  I16..4:  0.4%  1.0%  0.0%  B16..8: 31.8%  3.2%
> 0.5%  direct: 3.7%  skip:59.4%  L0:42.7% L1:48.8% BI: 8.5%
> [libx264 @ 0x2ab9040] 8x8 transform intra:72.8% inter:85.8%
> [libx264 @ 0x2ab9040] coded y,uvDC,uvAC intra: 35.9% 37.8% 11.3% inter:
> 8.9% 14.9% 0.2%
> [libx264 @ 0x2ab9040] i16 v,h,dc,p: 35% 36%  9% 20%
> [libx264 @ 0x2ab9040] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 43%  1%  1%  3%
> 1%  3%  2%
> [libx264 @ 0x2ab9040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 16% 12%  5%  6% 10%
> 4%  9%  3%
> [libx264 @ 0x2ab9040] i8c dc,h,v,p: 49% 24% 24%  3%
> [libx264 @ 0x2ab9040] Weighted P-Frames: Y:0.0% UV:0.0%
> [libx264 @ 0x2ab9040] ref P L0: 57.6% 11.5% 22.1%  8.8%
> [libx264 @ 0x2ab9040] ref B L0: 81.7% 14.9%  3.3%
> [libx264 @ 0x2ab9040] ref B L1: 95.2%  4.8%
> [libx264 @ 0x2ab9040] kb/s:692.93
> --8<---------------cut here---------------end--------------->8---
> 
> 
> > You input seems to have some corruption (which should have nothing to
> > do with your issue).
> 
> Yes, the reception of the TV-channel was not very good...
> 
> 
> > Have you tried keeping the subs as dvbsubs (instead of dvd)?
> 
> Yes.
> 
> 
> > Does your TV render them then?
> 
> Unfortunately not.
> 
> 
> Thanks for your help. Cheers,
> --
>            Peter
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email ffmpeg-user-request at ffmpeg.org
> with subject "unsubscribe".



More information about the ffmpeg-user mailing list