gpt4 book ai didi

FFMPEG波形透明,背景纯色

转载 作者:行者123 更新时间:2023-12-04 05:42:54 28 4
gpt4 key购买 nike

我正在尝试使用 ffmpeg 生成波形,我希望背景为纯色,实际波形为透明。以下部分实现了我想要的,除了具有黑色背景。我希望能够将其更改为任何颜色,但波形是透明的。我如何使用 ffmepg 实现此目的?

ffmpeg -i input.mp3 -filter_complex \
"[0:a]aformat=channel_layouts=mono,\
compand=gain=-6, \
showwavespic=s=600x120, \
colorchannelmixer=rr=1:gg=0:bb=0:aa=1,\
drawbox=x=(iw-w)/2:y=(ih-h)/2:w=iw:h=1:color=red,\
format=rgba,\
colorkey=#ff0000" \
-vframes 1 output.png

这会生成这个波形:背景是黑色的,波形本身是透明的。如何将背景颜色更改为不同的颜色,同时仍保持波形透明?

enter image description here

最佳答案

使用这个

ffmpeg -i input.mp3 -filter_complex \
"[0:a]aformat=channel_layouts=mono,compand=gain=-6, \
showwavespic=s=600x120:colors=white,negate[a]; \
color=red:600x120[c]; \
[c][a]alphamerge" -vframes 1 output.png

showwavespic 中指定的颜色可确保您获得严格的双色输出。比拔 key 更好。

关于FFMPEG波形透明,背景纯色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37149739/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com