使用ffmpeg将视频与自身连接,但相反 [英] Concat a video with itself, but in reverse, using ffmpeg

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

问题描述

我能够通过以下方式撤消

I was able to reverse with:

ffmpeg -i input.mp4 -vf reverse output_reversed.mp4

我可以与:

ffmpeg -i input.mp4 -i input.mp4 -filter_complex "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4

但是我可以用一个命令来连接视频的反向版本吗?

But can I concat with a reverse version of the video, with a single command?

我想要实现的是一种乒乓效果,即视频播放一次,然后立即向后播放.

What I am trying to achieve is a ping pong effect, where the video plays once, then plays backwards right after.

谢谢!

推荐答案

从技术上讲,您可以使用

Technically, you can do it using

ffmpeg -i input.mp4 -filter_complex "[0:v]reverse,fifo[r];[0:v][0:a][r] [0:a]concat=n=2:v=1:a=1 [v] [a]" -map "[v]" -map "[a]" output.mp4

但是反向过滤器将为大型视频使用大量内存.我添加了fifo过滤器以避免丢帧.但是测试一下. (我没有反转音频)

But the reverse filter will use a lot of memory for large videos. I've added a fifo filter to avoid frame drops. But test and see. (I haven't reversed the audio)

如果您的剪辑没有音频,则上述命令将引发错误-而是使用:

If your clip has no audio, the above command will throw an error – instead, use:

ffmpeg -i input.mp4 -filter_complex "[0:v]reverse,fifo[r];[0:v][r] concat=n=2:v=1 [v]" -map "[v]" output.mp4

这篇关于使用ffmpeg将视频与自身连接,但相反的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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