简体   繁体   中英

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

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"))

If you have VideoStation installed in your NAS you can use ffprobe from the following directory:

/var/packages/VideoStation/target/bin/ffprobe

Alternatively you can use exiftool, which is a Perl script that can be executed if you install Perl support via Package Center.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM