Documentation

Movie
in package

Represents a movie file.

Table of Contents

$artist  : string
Author ID3 field.
$audioBitRate  : int
Movie audio stream bit rate.
$audioChannels  : int
Movie audio channels.
$audioCodec  : string
Movie audio codec.
$audioSampleRate  : int
Audio sample rate.
$bitRate  : int
Movie bit rate combined with audio bit rate.
$comment  : string
Comment ID3 field.
$copyright  : string
Copyright ID3 field.
$duration  : float
Movie duration in seconds.
$ffmpegBinary  : string
Path to `ffmpeg` binary.
$frameCount  : int
Current frame index
$frameHeight  : int
Movie frame height.
$frameNumber  : int
Current frame number.
$frameRate  : float
Movie frame rate.
$frameWidth  : int
Movie frame width.
$genre  : string
Genre ID3 field.
$movieFile  : string
Movie file path
$output  : string
Output providers output as string.
$pixelAspectRatio  : float
Movie pixel aspect ratio.
$pixelFormat  : string
Movie pixel format.
$provider  : OutputProvider
Output provider instance.
$REGEX_ARTIST  : mixed
$REGEX_AUDIO_BITRATE  : mixed
$REGEX_AUDIO_CHANNELS  : mixed
$REGEX_AUDIO_CODEC  : mixed
$REGEX_AUDIO_SAMPLE_RATE  : mixed
$REGEX_BITRATE  : mixed
$REGEX_COMMENT  : mixed
$REGEX_COPYRIGHT  : mixed
$REGEX_DURATION  : mixed
$REGEX_ERRORS  : mixed
$REGEX_FRAME_RATE  : mixed
$REGEX_FRAME_WH  : mixed
$REGEX_GENRE  : mixed
$REGEX_HAS_AUDIO  : mixed
$REGEX_HAS_VIDEO  : mixed
$REGEX_PIXEL_ASPECT_RATIO  : mixed
$REGEX_PIXEL_FORMAT  : mixed
$REGEX_ROTATION  : mixed
$REGEX_TITLE  : mixed
$REGEX_TRACK_NUMBER  : mixed
$REGEX_VIDEO_BITRATE  : mixed
$REGEX_VIDEO_CODEC  : mixed
$REGEX_YEAR  : mixed
$rotation  : int
Movie rotation.
$title  : string
Title ID3 field.
$trackNumber  : int
Track ID3 field.
$videoBitRate  : int
Movie video stream bit rate.
$videoCodec  : string
Movie video codec.
$year  : int
Year ID3 field.
__clone()  : mixed
__construct()  : mixed
Open a video or audio file and return it as an Movie object.
__serialize()  : array<string|int, mixed>
String representation of a Movie.
__unserialize()  : void
Constructs the Movie from serialized data.
getArtist()  : string
Return the author field from the movie or the artist ID3 field from an mp3 file; alias $movie->getArtist()
getAudioBitRate()  : int
Return the audio bit rate of the media file in bits per second.
getAudioChannels()  : int
Return the number of audio channels in this movie.
getAudioCodec()  : string
Return the name of the audio codec used to encode this movie.
getAudioSampleRate()  : int
Return the audio sample rate of the media file in bits per second.
getAuthor()  : string
Return the author field from the movie or the artist ID3 field from an mp3 file.
getBitRate()  : int
Return the bit rate of the movie or audio file in bits per second.
getComment()  : string
Return the comment field from the movie or audio file.
getCopyright()  : string
Return the copyright field from the movie or audio file.
getDuration()  : float
Return the duration of a movie or audio file in seconds.
getFilename()  : string
Return the path and name of the movie file or audio file.
getFrame()  : Frame|bool
Returns a frame from the movie as an Frame object. Returns false if the frame was not found.
getFrameAtTime()  : Frame|bool
Returns a frame from the movie as a Frame object. Returns false if the frame was not found.
getFrameCount()  : int
Return the number of frames in a movie or audio file.
getFrameHeight()  : int
Return the height of the movie in pixels.
getFrameNumber()  : int
Return the current frame index.
getFrameRate()  : float
Return the frame rate of a movie in fps.
getFrameWidth()  : int
Return the width of the movie in pixels.
getGenre()  : string
Return the genre ID3 field from an mp3 file.
getNextKeyFrame()  : Frame|bool
Returns the next key frame from the movie as an Frame object. Returns false if the frame was not found.
getPixelAspectRatio()  : float
Return the pixel aspect ratio of the movie.
getPixelFormat()  : string
Return the pixel format of the movie.
getProvider()  : OutputProvider
Getting current output provider implementation.
getRotation()  : int
Return the rotation angle of the movie.
getTitle()  : string
Return the title field from the movie or audio file.
getTrackNumber()  : int
Return the track ID3 field from an mp3 file.
getVideoBitRate()  : int
Return the bit rate of the video in bits per second.
getVideoCodec()  : string
Return the name of the video codec used to encode this movie.
getYear()  : int
Return the year ID3 field from an mp3 file.
hasAudio()  : bool
Return boolean value indicating whether the movie has an audio stream.
hasVideo()  : bool
Return boolean value indicating whether the movie has a video stream.
setProvider()  : $this
Setting output provider implementation.

Properties

$artist

Author ID3 field.

protected string $artist

$audioBitRate

Movie audio stream bit rate.

protected int $audioBitRate

$audioChannels

Movie audio channels.

protected int $audioChannels

$audioCodec

Movie audio codec.

protected string $audioCodec

$audioSampleRate

Audio sample rate.

protected int $audioSampleRate

$bitRate

Movie bit rate combined with audio bit rate.

protected int $bitRate

$comment

Comment ID3 field.

protected string $comment

Copyright ID3 field.

protected string $copyright

$duration

Movie duration in seconds.

protected float $duration

$ffmpegBinary

Path to `ffmpeg` binary.

protected string $ffmpegBinary

$frameCount

Current frame index

protected int $frameCount

$frameHeight

Movie frame height.

protected int $frameHeight

$frameNumber

Current frame number.

protected int $frameNumber

$frameRate

Movie frame rate.

protected float $frameRate

$frameWidth

Movie frame width.

protected int $frameWidth

$genre

Genre ID3 field.

protected string $genre

$movieFile

Movie file path

protected string $movieFile

$output

Output providers output as string.

protected string $output

$pixelAspectRatio

Movie pixel aspect ratio.

protected float $pixelAspectRatio

$pixelFormat

Movie pixel format.

protected string $pixelFormat

$REGEX_ARTIST

protected static mixed $REGEX_ARTIST = '/(artist|author)\s*(:|=)\s*(.+)/i'

$REGEX_AUDIO_BITRATE

protected static mixed $REGEX_AUDIO_BITRATE = '/Audio:.+?(\d+) kb\/s/'

$REGEX_AUDIO_CHANNELS

protected static mixed $REGEX_AUDIO_CHANNELS = '/Audio:\s[^,]+,[^,]+,([^,]+)/'

$REGEX_AUDIO_CODEC

protected static mixed $REGEX_AUDIO_CODEC = '/Audio:\s([^,]+),/'

$REGEX_AUDIO_SAMPLE_RATE

protected static mixed $REGEX_AUDIO_SAMPLE_RATE = '/Audio:.+?(\d+) Hz/'

$REGEX_BITRATE

protected static mixed $REGEX_BITRATE = '/bitrate: (\d+) kb\/s/'

$REGEX_COMMENT

protected static mixed $REGEX_COMMENT = '/comment\s*(:|=)\s*(.+)/i'
protected static mixed $REGEX_COPYRIGHT = '/copyright\s*(:|=)\s*(.+)/i'

$REGEX_DURATION

protected static mixed $REGEX_DURATION = '/Duration: (\d{2}):(\d{2}):(\d{2})(\.(\d+))?/'

$REGEX_ERRORS

protected static mixed $REGEX_ERRORS = '/.*(Error|Permission denied|could not seek to position|Invalid pixel format|Unknown encoder|could not find codec|does not contain any stream).*/i'

$REGEX_FRAME_RATE

protected static mixed $REGEX_FRAME_RATE = '/([0-9\.]+\sfps,\s)?([0-9\.]+)\stb(?:r|n)/'

$REGEX_FRAME_WH

protected static mixed $REGEX_FRAME_WH = '/Video:.+?([1-9]\d*)x([1-9]\d*)/'

$REGEX_GENRE

protected static mixed $REGEX_GENRE = '/genre\s*(:|=)\s*(.+)/i'

$REGEX_HAS_AUDIO

protected static mixed $REGEX_HAS_AUDIO = '/Stream.+Audio/'

$REGEX_HAS_VIDEO

protected static mixed $REGEX_HAS_VIDEO = '/Stream.+Video/'

$REGEX_PIXEL_ASPECT_RATIO

protected static mixed $REGEX_PIXEL_ASPECT_RATIO = '/Video:.+DAR (\d+):(\d+)\]/'

$REGEX_PIXEL_FORMAT

protected static mixed $REGEX_PIXEL_FORMAT = '/Video: [^,]+, ([^,]+)/'

$REGEX_ROTATION

protected static mixed $REGEX_ROTATION = '/rotate\s*[:=]\s*(-?[0-9]+)/'

$REGEX_TITLE

protected static mixed $REGEX_TITLE = '/title\s*(:|=)\s*(.+)/i'

$REGEX_TRACK_NUMBER

protected static mixed $REGEX_TRACK_NUMBER = '/track\s*(:|=)\s*(.+)/i'

$REGEX_VIDEO_BITRATE

protected static mixed $REGEX_VIDEO_BITRATE = '/Video:.+?(\d+) kb\/s/'

$REGEX_VIDEO_CODEC

protected static mixed $REGEX_VIDEO_CODEC = '/Video:\s([^,]+),/'

$REGEX_YEAR

protected static mixed $REGEX_YEAR = '/year\s*(:|=)\s*(.+)/i'

$rotation

Movie rotation.

protected int $rotation

$title

Title ID3 field.

protected string $title

$trackNumber

Track ID3 field.

protected int $trackNumber

$videoBitRate

Movie video stream bit rate.

protected int $videoBitRate

$videoCodec

Movie video codec.

protected string $videoCodec

$year

Year ID3 field.

protected int $year

Methods

__clone()

public __clone() : mixed
Return values
mixed

__construct()

Open a video or audio file and return it as an Movie object.

public __construct(string $moviePath[, OutputProvider $outputProvider = null ][, string $ffmpegBinary = 'ffmpeg' ]) : mixed

If ffmpeg and ffprobe are both installed on host system, ffmpeg gets priority in extracting info from the movie file. However to override this default behaviour use any implementation of OutputProviderInterface as the second constructor argument while instantiating

Parameters
$moviePath : string

Full path to the movie file.

$outputProvider : OutputProvider = null

Provides parsable output.

$ffmpegBinary : string = 'ffmpeg'

ffmpeg executable, if $outputProvider not specified.

Tags
throws
Exception
Return values
mixed

__serialize()

String representation of a Movie.

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

Rhe string representation of the object or null.

__unserialize()

Constructs the Movie from serialized data.

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

The string representation of Movie instance.

Return values
void

getArtist()

Return the author field from the movie or the artist ID3 field from an mp3 file; alias $movie->getArtist()

public getArtist() : string
Return values
string

getAudioBitRate()

Return the audio bit rate of the media file in bits per second.

public getAudioBitRate() : int
Return values
int

getAudioChannels()

Return the number of audio channels in this movie.

public getAudioChannels() : int
Return values
int

getAudioCodec()

Return the name of the audio codec used to encode this movie.

public getAudioCodec() : string
Return values
string

getAudioSampleRate()

Return the audio sample rate of the media file in bits per second.

public getAudioSampleRate() : int
Return values
int

getAuthor()

Return the author field from the movie or the artist ID3 field from an mp3 file.

public getAuthor() : string
Return values
string

getBitRate()

Return the bit rate of the movie or audio file in bits per second.

public getBitRate() : int
Return values
int

getComment()

Return the comment field from the movie or audio file.

public getComment() : string
Return values
string

getCopyright()

Return the copyright field from the movie or audio file.

public getCopyright() : string
Return values
string

getDuration()

Return the duration of a movie or audio file in seconds.

public getDuration() : float
Return values
float

Movie duration in seconds.

getFilename()

Return the path and name of the movie file or audio file.

public getFilename() : string
Return values
string

getFrame()

Returns a frame from the movie as an Frame object. Returns false if the frame was not found.

public getFrame([int $frameNumber = null ][, int $width = null ][, int $height = null ][, int $quality = null ]) : Frame|bool
Parameters
$frameNumber : int = null

Frame from the movie to return. If no frame number is specified, returns the next frame of the movie.

$width : int = null
$height : int = null
$quality : int = null
Return values
Frame|bool

getFrameAtTime()

Returns a frame from the movie as a Frame object. Returns false if the frame was not found.

public getFrameAtTime([float $seconds = null ][, int $width = null ][, int $height = null ][, int $quality = null ][, string $frameFilePath = null ][, array<string|int, mixed> &$output = null ]) : Frame|bool
Parameters
$seconds : float = null
$width : int = null
$height : int = null
$quality : int = null
$frameFilePath : string = null
$output : array<string|int, mixed> = null
Tags
throws
RuntimeException
Return values
Frame|bool

getFrameCount()

Return the number of frames in a movie or audio file.

public getFrameCount() : int
Return values
int

getFrameHeight()

Return the height of the movie in pixels.

public getFrameHeight() : int
Return values
int

getFrameNumber()

Return the current frame index.

public getFrameNumber() : int
Return values
int

getFrameRate()

Return the frame rate of a movie in fps.

public getFrameRate() : float
Return values
float

getFrameWidth()

Return the width of the movie in pixels.

public getFrameWidth() : int
Return values
int

getGenre()

Return the genre ID3 field from an mp3 file.

public getGenre() : string
Return values
string

getNextKeyFrame()

Returns the next key frame from the movie as an Frame object. Returns false if the frame was not found.

public getNextKeyFrame() : Frame|bool
Return values
Frame|bool

getPixelAspectRatio()

Return the pixel aspect ratio of the movie.

public getPixelAspectRatio() : float
Return values
float

getPixelFormat()

Return the pixel format of the movie.

public getPixelFormat() : string
Return values
string

getRotation()

Return the rotation angle of the movie.

public getRotation() : int
Return values
int

getTitle()

Return the title field from the movie or audio file.

public getTitle() : string
Return values
string

getTrackNumber()

Return the track ID3 field from an mp3 file.

public getTrackNumber() : int
Return values
int

getVideoBitRate()

Return the bit rate of the video in bits per second.

public getVideoBitRate() : int

NOTE: This only works for files with constant bit rate.

Return values
int

getVideoCodec()

Return the name of the video codec used to encode this movie.

public getVideoCodec() : string
Return values
string

getYear()

Return the year ID3 field from an mp3 file.

public getYear() : int
Return values
int

hasAudio()

Return boolean value indicating whether the movie has an audio stream.

public hasAudio() : bool
Return values
bool

hasVideo()

Return boolean value indicating whether the movie has a video stream.

public hasVideo() : bool
Return values
bool

setProvider()

Setting output provider implementation.

public setProvider(OutputProvider $outputProvider) : $this
Parameters
$outputProvider : OutputProvider
Return values
$this

Search results