将mp4转换为webm透明度? [英] Convert mp4 to webm with transparency?

查看:524
本文介绍了将mp4转换为webm透明度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何使用ffmpeg 将mp4转换为webm :

I know how to convert mp4 to webm with ffmpeg:

ffmpeg -y -i me939371029.mp4 -r 30  out3.webm

但是我想使用 webm透明度。该指南使用Blender,但Blender的桌面工具不容易自动化,并且仅输出必须转换为视频的PNG。 我想要一个接受视频,颜色和视频输出的命令行应用程序。例如:

But I'd like to use webm transparency. That guide uses Blender, but Blender's a desktop tool that's not easily automated and only outputs PNGs that must be converted to video. I'd like a command line app that accepts video in, a color, and a video out. E.g.:

some-app -i video.mp4 -transparent ff0000 -o video.webm

I如果这样的事情还没有在ffmpeg,但是我似乎无法找到它,那么会感到惊讶。

I'd be surprised if something like this wasn't already in ffmpeg, but I can't seem to find it.

推荐答案

假设要键入的颜色是 00ff00 ,请使用

Assuming the color to be keyed out is 00ff00, use

ffmpeg -i input.mp4 -c:v libvpx -vf "colorkey=0x00ff00:0.1:0.1,format=yuva420p" out.webm

colorkey = 0x00ff00:0.1:0.1

第一个参数是键颜色;

the first argument is the key color;

第二是相似性


0.01只匹配确切的键颜色,而

0.01 matches only the exact key color, while 1.0 matches everything.

,第三个是混合百分比


0.0使像素完全透明,或不透明全部。

0.0 makes pixels either fully transparent, or not transparent at all.

较高的值导致半透明像素,透明度较高,像素颜色与关键颜色的相似度更高。

Higher values result in semi-transparent pixels, with a higher transparency the more similar the pixels color is to the key color.

请参阅 ffmpeg colorkey文档

这篇关于将mp4转换为webm透明度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆