Open AzazelHD opened 1 year ago
I get the same error when I try to 'concat' multiple identical lavfi streams:
# bug.py
import ffmpeg
BLACK_1 = ffmpeg.input(
"color=black:s=800x600",
format="lavfi",
)
BLACK_2 = ffmpeg.input(
"color=black:s=800x600",
format="lavfi",
)
ffmpeg.concat(
BLACK_1.trim(duration=1),
BLACK_2.trim(duration=1)
).output("black.mov").compile()
which produces this output:
$ python bug.py
Traceback (most recent call last):
File "/Users/austin/sandbox/bug/bug.py", line 17, in <module>
).output("black.mov").compile()
File "/Users/austin/sandbox/bug/venv/lib/python3.10/site-packages/ffmpeg/_run.py", line 190, in compile
return cmd + get_args(stream_spec, overwrite_output=overwrite_output)
File "/Users/austin/sandbox/bug/venv/lib/python3.10/site-packages/ffmpeg/_run.py", line 161, in get_args
filter_arg = _get_filter_arg(filter_nodes, outgoing_edge_maps, stream_name_map)
File "/Users/austin/sandbox/bug/venv/lib/python3.10/site-packages/ffmpeg/_run.py", line 101, in _get_filter_arg
_allocate_filter_stream_names(filter_nodes, outgoing_edge_maps, stream_name_map)
File "/Users/austin/sandbox/bug/venv/lib/python3.10/site-packages/ffmpeg/_run.py", line 90, in _allocate_filter_stream_names
raise ValueError(
ValueError: Encountered trim(duration=1) <1da8cb401eff> with multiple outgoing edges with same upstream label None; a `split` filter is probably required
My initial guess is that the stream naming scheme it's using is incorrectly producing identical names for identical - but conceptually distinct - streams.
And FWIW, I was able to make this problem go away but putting labels on my inputs:
BLACK_1 = ffmpeg.input(
"color=black:s=800x600",
format="lavfi",
label='black_1',
)
BLACK_2 = ffmpeg.input(
"color=black:s=800x600",
format="lavfi",
label='black_2',
)
Well...almost. The error goes away when I'm just running compile()
, but when I actually try to execute the ffmpeg command with run()
, I see that ffmpeg-python actually inserts the "-label' into the command, resulting in an invalid ffmpeg command:
ffmpeg -f lavfi -label black_1 -i color=black:s=800x600 -f lavfi -label black_2 -i color=black:s=800x600 -filter_complex [0]trim=duration=1[s0];[1]trim=duration=1[s1];[s0][s1]concat=n=2[s2] -map [s2] black.mov
So this is not the solution I was hoping for :(
I get this error when I try to overlay 2 videos and then merge their audios.
This is my script.
I know on normal ffmpeg the command is:
ffmpeg -i v1.mp4 -i v2.mkv -filter_complex "[1:v]scale=size=300x300[s0];[0:v][s0]overlay=eof_action=pass:x=100:y=100[s1];[1:a][0:a]amerge=inputs=2[a]" -map [s1] -map [a] -vcodec libx264 -acodec aac -strict -2 -pix_fmt yuv420p -crf 23 test.mp4
I've also noticed
overlay
andaudio
labels are "None", but idk if this is the issue. Can you please help me?PD: If i set
Works perfectly, but only with input video audio