带有外部图片的空白视频并逐渐消失 [英] blank video with external picture and fade in effect
本文介绍了带有外部图片的空白视频并逐渐消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个5秒的视频,中间有一个带有淡入淡出效果的图片.
I want to create a 5 seconds video with a picture in the middle that appears with a fade-in effect.
ffmpeg -f lavfi -i color=c=black:s=640x360:d=5 -i logo.png -filter_complex "[1:v]fade=in:0:30[a];[a][0:v]scale2ref=oh*mdar:ih/2[2nd][ref];[ref][2nd]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" output5.mp4
但是图片永远不会出现,相反,如果我删除fadIn属性,图片就会出现,但是没有效果.
But the picture never appears, instead if I remove the fadIn property the picture appears but without the effect.
推荐答案
单个图像被视为1帧的视频.您必须启用循环并可以选择指定持续时间,否则淡入淡出滤镜将没有可用的帧.由于您的淡入淡出持续时间为30帧,并且为图像默认分配的帧速率为25 fps,因此我将持续时间设置为1.25 s == 32帧.
A single image is treated as a video of 1 frame. You have to enable loop and optionally specify a duration, else fade filter has no frames to work with. Since your fade duration is 30 frames and default assigned framerate for images is 25 fps, I've set a duration of 1.25 s == 32 frames.
ffmpeg -f lavfi -i color=c=black:s=640x360:d=5 -loop 1 -t 1.25 -i logo.png -filter_complex "[1:v]fade=in:0:30[a];[a][0:v]scale2ref=oh*mdar:ih/2[2nd][ref];[ref][2nd]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" output5.mp4
这篇关于带有外部图片的空白视频并逐渐消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文