ffmpeg vs mediainfo for getting thumbnail and metadata

Spottsworth picture Spottsworth · Jul 11, 2012 · Viewed 7.5k times · Source

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.

Answer

blahdiblah picture blahdiblah · Jul 14, 2012

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.