3

I am trying to convert a mov with alpha channel to a webm with alpha channel by ffmpeg. However, what I got was the webm video without alpha channel. My methods are based on those link:

The code I used:

ffmpeg -i input.mov -c:v libvpx-vp9 output.webm

And the output here:

ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libspeex --enable-videotoolbox
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'overlap_1.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2019-01-17T08:43:07.000000Z
  Duration: 00:00:04.00, start: 0.000000, bitrate: 34346 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), bgra(progressive), 1080x1080, 32249 kb/s, SAR 1:1 DAR 1:1, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2019-01-17T08:43:07.000000Z
      handler_name    : Apple Video Media Handler
      encoder         : Animation
      timecode        : 00:00:00:00
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2019-01-17T08:43:07.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 00:00:00:00
File 'overlap_C1.webm' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x7ffdb8018200] v1.7.0
Output #0, webm, to 'overlap_C1.webm':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf58.20.100
    Stream #0:0(eng): Video: vp9 (libvpx-vp9), yuva420p, 1080x1080 [SAR 1:1 DAR 1:1], q=-1--1, 200 kb/s, 24 fps, 1k tbn, 24 tbc (default)
    Metadata:
      creation_time   : 2019-01-17T08:43:07.000000Z
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
      encoder         : Lavc58.35.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=   96 fps=1.6 q=0.0 Lsize=     145kB time=00:00:03.95 bitrate= 299.9kbits/s speed=0.0649x    
video:70kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 106.879829%

According to the output, we know that:

  • video codec:vp9
  • pixel format:yuva420p
  • file format:webm

It looked OK but when I tried to play this video by IINA(a great video player)and Chrome then the video showed the black color instead of the alpha channel. No Alpha Channel!

And I tried the codec vp8 then I got the same effect webm video.I don't know what the hell happened on me. This is my situation:

  • system: macOS mojave 10.14.2
  • libvpx: enable
  • xcode: installed

Hope someone can give me advice, thanks!

3
  • And you have verified that other WebM/VP9 videos with alpha channel play fine in Chrome?
    – slhck
    Jan 29, 2019 at 11:59
  • oh, I didn't expect to verify this! I have tried something and I found that it is ok! Thanks to remind me that! Thank you so much! Jan 29, 2019 at 16:21
  • Glad you got it solved!
    – slhck
    Jan 29, 2019 at 18:49

2 Answers 2

1

I think that the question has been solved. I made a mistake on confirming whether the webm video has the alpha channel. This is the result I played mov with alpha channel and webm with alpha channel with 2 softwares.

IINA (the video player stared 17034 on Github)

  • mov: background with black and white squares
  • webm: background with black color

Chrome (version71, stable)

  • mov: nonsupport
  • webm: background with black color

This far, the black background had made me think the webm video doesn't have the alpha channel.

Then I found the website display how Chrome supports the webm video with alpha channel. The super interesting thing is that I can change the webm video background color, then I checked the html code, they used the CSS to control the background color.How a great way to confirm whether the webm video has alpha channel!

So I did this steps to confirm my webm video:

  1. open the webm video with Chrome
  2. enter developer tool
  3. add the CSS code to the video tag

    style="background-color:rgb(0,255,0)"

  4. if the webm video has the alpha channel, the video background will change to GREEN, or it won't happen anything. And lucky my webm video has the alpha channel!

Thanks, hope this helps.

0

The Blender 3D open source software's video sequence editor can take a video file and export a Webm file. Blender uses FFmpeg. See www.blender.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.