我是 FFmpeg
的新手我想对我的视频应用颜色过滤器。我搜索了很多,根据我找到的 here此命令似乎正在应用 RGBA 矩阵中的颜色。前任 :
colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
但是使用完整的命令运行:" -i $videoPath
-i $waterMarkPath
-filter_complex [1:v]scale=iw*$scale:-1[v1],[0:v][v1]overlay=0:0[mark],
colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
-pix_fmt yuv420p
-map [mark]
-preset ultrafast -crf 23
-y $outputPath "
我有这个错误:Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_colorchannelmixer_2
ERROR ON EXPORT VIDEO (CODE 1)
谢谢你的帮助
最佳答案
What am I doing wrong here and why?
您的过滤器标签搞砸了。您要求 ffmpeg 输出
[mark]
到视频文件。但这会使 colorchannelmixer 的输出成为孤立的。所有过滤器输出必须由其他过滤器使用或发送到输出文件。你可以这样做:
" -i $videoPath
-i $waterMarkPath
-filter_complex [1:v]scale=iw*$scale:-1[v1];[0:v][v1]overlay=0:0,colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131[mark]
-pix_fmt yuv420p
-map [mark]
-preset ultrafast -crf 23
-y $outputPath "
或者依赖默认的stream selection行为:" -i $videoPath
-i $waterMarkPath
-filter_complex [1:v]scale=iw*$scale:-1[v1];[0:v][v1]overlay=0:0,colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
-pix_fmt yuv420p
-preset ultrafast -crf 23
-y $outputPath "
见 FFmpeg Filtering Intro有关如何制作过滤器图的概述。Is it the right way to apply color filters on video?
是的,如果你想使用 colorchannelmixer。
There are another ways to do it?
是的,有很多filters与颜色有关。
How can I apply the filter only on the video or only on the watermark?
这取决于过滤器的顺序以及您提供给过滤器的输入。
仅在主视频上的 colorchannelmixer:
" -i $videoPath
-i $waterMarkPath
-filter_complex [0:v]colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131[main];[1:v]scale=iw*$scale:-1[v1];[main][v1]overlay=0:0
-pix_fmt yuv420p
-preset ultrafast -crf 23
-y $outputPath "
仅水印上的颜色 channel 混合器:" -i $videoPath
-i $waterMarkPath
-filter_complex [1:v]scale=iw*$scale:-1,colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131[v1],[0:v][v1]overlay=0:0
-pix_fmt yuv420p
-preset ultrafast -crf 23
-y $outputPath "
关于video - FFmpeg 在视频上应用颜色过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69562627/