How can I convert a webm file with alpha channel to a hevc encoded file that will play in safari on an IPad?
Asked Answered
S

1

5

I've got a webm file with transparency : https://itype.techforge.com.au/assets/videos/upshot/module1/NP_1A.webm

I'm trying to convert it into something that will play in the video element of a web page in the Safari browser on an IPad.

An example of a file that works is : https://rotato.netlify.app/alpha-demo/movie-hevc.mov

My attempts at doing this conversion have all failed. 3rd party apps seem to all lose the alpha channel.

On my mac I tried ffmpeg

ffmpeg -i input.webm -c:v hevc_videotoolbox -allow_sw 1 -alpha_quality 0.75 -vtag hvc1 output.mov

However, while this resulted in a file that reported a codec of MPEG-H Part2/HEVC (H.265) (hvc1) the resulting file still has a black background instead of a transparent one.

ffmpeg log : https://pastebin.com/DMM9y5PU

Swart answered 20/9, 2021 at 13:49 Comment(2)
ffmpeg log added.Swart
You sir, are a straight up genius! Put this as an answer so I can accept it =)Swart
I
9

The built-in, default decoder for VP9 currently does not support alpha / transparency. Manually use the decoder libvpx-vp9:

ffmpeg -c:v libvpx-vp9 -i input.webm -c:v hevc_videotoolbox -allow_sw 1 -alpha_quality 0.75 -vtag hvc1 -movflags +faststart output.mov

Your ffmpeg needs to be compiled with --enable-libvpx for this to work.

Immerge answered 21/9, 2021 at 1:21 Comment(2)
macos compilation instructions: trac.ffmpeg.org/wiki/CompilationGuide/macOSCushion
Unrecognized option 'allow_sw'. Any suggestion ?Antediluvian

© 2022 - 2024 — McMap. All rights reserved.