Opened 14 months ago

Last modified 12 months ago

#7965 new enhancement

Support for HEVC with Alpha

Reported by: leemartin Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: hevc
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

At WWDC this year, Apple introduced support for HEVC with Alpha to both their app and browser platforms. You can find their talk on the subject here:

https://developer.apple.com/videos/play/wwdc2019/506

I'm an amateur at FFmpeg but I went down a rabbit hole today, trying to create a video in this new format using the latest version of FFmpeg. I took a rather simple approach of using ffprobe on one of their example video files (found in the resources on the link above) to get a profile and attempting to tune an ffmpeg encoding command to fit the same profile.

While the following command does recreate the profile, it does not retain the transparency of the source prores .mov file.

% ffmpeg -i puppets_with_alpha_prores.mov -c:v libx265 -tag:v hvc1 -pix_fmt yuv420p -colorspace bt709 -color_primaries bt709 -color_trc bt709 puppets_with_alpha_hevc.mov

Apple is pretty clear about how they are achieving this encoding in their talk and examples. Naturally, I didn't follow anything they said and simply tried to hack a solution.

So I'm wondering if this is something FFmpeg can do or would be able to support in the future?

Thanks for the help!

Attachments (1)

puppets_with_alpha_hevc.mov (2.3 MB) - added by leemartin 14 months ago.

Change History (10)

comment:1 Changed 14 months ago by leemartin

  • Priority changed from normal to wish

comment:2 follow-up: Changed 14 months ago by cehoyos

  • Component changed from ffmpeg to avcodec
  • Keywords hevc added
  • Version changed from unspecified to git-master

A small sample file will be useful.

Changed 14 months ago by leemartin

comment:3 in reply to: ↑ 2 ; follow-up: Changed 14 months ago by leemartin

Replying to cehoyos:

A small sample file will be useful.

Attached Apple's sample file. You can also see it in action on iOS 13 Safari with the following code block

<video src="puppets_with_alpha_hevc.mov" autoplay muted playsinline loop></video>

As seen in this tweet:

https://twitter.com/leemartin/status/114133658079747686

comment:4 in reply to: ↑ 3 ; follow-up: Changed 14 months ago by cehoyos

Replying to leemartin:

Replying to cehoyos:

A small sample file will be useful.

As seen in this tweet:

https://twitter.com/leemartin/status/114133658079747686

404

comment:5 in reply to: ↑ 4 Changed 14 months ago by leemartin

Sorry about that. Here's the right link:

https://twitter.com/leemartin/status/1141336580797476865

Replying to cehoyos:

Replying to leemartin:

Replying to cehoyos:

A small sample file will be useful.

As seen in this tweet:

https://twitter.com/leemartin/status/114133658079747686

404

comment:6 Changed 12 months ago by shaocaholica

You would need to use a pix_fmt that has an alpha channel as well. Any of the yuv(a) formats thats also supported by h.265.

comment:7 Changed 12 months ago by leemartin

Using my command above, I try swapping the pix_fmt for 'yuva420p' I receive the warning:

Incompatible pixel format 'yuva420p' for codec 'libx265', auto-selecting format 'yuv420p'

Is there an alpha supported pixel format you can suggest?

Last edited 12 months ago by leemartin (previous) (diff)

comment:8 Changed 12 months ago by shaocaholica

I just mean if the feature is added you would need an alpha channel pix_fmt. The one you end up using will depend on whats supported as far as color sub sampling and bit depth.

Last edited 12 months ago by shaocaholica (previous) (diff)

comment:9 Changed 12 months ago by cehoyos

Note that this ticket - as shown by the sample attached - is about supporting decoding of transparency-containing (Apple) files and providing the transparency.
Encoding requests cannot be made here as FFmpeg does not contain a native hevc encoder.

Note: See TracTickets for help on using tickets.