Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg vs mediainfo for getting thumbnail and metadata

I need to extract the metadata information from a video file as well as a thumbnail for that file. For this I have tried ffmpeg and the metadata (such as duration, resolution, codecs, creation_time etc) is seen on the stdout. If I need to use these I should parse the stdout and extract the metadata I need.

I've also read about the MediaInfo utility which also delivers metadata. I'm not sure if it can deliver thumbnails. What I also know is that MediaInfo does not use ffmpeg under the hood.

I was wondering if anyone has a working knowledge of both ffmpeg and MediaInfo and with respect to the requirement I mentioned above, whether someone could suggest which of the two is a better suited.

Memory footprint comparison of the two would also be great.

like image 512
Spottsworth Avatar asked Dec 15 '22 21:12

Spottsworth


2 Answers

You should use the underlying libraries directly as indicated in other answers.

However, for sake of completeness should you persist in using a separate shell process instead, don't parse FFmpeg's output. Instead, use FFprobe which is the little-known tool specifically designed to complement FFmpeg and ease metadata extraction.

Also, generating thumbnails can be done with FFmpeg more or less like so:

ffmpeg [-ss 10] -i input.avi -vframes 1 -s 320x240 thumbnail.png

Adjust size to taste and use the optional -ss parameter to grab an image from some point other than the very beginning of the video.

like image 138
blahdiblah Avatar answered Jan 22 '23 08:01

blahdiblah


The correct answer is neither ffmpeg nor mediainfo. Well, not the complete executables anyway.

ffmpeg is comprised of a series of libraries, including libavformat, which allows you to work with the multimedia container formats. Using libavformat and libavcodec by Martin Böhme should give you a good introduction.

like image 31
Alex Chamberlain Avatar answered Jan 22 '23 08:01

Alex Chamberlain