Opened 2 years ago

Last modified 2 years ago

#9862 new defect

Can't render subtitles on a transparent video

Reported by: fduck Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: subtitles
Cc: fduck Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by fduck)

Rendering subtitles on a transparent video track (with the alpha option set to 1) results in subtitles that don't disappear when they should. Later subtitles are drawn right over earlier.

ffmpeg -y\
 -ss 0 -t 15 -i 'video.mov'\
 -filter_complex "
nullsrc=size=1080x1080 [subtitles];
[subtitles] subtitles=subtitles.srt:alpha=1 [subtitles];
[0][subtitles] overlay=x=0:y=0:shortest=1 [out]
"\
 -map [out] \
 'test.mp4'

ffmpeg version 5.1
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)

Complete, uncut console output (requested by Carl Eugen Hoyos):

Mac:Test user$ ffmpeg -y\
 -ss 0 -t 15 -i 'video.mov'\
 -filter_complex "
nullsrc=size=1080x1080 [subtitles];
[subtitles] subtitles=subtitles.srt:alpha=1 [subtitles];
[0][subtitles] overlay=x=0:y=0:shortest=1 [out]
"\
 -map [out] \
 'test.mp4'
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2022-09-01T19:58:57.000000Z
    encoder         : Lavf59.27.100
  Duration: 00:01:10.47, start: 0.000000, bitrate: 10966 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2022-09-01T19:58:57.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 10857 kb/s, 29.97 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      creation_time   : 2022-09-01T19:58:57.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 libx264
[Parsed_subtitles_1 @ 0x7fca67707340] libass API version: 0x1600000
[Parsed_subtitles_1 @ 0x7fca67707340] libass source: tarball: 0.16.0
[Parsed_subtitles_1 @ 0x7fca67707340] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 5.1.0 (COMPLEX)
[Parsed_subtitles_1 @ 0x7fca67707340] Using font provider coretext
Stream mapping:
  Stream #0:1 (h264) -> overlay
  overlay:default -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[Parsed_subtitles_1 @ 0x7fca68207ac0] libass API version: 0x1600000
[Parsed_subtitles_1 @ 0x7fca68207ac0] libass source: tarball: 0.16.0
[Parsed_subtitles_1 @ 0x7fca68207ac0] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 5.1.0 (COMPLEX)
[Parsed_subtitles_1 @ 0x7fca68207ac0] Using font provider coretext
[libx264 @ 0x7fca67708500] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fca67708500] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x7fca67708500] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - 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=24 lookahead_threads=4 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, mp4, to 'test.mp4':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    encoder         : Lavf59.27.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, q=2-31, 30 fps, 15360 tbn
    Metadata:
      encoder         : Lavc59.37.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[Parsed_subtitles_1 @ 0x7fca68207ac0] fontselect: (Arial, 400, 0) -> /System/Library/Fonts/Supplemental/Arial.ttf, -1, ArialMT
frame=  450 fps= 55 q=-1.0 Lsize=   17855kB time=00:00:14.90 bitrate=9816.5kbits/s speed=1.82x     
video:17848kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.035537%
[libx264 @ 0x7fca67708500] frame I:2     Avg QP:22.12  size:178054
[libx264 @ 0x7fca67708500] frame P:113   Avg QP:23.74  size: 72507
[libx264 @ 0x7fca67708500] frame B:335   Avg QP:26.59  size: 29035
[libx264 @ 0x7fca67708500] consecutive B-frames:  0.7%  0.0%  0.7% 98.7%
[libx264 @ 0x7fca67708500] mb I  I16..4: 11.4% 74.7% 14.0%
[libx264 @ 0x7fca67708500] mb P  I16..4:  1.1% 14.5%  0.6%  P16..4: 40.9% 17.0%  9.0%  0.0%  0.0%    skip:16.9%
[libx264 @ 0x7fca67708500] mb B  I16..4:  0.1%  3.3%  0.0%  B16..8: 38.6%  5.3%  1.4%  direct: 3.8%  skip:47.5%  L0:44.6% L1:47.2% BI: 8.2%
[libx264 @ 0x7fca67708500] 8x8 transform intra:91.5% inter:78.0%
[libx264 @ 0x7fca67708500] coded y,uvDC,uvAC intra: 85.8% 54.2% 6.3% inter: 23.5% 20.6% 0.2%
[libx264 @ 0x7fca67708500] i16 v,h,dc,p: 15% 52% 11% 21%
[libx264 @ 0x7fca67708500] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12%  9% 41%  6%  7%  6%  6%  6%  7%
[libx264 @ 0x7fca67708500] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 14% 17%  6%  9%  8%  8%  6%  6%
[libx264 @ 0x7fca67708500] i8c dc,h,v,p: 66% 18% 14%  2%
[libx264 @ 0x7fca67708500] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fca67708500] ref P L0: 45.7% 12.7% 29.6% 12.1%
[libx264 @ 0x7fca67708500] ref B L0: 78.2% 16.4%  5.3%
[libx264 @ 0x7fca67708500] ref B L1: 93.0%  7.0%
[libx264 @ 0x7fca67708500] kb/s:9747.27

Attachments (1)

subtitles.srt (197 bytes ) - added by fduck 2 years ago.
Convenient sample subtitles

Download all attachments as: .zip

Change History (4)

by fduck, 2 years ago

Attachment: subtitles.srt added

Convenient sample subtitles

comment:1 by Carl Eugen Hoyos, 2 years ago

Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:2 by fduck, 2 years ago

Description: modified (diff)

Added complete, uncut console output as requested by Carl Eugen Hoyos. Command line I tested was already in the ticket.

comment:3 by fduck, 2 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.