Ch00k / ffmpy

Pythonic interface for FFmpeg/FFprobe command line
MIT License
502 stars 53 forks source link

Can't use Double quotes #45

Closed alsiPanda closed 3 years ago

alsiPanda commented 3 years ago

I am trying to run the following Ffmpeg command in ffmpy '-vf "curves=psfile=/filepath/file.acv" -c:a copy -f mp4'. I keep getting the error exited with status 1. I noticed the command being printed in the error message and that the double quotes were missing. I have tried the different variations shown in the docs under complex commands. But can't seem to get the double quotes where I want. It either surrounds the whole command or the last part. Here is the code I use:

    ff = ffmpy.FFmpeg(
        inputs={input_path: None},
        outputs={output_path: fc}
    )
    ff.run()

fc is fetched from a dictionary.

Ch00k commented 3 years ago

Try escaping the quotes: '-vf \"curves=psfile=/filepath/file.acv\" -c:a copy -f mp4'

alsiPanda commented 3 years ago

Hi @Ch00k , Tried escaping. But getting the same error:

[AVFilterGraph @ 0x55cf67cd0200] No such filter: '"curves' Error opening filters! 2020-12-19 11:08:42,795 django.request ERROR Internal Server Error: /api/mediatools/edit/ Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/usr/local/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, *kwargs) File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, args, kwargs) File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch response = self.handle_exception(exc) File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception self.raise_uncaught_exception(exc) File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception raise exc File "/usr/local/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch response = handler(request, *args, **kwargs) File "/opt/okuna-api/openbook_posts/views/post_media/views.py", line 127, in get edited = myeditor.edit_video(filepath=filepath, size=size, start=start, end=end, my_filter=my_filter) File "/opt/okuna-api/video_encoding/editor.py", line 26, in edit_video newpath = self.add_video_filter(filepath=filepath, overwrite=is_edited, my_filter=my_filter) File "/opt/okuna-api/video_encoding/editor.py", line 95, in add_video_filter ff.run() File "/usr/local/lib/python3.7/site-packages/ffmpy.py", line 105, in run raise FFRuntimeError(self.cmd, self.process.returncode, out[0], out[1]) ffmpy.FFRuntimeError: ffmpeg -i /opt/okuna-api/media/media/temporary/7702824e-156e-4273-9180-a7be305aa250.mpg4 - vf \"curves=psfile=/opt/okuna-api/video_encoding/filter_presets/addictive_red.acv\" -c:a copy -f mp4 /opt/okuna-a pi/media/media/temporary/7702824e-156e-4273-9180-a7be305aa250_edited.mpg4 exited with status 1 STDOUT: STDERR:

Ch00k commented 3 years ago

Please try to swap the quotes: double outside, single inside, like this: "-vf 'curves=psfile=/filepath/file.acv' -c:a copy -f mp4"

tyleradams commented 1 year ago

Is there another fix, this one doesn't work for me :(

        outputs={output_file: "-c:v copy -filter_complex '[1]adelay={}|{}[aud];[0][aud]amix'".format(delay,delay)}

yields


ffmpeg -i first.mp4 -ss 00:00:00 -i HdJaMadziCgQuWSIh3_0.mp3 -c:v copy -filter_complex [1]adelay=0|0[aud];[0][aud]amix first.mp4.tmp.mp4