ffmpeg用crossfade连接3个视频 [英] ffmpeg concatenate 3 videos with crossfade

查看:215
本文介绍了ffmpeg用crossfade连接3个视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将3个具有交叉淡入淡出效果的视频合并在一起.

Im trying to join 3 videos together with a crossfade effect.

我可以将其用于2个视频(来自stackoverflow,但找不到链接):

I can get this working for 2 videos (sourced from stackoverflow but cant find the link):

ffmpeg -y -i part1.mp4 -i part2.mp4 -f lavfi -i color=black:s=1920x1080 -filter_complex \
"[0:v]format=pix_fmts=yuva420p,fade=t=out:st=10:d=1:alpha=1,setpts=PTS-STARTPTS[va0]; \
 [1:v]format=pix_fmts=yuva420p,fade=t=in:st=0:d=1:alpha=1,setpts=PTS-STARTPTS+10/TB[va1]; \
 [2:v]trim=duration=20[over]; \
 [over][va0]overlay[over1]; \
 [over1][va1]overlay=format=yuv420[outv]" \
-vcodec libx264 -map [outv] merged.mp4

但是无法弄清楚如何使这3个视频正常工作.

But cant work out how to make this work for 3 videos.

我不需要任何音频.有什么想法吗?

I don't need any audio. Any ideas?

干杯

推荐答案

ffmpeg-concat 是完成所需操作的最简单方法,它允许您使用一堆性感的OpenGL过渡,默认情况下为crossfade.

ffmpeg-concat is the easiest way to accomplish what you want and allows you to use a bunch of sexy OpenGL transitions, with the default being crossfade.

ffmpeg-concat 0.mp4 1.mp4 2.mp4 -o out.mp4

ffmpeg-gl-transition 是更复杂的自定义ffmpeg过滤器,允许您使用GLSL在两个视频流之间平滑过渡.与此处列出的替代方法相比,此过滤器明显更易于使用和自定义.

ffmpeg-gl-transition is a more complicated custom ffmpeg filter which allows you to use GLSL to smoothly transition between two video streams. This filter is significantly easier to use and customize than the alternatives listed here.

./ffmpeg -i 0.mp4 -i 1.mp4 -filter_complex "gltransition=duration=4:offset=1.5" out.mp4

这篇关于ffmpeg用crossfade连接3个视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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