gpt4 book ai didi

ffmpeg - 有没有办法用偏移连接多个视频和音频流?

转载 作者:行者123 更新时间:2023-12-04 23:24:07 47 4
gpt4 key购买 nike

我为我的英语感到抱歉,它不是我的母语。我的问题与音频和视频流的 ffmpeg 连接有关。通过在线聊天记录了多个音频和视频流。它们都有开始和结束时间点。如果用户关闭微型或相机,则音频和视频流将不匹配。如何在一个时间序列中对齐所有流?我可以添加一些白噪声来分隔两个视频吗?与音频类似。

最佳答案

使用搜索 -ss到( -to-t )和 concat过滤掉可以连接多个输入文件的部分。像这样的东西:

# create three 10 second test input files with different sine tones
ffmpeg -f lavfi -i testsrc -f lavfi -i sine=400 -t 10 clip1.mp4
ffmpeg -f lavfi -i testsrc -f lavfi -i sine=600 -t 10 clip2.mp4
ffmpeg -f lavfi -i testsrc -f lavfi -i sine=800 -t 10 clip3.mp4
# create a separator file
ffmpeg -f lavfi -i nullsrc -f lavfi -i anoisesrc -t 1 noise.mp4

# concatenate parts of the clips with a separator in between
# -ss is seek to timestamp
# -to is stop at timestamp
# use concat filer to appends all the input files streams in the order
# they are passed as input arguments
ffmpeg \
-ss 00:01 -to 00:03 -i clip1.mp4 \
-i noise.mp4 \
-ss 00:04 -to 00:06 -i clip2.mp4 \
-i noise.mp4 \
-ss 00:07 -to 00:09 -i clip3.mp4 \
-i noise.mp4 \
-filter_complex \
'[0:v][0:a] [1:v][1:a] [2:v][2:a] [3:v][3:a] [4:v][4:a]concat=n=5:v=1:a=1[v][a]' \
-map '[v]' -map '[a]' \
output.mp4


希望有帮助!

关于ffmpeg - 有没有办法用偏移连接多个视频和音频流?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55711052/

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