Opened 5 months ago

Last modified 5 months ago

#11045 new defect

vp9 in mp4 does not maintain transparency (yuva420p)

Reported by: Jozef Chutka Owned by:
Priority: normal Component: undetermined
Version: 7.0 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Using ffmpeg 7.0, I am able to create .mkv, .webm output with alpha channel, however not when creating .mp4

creating transparent video vp9 in mp4 does not seem to maintain alpha channel:

ffmpeg -i input.png -vcodec libvpx-vp9 -auto-alt-ref 0 -y out.mkv
ffmpeg -i input.png -vcodec libvpx-vp9 -auto-alt-ref 0 -y out.webm
ffmpeg -i input.png -vcodec libvpx-vp9 -auto-alt-ref 0 -y out.mp4

The output log looks similar for all commands

Output #0, mp4, to 'out.mp4':
  Metadata:
    encoder         : Lavf61.1.100
  Stream #0:0: Video: vp9 (vp09 / 0x39307076), yuva420p(unknown/bt709/iec61966-2-1, progressive), 256x256 [SAR 1:1 DAR 1:1], q=2-31, 25 fps, 12800 tbn
      Metadata:
        encoder         : Lavc61.3.100 libvpx-vp9
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A

Notice, ffmpeg claims yuva420p is used, however, mp4 does not really store yuva420p:

ffmpeg -vcodec libvpx-vp9 -i out.mkv
...
Stream #0:0: Video: vp9 (libvpx-vp9) (Profile 0), yuva420p(tv, unknown/bt709/iec61966-2-1, progressive), 256x256, SAR 1:1 DAR 1:1, 25 fps, 25 tbr, 1k tbn

ffmpeg -vcodec libvpx-vp9 -i out.webm
...
Stream #0:0: Video: vp9 (libvpx-vp9) (Profile 0), yuva420p(tv, unknown/bt709/iec61966-2-1, progressive), 256x256, SAR 1:1 DAR 1:1, 25 fps, 25 tbr, 1k tbn

ffmpeg -vcodec libvpx-vp9 -i out.mp4
...
 Stream #0:0[0x1](und): Video: vp9 (libvpx-vp9) (Profile 0) (vp09 / 0x39307076), yuv420p(tv, unknown/bt709/iec61966-2-1, progressive), 256x256, 211 kb/s, SAR 1:1 DAR 1:1, 25 fps, 25 tbr, 12800 tbn (default)

When tested in a chrome browser which supports all these formats, only .mkv and .webm is rendered with transparency, while .mp4 being opaque.

So the question is, does mp4 support vp9 with yuva420p or not? If not, should ffmpeg throw an error during encoding?

Attachments (1)

input.png (17.3 KB ) - added by Jozef Chutka 5 months ago.

Download all attachments as: .zip

Change History (2)

by Jozef Chutka, 5 months ago

Attachment: input.png added

comment:1 by mkver, 5 months ago

The alpha is a separate video bitstream that is independently encoded and exported via Matroska blockadditional side data. And the mp4 muxer completely ignores the latter; in other words, our mp4 muxer does not support vp9 with alpha.

Note: See TracTickets for help on using tickets.