[libav-tools] How to use libav command to analyse an arbitrary video file?

Luca Barbato lu_zero at gentoo.org
Sun Jul 29 05:36:22 CEST 2012


On 07/28/2012 02:32 PM, JIA Pei wrote:
> Hi, all:
> 
> Actually, I've got 2 naive questions:
> 
> 1) Is libav able to replace ffmpeg (avcodec + avformat) ?

If you mean avconv, yes, absolutely.

Please refer to http://libav.org/about.html on why =)

> 2) How to use libav command (avconv or some other commands?) to analyse an
> arbitray video files?

avprobe might be what you want.

> 
> 3) It's convenient for me to encode a video file from multiple .jpg files,
> for example:
> [code]$ ffmpeg -i %3d.jpg video.mpg[/code]

http://libav.org/avconv.html#image2-1

> However, how can I use ffmpeg command (or other commands) to analyse how
> many frames in such a .mpg file? It may have something to do with how I
> encode (for example, the framerate, etc.), right? But, the default encoding
> shouldn't change the number of frames in such a encoded .mpg file, right?

Wrong. as many images you feed, so many frames you get, normally. If you
ask avconv to filter the input frames to they get decimated that's
another issue.

> Anyway, can anybody please help how I can analyse a video file ---- how
> many frames (better, both audio and video streams) in such a video file?

http://libav.org/avprobe.html#Synopsis

avprobe gathers information from multimedia streams and prints it in
human- and machine-readable fashion.

For example it can be used to check the format of the container used by
a multimedia stream and the format and type of each media stream
contained in it.

If a filename is specified in input, avprobe will try to open and probe
the file content. If the file cannot be opened or recognized as a
multimedia file, a positive exit code is returned.

avprobe may be employed both as a standalone application or in
combination with a textual filter, which may perform more sophisticated
processing, e.g. statistical processing or plotting.

Options are used to list some of the formats supported by avprobe or for
specifying which information to display, and for setting how avprobe
will show it.

avprobe output is designed to be easily parsable by any INI or JSON
parsers.

I hope it helps.

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero



More information about the libav-tools mailing list