FFmpeg::Codec - A media stream (co)mpression / (dec)ompression algorithm


FFmpeg documentation Contained in the FFmpeg distribution.

Index


Code Index:

NAME

Top

FFmpeg::Codec - A media stream (co)mpression / (dec)ompression algorithm

SYNOPSIS

Top

  $codec = FFmpeg->codec('msmpeg4');

  #or perhaps
  $ff = FFmpeg->new();
  #...
  $sg = $ff->create_streamgroup(); #see FFmpeg::StreamGroup
  $st = ($sg->streams())[0];       #see FFmpeg::Stream
  $codec = $st->codec

DESCRIPTION

Top

Objects of this class are not intended to be instantiated directly by the end user. Access FFmpeg::Codec objects using methods in the FFmpeg class.

Instances of this class represent a compression/decompression algorithm, or codec, that is supported by FFmpeg-C. Audio and video streams use separate codecs. If a codec exists, it means that FFmpeg-C can use it to do at least one of:

read audio or video in the codec's format
write audio or video in the codec's format

Call can_read() and can_write() to see what functionality is supported for a given codec. Call is_video() and is_audio() to determine if a codec is capable of encoding/decoding audio or video.

FEEDBACK

Top

See FEEDBACK in FFmpeg for details.

AUTHOR

Top

Allen Day <allenday@ucla.edu>

COPYRIGHT AND LICENSE

Top

APPENDIX

Top

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a '_'. Methods are in alphabetical order for the most part.

new()

Usage

my $obj = new FFmpeg::Codec();

Function

Builds a new FFmpeg::Codec object

Returns

an instance of FFmpeg::Codec

Arguments

All optional, refer to the documentation of new() in FFmpeg, this constructor operates in the same way.

init()

Usage

$obj->init(%arg);

Function

Internal method to initialize a new FFmpeg::Codec object

Returns

true on success

Arguments

Arguments passed to new

can_read()

Usage

$obj->can_read(); #get existing value

Function

FFmpeg-C can decode this codec?

Returns

a boolean

Arguments

none, read-only

can_write()

Usage

$obj->can_write(); #get existing value

Function

FFmpeg-C can encode this codec?

Returns

a boolean

Arguments

none, read-only

id()

Usage

$obj->id(); #get existing value

Function

FFmpeg-C's internal ID for this codec

Returns

value of id (a scalar)

Arguments

none, read-only

is_audio()

Usage

$obj->is_audio(); #get existing value

Function

does this codec encode/decode audio streams?

Returns

a boolean

Arguments

none, read-only

is_video()

Usage

$obj->is_video(); #get existing value

Function

does this codec encode/decode video streams?

Returns

a boolean

Arguments

none, read-only

name()

Usage

$obj->name(); #get existing value

Function

codec's name

Returns

value of name (a scalar)

Arguments

none, read-only


FFmpeg documentation Contained in the FFmpeg distribution.

# Let the code begin...


package FFmpeg::Codec;
use strict;
use base qw();
our $VERSION = '0.01';

sub new {
  my($class,%arg) = @_;

  my $self = bless {}, $class;
  $self->init(%arg);

  return $self;
}

sub init {
  my($self,%arg) = @_;

  foreach my $arg (keys %arg){
    $self->{$arg} = $arg{$arg};
  }

  return 1;
}

sub can_read {
  my $self = shift;

  return $self->{'can_read'};
}

sub can_write {
  my $self = shift;

  return $self->{'can_write'};
}

sub id {
  my $self = shift;

  return $self->{'id'};
}

sub is_audio {
  my $self = shift;

  return $self->{'is_audio'};
}

sub is_video {
  my $self = shift;
  return $self->{'is_video'};
}

sub name {
  my $self = shift;

  return $self->{'name'};
}

1;