Opened 13 years ago
Closed 12 years ago
#549 closed defect (fixed)
Video filter overlay does not preserve alpha
Reported by: | ehsmeng | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | overlay alpha png |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
Hi,
I think there might be a bug in ffmpeg/video filter.
If I have a clip with alpha and apply a filter, the alpha goes away. It used to be preserved until a couple of months ago.
Please find zip with test files attached:
mptpmbp:Desktop ehsmeng$ unzip -t bug.zip
Archive: bug.zip
testing: frameFromWm1.png OK
testing: frameNoWm1.png OK
testing: movie.mov OK
testing: watermark.png OK
testing: withWm.mov OK
testing: withoutWm.mov OK
No errors detected in compressed data of bug.zip.
Thanks,
Marcus
[root@domU-12-31-39-01-90-A1 a]# ffmpeg -i movie.mov -y -vf 'movie=watermark.png,scale=480:270 [wm];[in][wm] overlay=0:0:1 [out]' -acodec copy -s 480x270 -vcodec png withWm.movffmpeg version git-Tue Oct 11 22:16:04 2011 +0200-be5ac96, Copyright (c) 2000-2011 the FFmpeg developers
built on Oct 11 2011 17:25:39 with gcc 4.1.2 20070925 (Red Hat 4.1.2-33)
configuration: --enable-gpl --enable-libmp3lame --enable-shared --enable-nonfree --enable-libx264 --enable-libfaac --disable-mmx --enable-filter=movie --enable-libvpx --enable-pthreads
libavutil 51. 20. 1 / 51. 20. 1
libavcodec 53. 20. 1 / 53. 20. 1
libavformat 53. 15. 0 / 53. 15. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 43. 6 / 2. 43. 6
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.4.0
Duration: 00:00:00.20, start: 0.000000, bitrate: 2920 kb/s
Stream #0:0(eng): Video: png (png / 0x20676E70), bgra, 640x400, 2892 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
[buffer @ 0x627a30] w:640 h:400 pixfmt:bgra tb:1/1000000 sar:0/1 sws_param:
[movie @ 0x63f030] seek_point:0 format_name:(null) file_name:watermark.png stream_index:0
[buffersink @ 0x63e960] auto-inserting filter 'auto-inserted scale 0' between the filter 'Parsed_overlay_2' and the filter 'out'
[scale @ 0x63ea80] w:640 h:400 fmt:bgra -> w:480 h:270 fmt:yuv420p flags:0x4
[scale @ 0x6400a0] w:640 h:400 fmt:bgra -> w:480 h:270 fmt:yuva420p flags:0x4
[overlay @ 0x6405d0] main w:480 h:270 fmt:yuv420p overlay x:0 y:0 w:480 h:270 fmt:yuva420p
[overlay @ 0x6405d0] main_tb:1/1000000 overlay_tb:1/25 -> tb:1/1000000 exact:1
[scale @ 0x6415e0] w:480 h:270 fmt:yuv420p -> w:480 h:270 fmt:bgra flags:0x4
[swscaler @ 0x6beef0] No accelerated colorspace conversion found from yuv420p to bgra.
Output #0, mov, to 'withWm.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.15.0
Stream #0:0(eng): Video: png (png / 0x20676E70), bgra, 480x270, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Press [q] to stop, ? for help
frame= 5 fps= 0 q=0.0 Lsize= 147kB time=00:00:00.20 bitrate=6023.2kbits/s
video:146kB audio:0kB global headers:0kB muxing overhead 0.463022%
[root@domU-12-31-39-01-90-A1 a]# ffmpeg -i movie.mov -y -acodec copy -s 480x270 -vcodec png withoutWm.mov
ffmpeg version git-Tue Oct 11 22:16:04 2011 +0200-be5ac96, Copyright (c) 2000-2011 the FFmpeg developers
built on Oct 11 2011 17:25:39 with gcc 4.1.2 20070925 (Red Hat 4.1.2-33)
configuration: --enable-gpl --enable-libmp3lame --enable-shared --enable-nonfree --enable-libx264 --enable-libfaac --disable-mmx --enable-filter=movie --enable-libvpx --enable-pthreads
libavutil 51. 20. 1 / 51. 20. 1
libavcodec 53. 20. 1 / 53. 20. 1
libavformat 53. 15. 0 / 53. 15. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 43. 6 / 2. 43. 6
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.4.0
Duration: 00:00:00.20, start: 0.000000, bitrate: 2920 kb/s
Stream #0:0(eng): Video: png (png / 0x20676E70), bgra, 640x400, 2892 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
[buffer @ 0x627a30] w:640 h:400 pixfmt:bgra tb:1/1000000 sar:0/1 sws_param:
[scale @ 0x63ea30] w:640 h:400 fmt:bgra -> w:480 h:270 fmt:bgra flags:0x4
Output #0, mov, to 'withoutWm.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.15.0
Stream #0:0(eng): Video: png (png / 0x20676E70), bgra, 480x270, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Press [q] to stop, ? for help
frame= 5 fps= 0 q=0.0 Lsize= 80kB time=00:00:00.20 bitrate=3286.8kbits/s
video:80kB audio:0kB global headers:0kB muxing overhead 0.851795%
Attachments (1)
Change History (3)
by , 13 years ago
comment:1 by , 13 years ago
Analyzed by developer: | set |
---|---|
Reproduced by developer: | set |
Status: | new → open |
Partially fixed by the addition of the rgb option in overlay.
By setting rgb=1 alpha information is preserved, the problem that it still doesn't work with YUV input, so overlay by default won't preserve alpha, that's why I'm keeping the ticket open.
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Should be fixed in:
commit 13c62525362595cc914161aaa192953dd9077233 Author: Mark Himsley <mark@mdsh.com> Date: Sun Nov 25 15:24:29 2012 +0000 lavfi/overlay: enable yuva420p as overlay background Same calculation as for RGBA etc to create unpremultiplied output. Useful for creating an intermediate "Mix/Effects bank", in vision mixer (switcher) terminology. Example command: ffmpeg -i input.mov -vf "[in]scale=iw:ih:interl=1,format=yuv420p[bg];movie=BBC_blocks_watermark.png,scale=iw:ih:interl=1,format=yuva420p[dog];movie=Kickabout_strap.mov,sc -b:v 3M -an output.mov Fix trac ticket #549. Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
files to recreate the problem and see erroneous output