1

I'm using Python 3.6 on MacOSX. I would like to use FFmpeg as Python sub-process. Everything works fine when using the OSX embedded Python 2.7 but using 3.6, this doesn't work.

I get an error message because it doesn't find FFmepg:

raise FFExecutableNotFoundError("Executable '{0}' not found".format(self.executable))
ffmpy.FFExecutableNotFoundError: Executable 'ffmpeg' not found

I tried with ffmpy but I also got the same result by invoking FFmpeg directly:

>>> from subprocess import call
>>> call(["ffmpeg"])
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    call(["ffmpeg"])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1326, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

I installed the FFmpeg lib. by using Brew through Terminal. It was well installed but only visible by Python 2.7, not 3.6.

Calling it from terminal is working :

$ ffmpeg

ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda

I'm not (yet) a Linux specialist but I think that a path is missing for 3.6 to find FFmpeg.

Any clue to solve this annoying issue ?

PatrickT
  • 10,037
  • 9
  • 76
  • 111
Awazleon
  • 21
  • 5
  • 1
    Possible duplicate of [Run ffmpeg on Terminal MacOS](http://stackoverflow.com/questions/15243426/run-ffmpeg-on-terminal-macos) – Robert Valencia Apr 08 '17 at 16:49
  • Maybe try using the absolute path to the `ffmpeg` binary that you want. – l'L'l Apr 08 '17 at 16:59
  • Thx for your answer. It works now. You're right, I just added the real FFmpeg location when calling it. – Awazleon Apr 10 '17 at 06:04
  • I don't see it as a duplicate, but here is a closely related question, except for Linux: https://stackoverflow.com/questions/50798198/oserror-errno-2-no-such-file-or-directory-converting-mp3 – PatrickT May 30 '20 at 05:52

1 Answers1

0

Your particular issue was solved, but let me share how I solved the same error:

FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

Anybody's first reaction would be to check whether ffmpeg was installed properly in the relevant environment. In my case, I had run conda install -c conda-forge ffmpeg without error messages. When I ran find / -name ffmpeg, I found the ffmpeg directory located where I expected it to be, that is /Users/PatrickT/miniconda3/envs/sp/bin/ffmpeg. The version was ffmpeg-4.2.2. I ran conda search ffmpeg --channel conda-forge and found an update was available, so I installed it again, but this time using a slightly different syntax, just in case:

conda config --add channels conda-forge
conda install ffmpeg

And this time it worked!

Conclusion: For whatever reason ffmpeg had not been installed properly on my system and while the ffmpeg directory had been created in the right place, invoking the application failed. In short, the problem was exactly as the error message stated: No such file or directory: 'ffmpeg'

PatrickT
  • 10,037
  • 9
  • 76
  • 111