Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract metadata of video files using Python 3.7? [closed]

I am looking for a simple library, compatible with Python 3.7, which can extract metadata of video files, specifically the capture/recording datetime; the date and time when the video was shot. I am mainly looking to do this on .mov files. hachoir-metadata has no Python library as far as I'm aware; only a command-line interface, and enzyme works only on .mkv files, though this isn't clearly stated in the description. The reason I want to retrieve the recording/capture datatime as a string is that I want to put this in the filename.

Before this question is marked as duplicate: similar questions are either unanswered or outdated. I am honestly puzzled as to why there isn't a proper way to retrieve video metadata in a Python script yet.

like image 439
EmielBoss Avatar asked Jul 14 '18 18:07

EmielBoss


1 Answers

FFMPEG is a suitable library for this.

Installation: pip3 install ffmpeg-python

How to use:

import ffmpeg
vid = ffmpeg.probe(your_video_address)
print(vid['streams'])
like image 200
Arashsyh Avatar answered Sep 28 '22 10:09

Arashsyh