Created
August 14, 2018 16:58
-
-
Save jstncno/35db6e44ba0785de8bea8f08318ec40f to your computer and use it in GitHub Desktop.
Convert a .mov, decoded as AppleProres w/ an alpha channel, to a Chrome-friendly .webm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Usage: $ mov2webm.sh input.mov output.webm | |
| INPUT=$1 | |
| OUTPUT=$2 | |
| # Convert a video file (e.g., .mov decoded as AppleProres w/ alpha channel) to a .webm | |
| # ffmpeg -i $INPUT -c:v libvpx-vp9 -pix_fmt yuva420p output.webm | |
| # Convert a video file (e.g., .mov decoded as AppleProres w/ alpha channel) to .png frames | |
| ffmpeg -i $INPUT frame-%02d.png | |
| # Convert .png frames to a .webm | |
| # `yuva420p` pixel format supports alpha channel | |
| ffmpeg -framerate 30 -f image2 -i frame-%02d.png -c:v libvpx-vp9 -pix_fmt yuva420p $OUTPUT |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @brendan8c,
Sorry for the super late reply. This requires
ffmpegas a dependency. Make sure to install it before running this script. If you develop on macOS (like I do), you can installffmpegusing Homebrew.Once you have
ffmpeginstalled, you can then run the following command:Note: The way this script works is that it first convert the
.movfile to a series of.pngframes, then use those.pngframes to build the.webmvideo. As a consequence of this, the resulting video will have no audio (having no audio means it can autoplay in Chrome.