ffmpeg-python
ffmpeg-python copied to clipboard
Videos concat not work
I try to concat 2 videos but I was got an error.
Here is my code:
try:
in1 = ffmpeg.input(args.videos[0])
in2 = ffmpeg.input(args.videos[1])
v1 = in1.video
a1 = in1.audio
v2 = in2.video
a2 = in2.audio
joined = ffmpeg.concat(v1, a1, v2, a2, n=2, v=1, a=1).node
out = (
ffmpeg.output(joined[0], joined[1], 'out.mov')
.overwrite_output()
.run()
)
print(out)
except ffmpeg.Error as e:
print(e.stderr, file=sys.stderr)
sys.exit(1)
Here is error I got:
[fc#0 @ 0x600003099a70] Stream specifier ':a' in filtergraph description [0:v][0:a][1:v][1:a]concat=a=1:n=2:v=1[s0][s1] matches no streams.
Error binding filtergraph inputs/outputs: Invalid argument
Did you try to run
(
ffmpeg
.concat(
ffmpeg.input(args.videos[0]),
ffmpeg.input(args.videos[1])
)
.output('out.mov') # Unless your input are already .mov you'll probably have to do some conversion here
.run()
)
I am not sure I understand exactly what you are trying to achieve. Can you give more details please?
@tungmt you can use videoalchemy to have readable yaml base ffmpeg command. when it success get generated ffmpeg command and use that in your code.