Opened 4 months ago

Closed 4 months ago

#6605 closed defect (fixed)

Drawing subtitles on transparent video creates empty output

Reported by: slhck Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: subtitles
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Trying to render subtitles on a transparent video background produces an empty, transparent PNG with no subtitles:

$ cat subs.srt
1
00:00:00,000 --> 00:00:02,000
<i>Test</i>
$ ffmpeg -f lavfi -i "color=color=white@0.0:size=100x100,format=rgba,subtitles=subs.srt" -frames:v 1 out.png
ffmpeg version N-87010-g3c99523-tessus Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzvbi --enable-version3 --disable-ffplay --disable-indev=qtkit
  libavutil      55. 74.100 / 55. 74.100
  libavcodec     57.102.100 / 57.102.100
  libavformat    57. 76.100 / 57. 76.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 99.100 /  6. 99.100
  libswscale      4.  7.102 /  4.  7.102
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[Parsed_subtitles_2 @ 0x7fd134d00740] Shaper: FriBidi 0.19.2 (SIMPLE)
[Parsed_subtitles_2 @ 0x7fd134d00740] Using font provider coretext
[Parsed_subtitles_2 @ 0x7fd134d00740] fontselect: (Arial, 400, 0) -> /Library/Fonts/Arial.ttf, -1, ArialMT
[Parsed_subtitles_2 @ 0x7fd134d00740] fontselect: (Arial, 400, 100) -> /Library/Fonts/Arial Italic.ttf, -1, Arial-ItalicMT
Input #0, lavfi, from 'color=color=white@0.0:size=100x100,format=rgba,subtitles=subs.srt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGBA / 0x41424752), rgba, 100x100 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
File 'out.png' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'out.png':
  Metadata:
    encoder         : Lavf57.76.100
    Stream #0:0: Video: png, rgba, 100x100 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.102.100 png
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=9.16x
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

When using yuv420p in the color filter, the output looks as expected (just with opaque background).

This is somewhat related to #3302

Change History (1)

comment:1 Changed 4 months ago by richardpl

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in f19e4118e9ca392f89d3c264aa8490b7d9ac3284.

Please set option alpha to 1, for enabling writting on alpha channel.

Note: See TracTickets for help on using tickets.