Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

As far as I know MediaInfo is opensource (see here) and its library can be used in a windows environment (it's a dll) from C++ or C#. No need to parse the output. It has documentation for developers and some samples.

I don't think it can extract thumbnails though.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top