Skip to content
Chung Leong edited this page Jun 27, 2013 · 5 revisions

av_file_stat - Return information about a file

array av_file_stat( av_file $file )

av_file_stat() returns an associative array containing information about a file.

###Parameters:

$file - The file to query.

###Return Value: Associative array containing information about file. It will contain the following elements:

"format" - the format identifier

"format_name" - the format name

"bit_rate" - the bitrate of the file

"duration" - the duration of the file in seconds

"metadata" - metadata embedded in the file

"streams" - an associative array containing information about the streams in the file

The keys of the "streams" array are stream identifiers. The string keys "video" and "audio" identify streams that FFmpeg has heuristically determined to be the main contents in the file. Each array element is an associative array containing the following:

"type" - "audio", "video", or "subtitle"

"codec" - the codec identifier

"codec_name" - the codec_name

"bit_rate" - the bit_rate of the stream

"duration" - the duration of the stream

"frame_rate" - frame rate of a video stream

"height" - height of the video frame

"width" - width of the video frame

"sample_rate" - sample rate of an audio stream

"channels" - the number of channels in an audio stream

"channel_layout" - a bitmask indicating the channel layout

"metadata" - metadata associated with the stream

"subtitle_header" - Advanced SubStation Alpha subtitle header

###Sample Output:

Array
(
    [format] => mov
    [format_name] => QuickTime / MOV
    [bit_rate] => 2682103
    [duration] => 29.863197
    [metadata] => Array
        (
            [major_brand] => qt  
            [minor_version] => 537199360
            [compatible_brands] => qt  
            [creation_time] => 2011-04-01 03:36:02
            [title] => "Source Code" Clip
            [title-eng] => "Source Code" Clip
            [artist] => Yahoo! Movies
            [artist-eng] => Yahoo! Movies
            [copyright] => © 2011, Summit Entertainment, LLC.
            [copyright-eng] => © 2011, Summit Entertainment, LLC.
        )

    [streams] => Array
        (
            [0] => Array
                (
                    [type] => audio
                    [codec] => aac
                    [codec_name] => AAC (Advanced Audio Coding)
                    [bit_rate] => 142077
                    [duration] => 29.866666666667
                    [frame_rate] => 0
                    [height] => 0
                    [width] => 0
                    [metadata] => Array
                        (
                            [creation_time] => 2011-04-01 03:36:02
                            [language] => eng
                            [handler_name] => Apple Alias Data Handler
                        )

                )

            [audio] => Array
                (
                    [type] => audio
                    [codec] => aac
                    [codec_name] => AAC (Advanced Audio Coding)
                    [bit_rate] => 142077
                    [duration] => 29.866666666667
                    [frame_rate] => 0
                    [height] => 0
                    [width] => 0
                    [metadata] => Array
                        (
                            [creation_time] => 2011-04-01 03:36:02
                            [language] => eng
                            [handler_name] => Apple Alias Data Handler
                        )

                )

            [1] => Array
                (
                    [type] => video
                    [codec] => h264
                    [codec_name] => H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
                    [bit_rate] => 2533818
                    [duration] => 29.863196529863
                    [frame_rate] => 23.976
                    [height] => 480
                    [width] => 852
                    [metadata] => Array
                        (
                            [creation_time] => 2011-04-01 03:36:02
                            [language] => eng
                            [handler_name] => Apple Alias Data Handler
                        )

                )

            [video] => Array
                (
                    [type] => video
                    [codec] => h264
                    [codec_name] => H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
                    [bit_rate] => 2533818
                    [duration] => 29.863196529863
                    [frame_rate] => 23.976
                    [height] => 480
                    [width] => 852
                    [metadata] => Array
                        (
                            [creation_time] => 2011-04-01 03:36:02
                            [language] => eng
                            [handler_name] => Apple Alias Data Handler
                        )

                )

        )

)