我想拆分视频,做一些逻辑处理,最后合并它
import ffmpeg
info = ffmpeg.probe("test.mp4")
vs = next(c for c in info['streams'] if c['codec_type'] == 'video')
num_frames = vs['nb_frames']
arr = []
in_file = ffmpeg.input('test.mp4')
for i in range(int(int(num_frames) / 30) + 1):
startTime = i * 30 + 1
endTime = (1 + i) * 30
if endTime >= int(num_frames):
endTime = int(num_frames)
# more more
arr.append(in_file.trim(start_frame=startTime, end_frame=endTime))
(
ffmpeg
.concat(arr)
.output('out.mp4')
.run()
)我不明白为什么会这样
TypeError: Expected incoming stream(s) to be of one of the following types: ffmpeg.nodes.FilterableStream; got <class 'list'>发布于 2020-12-01 18:18:01
也许这有点太晚了,但你可以试一试
.concat(*arr)使用定义的起始帧和结束帧的列表,这对我很有效
https://stackoverflow.com/questions/63324427
复制相似问题