kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
10.04k stars 888 forks source link

Python FileNotFoundError: [Errno 2] No such file or directory: 'ffprobe' on Synology #620

Open Boris-Sachet opened 2 years ago

Boris-Sachet commented 2 years ago

Hi, I was making a small python 3.8 script to sort photos and videos according to their metadata on my Synology NAS (working on DSM 7.0), overall it works well on ubuntu but it fails on the NAS with this error :

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

I've been searching everywhere for help on this issue, I saw this post and tried the solutions but I still got the error on any video I try to read metadata from.

ffmpeg is installed and so are ffmpeg-python and ffprobe-python

Here's my test code:

from datetime import datetime
import ffmpeg

name = "VID_20200130_185053.mp4"
path = "/volume1/photo/phone/DCIM/Camera/"
data_keys = ["DateTimeOriginal", "DateTime", "creation_time"]
file = f"{path}{name}"
print(file)
vid = ffmpeg.probe(file)['streams']
# vid = ffprobe.FFProbe(file).streams
for key in data_keys:
    if key in vid[0]['tags']:
        print(datetime.strptime(vid[0]['tags'].get(key).split('T')[0], "%Y-%m-%d"))
KalobTaulien commented 2 years ago

Hey @Boris-Sachet

I'm new here, but I ran into this immediately as well. The problem was that ffmpeg (and ffprobe) weren't installed on my system.

This Python package is just a wrapper for the crazy commands for ffmpeg on the command line, it doesn't actually install ffmpeg as a program on your computer.

I'm on a Mac, so I just ran ran brew install ffmpeg on the command line, and then ran the following code in iPython:

import ffmpeg 
details = ffmpeg.probe('test.mp4')

And it worked perfectly.

Hope this helps!