Max Vohra > Video-FFmpeg-0.47 > Video::FFmpeg

Download:
Video-FFmpeg-0.47.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.47   Source   Latest Release: Video-FFmpeg-0.48

NAME ^

Video::FFmpeg - Retrieve video properties using libavformat such as: height width codec fps

SYNOPSIS ^

  use Video::FFmpeg;
  use Switch;

  my $info = Video::FFmpeg::AVFormat->new($ARGV[0]);

  print "Duration: ",$info->duration,"\n";

  my @video = $info->video;
  print "num video streams: ",$#video+1,"\n";
  my @audio = $info->audio;
  print "num audio streams: ",$#audio+1,"\n";
  my @sub = $info->subtitle;
  print "num sub streams: ",$#sub+1,"\n";

  my @streams = $info->streams;
  for my $id (0 .. $#streams){
    my $stream = $streams[$id];
    print $stream->codec_type,"stream $id\n";
    print "\ttype: ",$stream->codec_type,"\n";
    print "\tcodec: ",$stream->codec,"\n";
    print "\tlanguage: ",$stream->lang,"\n";
    switch($stream->codec_type){
      case "video" {
        print "\tfps: ",$stream->fps,"\n";
        print "\tDAR: ",$stream->display_aspect,"\n";
      }
      case "audio" {
        print "\tsample rate: ",$stream->sample_rate,"hz\n";
        print "\taudio language: ",$stream->lang,"\n";
      }
      case "subtitle" {
        print "\tsub codec: ",$stream->codec,"\n";
        print "\tsub language: ",$stream->lang,"\n";
      }
    }
  };

METHODS ^

The Video::FFmpeg::AVFormat class

Video::FFmpeg::AVFormat->new($file)

AVFormat Constructor

filename

returns the filename of the $info object

duration

duration of the stream, in HH:MM:SS.MS.

start_time

position of the first frame of the component, in microseconds

bit_rate

total stream bitrate in bit/s, 0 if not available.

video

if called in scalar context, returns the first Video::FFmpeg::AVStream::Video object. if called in list context, it returns all Video::FFmpeg::AVStream::Video objects

audio

if called in scalar context, returns the first Video::FFmpeg::AVStream::Audio object. if called in list context, it returns all Video::FFmpeg::AVStream::Audio objects

subtitles

if called in scalar context, returns the first Video::FFmpeg::AVStream::Subtitle object. if called in list context, it returns all Video::FFmpeg::AVStream::Subtitle objects

streams

returns a list of all Video::FFmpeg::AVStream objects.

The Video::FFmpeg::AVStream class

codec

name of the codec

codec_type

returns one of "audio", "video", "subtitle", "data", "attachment", "data", or "unknown"

lang

returns the stream's language

The Video::FFmpeg::AVStream::Audio class

bit_rate

the average bitrate in bit/s

sample_rate

samples per second (hz)

channels

number of audio channels

The Video::FFmpeg::AVStream::Video class

width

picture width

height

picture height

fps

frames per second, 0 if not available.

display_aspect

aspect ratio of the picture in "W:H" format

pixel_aspect

aspect ratio of the pixels in "W:H" format, or undef if not defined;

DESCRIPTION ^

Video::FFmpeg is a factory class for working with video files. Video::FFmpeg utilises FFmpeg's libavformat, and provides a basic interface.

EXPORT

None by default.

SEE ALSO ^

Video::FFmpeg
Video::FFmpeg::AVFormat
Video::FFmpeg::AVStream
Video::FFmpeg::AVStream::Audio
Video::FFmpeg::AVStream::Video
Video::FFmpeg::AVStream::Subtitle
html://www.seattlenetworks.com/perl/FFmpeg

TODO ^

AUTHOR ^

Max Vohra, <max@seattlenetworks.com> html://www.seattlenetworks.com/

COPYRIGHT AND LICENSE ^

Copyright (C) 2009 by Max Vohra

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: