Looking for package/library to extract MP4 metadata

Cameron Simpson cs at cskk.id.au
Mon Apr 10 20:27:35 EDT 2023


On 10Apr2023 13:10, Chris Green <cl at isbd.net> wrote:
>> command:
>> ffprobe -v warning -i "input.mp4" -show_streams -of json
>> python:
>> Popen(command, stderr=STDOUT, stdout=PIPE, encoding='utf8')
>> json:
>> json.loads(''.join(p.stdout.readlines()))
>>
>> It's easy to find a version of ffmpeg/ffprobe for every platform.
>
>Thank you, that worked straight away, ffprobe is installed on my
>systems already and I can probably just grep for the tag I want as all
>I'm looking for is the date of its creation which appears (twice) with
>the tag "creation_time".
>
>This is just to handle the occasional MP4 that a python program which
>basically manages JPEGs can't handle.  It throws an exception so I can
>just get that to run a simple bash script to get the creation date.

Yes, ffprobe is great, particularly the JSON output mode, very parsable.

If you want to get into the knitty gritty you could try my `cs.iso14496` 
package, which has a full MP4/MOV parser and a hook for getting the 
metadata.

Not as convenient as ffprobe, but if you care about the innards...

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list