Opened 6 years ago

Closed 6 years ago

#5734 closed defect (invalid)

Coherent support to VP8 with alpha channel

Reported by: cdlvcdlv Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:

You can retrieve alpha channel from any video format, except VP8/webm.

% ffmpeg -i -c:v libvpx -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" bouncing_ball_with_alpha.webm
% ffmpeg -i -c:v qtrle -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" bouncing_ball_with_alpha.webm

ffmpeg version - all

The problem is that ffmpeg and ffplay ignore the encoded alpha channel (that I think is encoded in the container webm, i.e. matroska).

You can use any video with alpha (lagarith, qtrle, huffyuv...) and transcode from one to another, given that some of them can only be decoded but not encoded: you can transcode from lagarith to qtrle but no the other way round. In any case, the alpha channel is never lost unless you specify it to be discarded.

But if you use VP8/webm, you will not be able to make further transcodings and retain the transparency. If you deleted the original, your alpha channel is there, but in a black hole. The only way I know to show it is there is using Chrome (I think Opera too, but I have not tested it). I suppose that how they do it is in the source code of Chromium.

I have read it is difficult (see link below and its response). But, is it true what he says: "In a simple test, I passed AV_PIX_FMT_YUVA420P to avpicture_alloc() and was able to get the linesize[] and data[] filled correctly for a YUVA picture"?

To date, there's no tool that can retrieve alpha channel in a webm video.

Change History (6)

comment:1 by cdlvcdlv, 6 years ago

Sorry, the second command should be:
% ffmpeg -i -c:v qtrle

comment:2 by Carl Eugen Hoyos, 6 years ago

Resolution: needs_more_info
Status: newclosed

This works fine here with libvpx.
Please reopen this ticket if you can reproduce with current FFmpeg git head and if you can provide both command line(s) and complete, uncut console output.

comment:3 by Ronald S. Bultje, 6 years ago

I think he wants to default to libvpx for vp8a (not vp8) until the native decoder has alpha support, or alternatively add alpha support to the native decoder also.

comment:4 by cdlvcdlv, 6 years ago

Resolution: needs_more_info
Status: closedreopened

1.- Generate webm with alpha.
% ffmpeg -i -c:v libvpx -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" bouncing_ball_with_alpha.webm
2.- Generate qtrle with alpha.
% ffmpeg -i -c:v qtrle
3.- Generate huffyuv with alpha.
% ffmpeg -i -c:v huffyuv bouncing_ball_with_alpha.avi
4.- Create a background video.
% ffmpeg -i -ss 0 -t 5 -c copy -map 0 background.ogv
5.- Test the three videos over background:
% ffplay -i background.ogv -vf "[ov]; [in][ov]overlay"
% ffplay -i background.ogv -vf "movie=bouncing_ball_with_alpha.avi[ov]; [in][ov]overlay"
% ffplay -i background.ogv -vf "movie=bouncing_ball_with_alpha.webm[ov]; [in][ov]overlay"

Qtrle: right
Huffyuv: right
Webm: wrong

Version used: Zeranoe build N-80999-gf41e37b

comment:5 by cdlvcdlv, 6 years ago

I've found this recent thread. Will this patch be added to ffmpeg? It would solve the issue.

comment:6 by Carl Eugen Hoyos, 6 years ago

Resolution: invalid
Status: reopenedclosed
Note: See TracTickets for help on using tickets.