Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-filter_complex too long cause cmd prompt crush #161

Open
gj94gj94ao4 opened this issue Jan 10, 2019 · 4 comments
Open

-filter_complex too long cause cmd prompt crush #161

gj94gj94ao4 opened this issue Jan 10, 2019 · 4 comments

Comments

@gj94gj94ao4
Copy link

I create some code to split and concat with my scenes like below

	for scene in scenes:
		start = scene.get_startat()
		duration = scene.get_interval()
		v_clip_stream = ffmpeg.trim(
			stream, start=start, duration=duration)
		v_clip_stream = ffmpeg.setpts(v_clip_stream, 'PTS-STARTPTS')
		a_clip_stream = ffmpeg.filter_(
			stream, 'atrim', start=start, duration=duration)
		a_clip_stream = ffmpeg.filter_(
			a_clip_stream, 'asetpts', 'PTS-STARTPTS')

		video_streams.append(v_clip_stream)
		audio_streams.append(a_clip_stream)
	v_stream = ffmpeg.concat(
		*video_streams, n=len(video_streams), v=1, a=0)
	a_stream = ffmpeg.concat(
		*audio_streams, n=len(audio_streams), v=0, a=1)
	stream = ffmpeg.output(v_stream, a_stream, outputfile)

and when my scenes goes too many
system return

FileNotFoundError: [WinError 206] 檔名或副檔名太長。

And i found ffmpeg has -filter_complex_script is there any way to use that?

sorry for my poor English. :P

@kkroening
Copy link
Owner

I'm converting this to a feature request / enhancement.

filter_complex_script is not yet supported but could be implemented at some point.

(PRs are welcome)

@kkroening
Copy link
Owner

kkroening commented Jan 21, 2019

I think it would be something like

stream.run(script_filename='some_script_file')

.. or ..

stream.run(use_script_tmpfile=True)

.. the latter of which automatically determines a temporary script filename and then deletes it when the processing is complete.

But this functionality does not exist yet.

AFAICT, if your command line arguments are getting too long then this is basically what's needed in order to get around the issue.

However, you may still run into issues with command line arguments being too long if you have a lot of input files, because the input filenames probably have to encoded on the command-line either way, even when using filter_complex_scriptfile.

But it'd be good to get support for filter_complex_scriptfile at some point anyways.

@desbma
Copy link

desbma commented Feb 8, 2020

On Linux with huge filter chains, I managed to hit the argument length and get this error:
OSError: [Errno 7] Argument list too long: 'ffmpeg'

I tried bumping the stack size with:
resource.setrlimit(resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
but it did not change anything.

I worked around this by getting the ffmpeg command with ffmpeg.compile(..., writing the filter chain to a temporary file, and then modifying the ffmpeg command to use -filter_complex_script and reference the file.

@utdemir
Copy link

utdemir commented Apr 19, 2022

However, you may still run into issues with command line arguments being too long if you have a lot of input files, because the input filenames probably have to encoded on the command-line either way, even when using filter_complex_scriptfile.

Would using the movie filter a good solution here? https://ffmpeg.org/ffmpeg-filters.html#movie-1

I haven't tried it, but it seems like we can define input sources within the filter graph, sidestepping the issue entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants