Opened 3 years ago

Closed 3 years ago

#5354 closed defect (fixed)

Concat filter breaks alpha overlay

Reported by: d-fens_ Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: overlay
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

generating a alpha overlay over video works.
using the concat filter to concat breaks the overlay, "gradient" like effects , like color reduced are the result

attached two test files

How to reproduce:

ffmpeg  -i "overlay.png" -i "in.mp4" -filter_complex " [1:v] setsar=sar=1/1 [sared];  [sared][0:v] overlay [overlay];[1:v][overlay] concat=n=2" -y out.mp4

corrupts

ffmpeg  -i "overlay.png" -i "in.mp4" -filter_complex " [1:v] setsar=sar=1/1 [sared];  [sared][0:v] overlay " -y out.mp4

works

ffmpeg version
ffmpeg version N-78395-g6973846 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --
enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-lib
x265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-d
ecklink --enable-zlib
  libavutil      55. 17.100 / 55. 17.100
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (2)

in.mp4 (279.1 KB) - added by d-fens_ 3 years ago.
overlay.png (1.6 MB) - added by d-fens_ 3 years ago.

Download all attachments as: .zip

Change History (11)

Changed 3 years ago by d-fens_

Changed 3 years ago by d-fens_

comment:1 Changed 3 years ago by cehoyos

Please test current FFmpeg git head and please provide the command line that allows to reproduce the issue together with the complete, uncut console output to make this a valid ticket.

comment:2 Changed 3 years ago by d-fens_

Hi,

git of three days ago, hope thats recent enough:


ffmpeg version N-79075-ga7b8a6e Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avis
ynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable
-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --en
able-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-lib
ilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencor
e-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enabl
e-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-
libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-lib
vo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libw
ebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable
-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil      55. 19.100 / 55. 19.100
libavcodec     57. 28.103 / 57. 28.103
libavformat    57. 28.102 / 57. 28.102
libavdevice    57.  0.101 / 57.  0.101
libavfilter     6. 39.102 /  6. 39.102
libswscale      4.  0.100 /  4.  0.100
libswresample   2.  0.101 /  2.  0.101
libpostproc    54.  0.100 / 54.  0.100

For help run: ffmpeg -h
For formats run: ffmpeg -formats | more
For codecs run: ffmpeg -codecs | more

Current directory is now: "C:\Users\dummy\Downloads\ffmpeg-20160318-git-a7b8a6e-
win64-static\ffmpeg-20160318-git-a7b8a6e-win64-static\bin"
The bin directory has been added to PATH

C:\Users\dummy\Downloads\ffmpeg-20160318-git-a7b8a6e-win64-static\ffmpeg-2016031
8-git-a7b8a6e-win64-static\bin
>ffmpeg  -i "overlay.png" -i "in.mp4" -filter_complex " [1:v] setsar=sar=1/1 [sa
red];  [sared][0:v] overlay [overlay];[1:v][overlay] concat=n=2" -y out.mp4
ffmpeg version N-79075-ga7b8a6e Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enabl
e-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-l
ibvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-li
bwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enab
le-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.103 / 57. 28.103
  libavformat    57. 28.102 / 57. 28.102
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from 'overlay.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgba(pc), 1920x1080 [SAR 7087:7087 DAR 16:9], 25 tb
r, 25 tbn, 25 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.25.100
  Duration: 00:00:01.02, start: 0.021333, bitrate: 2236 kb/s
    Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920
x1080, 2138 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[swscaler @ 0000000002820020] deprecated pixel format used, make sure you did se
t range correctly
[swscaler @ 0000000002670fe0] deprecated pixel format used, make sure you did se
t range correctly
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 000000000052e4c0] using SAR=1/1
[libx264 @ 000000000052e4c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX
[libx264 @ 000000000052e4c0] profile High, level 4.0
[libx264 @ 000000000052e4c0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=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_pski
p=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 deci
mate=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=2
5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf57.28.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 1
920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc57.28.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo
, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.28.103 aac
Stream mapping:
  Stream #0:0 (png) -> overlay:overlay (graph 0)
  Stream #1:0 (h264) -> setsar (graph 0)
  Stream #1:0 (h264) -> concat:in0:v0 (graph 0)
  concat (graph 0) -> Stream #0:0 (libx264)
  Stream #1:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame=   30 fps=0.0 q=0.0 size=       0kB time=00:00:00.98 bitrate=   0.4kbits/s
frame=   42 fps= 41 q=0.0 size=       0kB time=00:00:00.98 bitrate=   0.4kbits/s
frame=   50 fps= 32 q=0.0 size=       0kB time=00:00:00.98 bitrate=   0.4kbits/s
frame=   51 fps= 13 q=-1.0 Lsize=     498kB time=00:00:01.96 bitrate=2081.0kbits
/s dup=1 drop=0 speed=0.517x
video:479kB audio:16kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 0.483463%
[libx264 @ 000000000052e4c0] frame I:2     Avg QP:14.00  size: 88182
[libx264 @ 000000000052e4c0] frame P:19    Avg QP:18.72  size: 12399
[libx264 @ 000000000052e4c0] frame B:30    Avg QP:19.72  size:  2609
[libx264 @ 000000000052e4c0] consecutive B-frames: 13.7% 19.6% 11.8% 54.9%
[libx264 @ 000000000052e4c0] mb I  I16..4: 22.3% 72.0%  5.7%
[libx264 @ 000000000052e4c0] mb P  I16..4:  2.3% 12.9%  0.2%  P16..4: 15.5%  3.8
%  1.8%  0.0%  0.0%    skip:63.4%
[libx264 @ 000000000052e4c0] mb B  I16..4:  0.3%  1.0%  0.0%  B16..8: 10.2%  0.6
%  0.0%  direct: 3.0%  skip:84.8%  L0:55.8% L1:42.3% BI: 1.8%
[libx264 @ 000000000052e4c0] 8x8 transform intra:78.7% inter:87.3%
[libx264 @ 000000000052e4c0] coded y,uvDC,uvAC intra: 21.0% 31.3% 10.2% inter: 3
.1% 6.6% 0.1%
[libx264 @ 000000000052e4c0] i16 v,h,dc,p: 61% 19% 10%  9%
[libx264 @ 000000000052e4c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 12% 47%  1%  2%
 2%  2%  2%  1%
[libx264 @ 000000000052e4c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 12% 11%  5%  9%
11%  6%  6%  3%
[libx264 @ 000000000052e4c0] i8c dc,h,v,p: 73% 11% 13%  3%
[libx264 @ 000000000052e4c0] Weighted P-Frames: Y:5.3% UV:5.3%
[libx264 @ 000000000052e4c0] ref P L0: 69.3% 12.9% 11.6%  5.8%  0.3%
[libx264 @ 000000000052e4c0] ref B L0: 84.2% 14.2%  1.6%
[libx264 @ 000000000052e4c0] ref B L1: 94.7%  5.3%
[libx264 @ 000000000052e4c0] kb/s:1922.36
[aac @ 000000000052f720] Qavg: 16731.248

comment:3 Changed 3 years ago by cehoyos

  • Component changed from undetermined to avfilter
  • Keywords overlay regression added
  • Reproduced by developer set
  • Version changed from unspecified to git-master

Could be considered a regression since 13c62525362595cc914161aaa192953dd9077233 related to ticket #549, work-around is to use overlay,format=yuv420p but I am not sure if there is anything to fix, the filter system is not clairvoyant.

comment:4 follow-up: Changed 3 years ago by d-fens_

is the overlay=format=yuv420 syntax as noted in the docs not valid anymore?

comment:5 in reply to: ↑ 4 Changed 3 years ago by cehoyos

Replying to d-fens_:

is the overlay=format=yuv420 syntax as noted in the docs not valid anymore?

To the best of my knowledge this syntax is valid.

comment:6 Changed 3 years ago by d-fens_

seems also broken:

ffmpeg  -i "overlay.png" -i "in.mp4" -filter_complex " [1:v] setsar=sar=1/1 [sa
red];  [sared][0:v] overlay=format=yuv420p [overlay];[1:v][overlay] concat=n=2"
-y out.mp4
ffmpeg version N-79075-ga7b8a6e Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --ena
ble-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enabl
e-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-l
ibvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-li
bwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enab
le-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.103 / 57. 28.103
  libavformat    57. 28.102 / 57. 28.102
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from 'overlay.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgba(pc), 1920x1080 [SAR 7087:7087 DAR 16:9], 25 tb
r, 25 tbn, 25 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.25.100
  Duration: 00:00:01.02, start: 0.021333, bitrate: 2236 kb/s
    Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920
x1080, 2138 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[overlay @ 00000000005afde0] [Eval @ 000000000032e980] Undefined constant or mis
sing '(' in 'yuv420p'
[overlay @ 00000000005afde0] Unable to parse option value "yuv420p"
[overlay @ 00000000005afde0] [Eval @ 000000000032e9f0] Undefined constant or mis
sing '(' in 'yuv420p'
[overlay @ 00000000005afde0] Unable to parse option value "yuv420p"
[overlay @ 00000000005afde0] Error setting option format to value yuv420p.
[Parsed_overlay_1 @ 00000000005a1840] Error applying options to the filter.
[AVFilterGraph @ 000000000059bb20] Error initializing filter 'overlay' with args
 'format=yuv420p'
Error initializing complex filters.
Invalid argument

is this also a regresion caused by 13c62525362595cc914161aaa192953dd9077233 ?

comment:7 Changed 3 years ago by cehoyos

This is not the syntax mentioned in the documentation and by you in comment:4.
But since yuv420 is the default for your use case, I don't understand what you are trying to show here...

comment:8 Changed 3 years ago by d-fens_

ok my bad, thought concat would also accept yuv420p as a format like the format filter does. the error is because yuv420p is not valid for concat's format param

comment:9 Changed 3 years ago by richardpl

  • Keywords regression removed
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.