NAME

MP4::File - Read/Write MP4 files

SYNOPSIS

use MP4::File;

$mp4 = MP4::File->new;

$mp4->Modify($filename);
$mp4->SetMetadataArtist("Dire Straits");

$mp4->Close;

MP4::File->Optimize($filename);

DESCRIPTION

Please refer to the libmp4v2 documentation for details.

FileInfo

$info = MP4::File->FileInfo($fileName, $trackId = 0)

Optimize

$ok = MP4::File->Optimize($fileName, $newFileName = 0, $verbosity = 0)

new

$mp4 = MP4::File->new()

Read

$ok = $mp4->Read($fileName, $verbosity = 0)

Modify

$ok = $mp4->Modify($fileName, $verbosity = 0, $flags = 0)

Info

$info = $mp4->Info($trackId = 0)

Close

$ok = $mp4->Close()

GetVerbosity

$verbosity = $mp4->GetVerbosity()

SetVerbosity

$ok = $mp4->SetVerbosity($verbosity)

FindTrackId

$trackId = $mp4->FindTrackId($index, $type = 0, $subType = 0)

GetTrackType

$type = $mp4->GetTrackType($trackId)

$type is one of the following constants that may be imported using:

use MP4::File qw( :constants );

MP4_AUDIO_TRACK_TYPE

MP4_CLOCK_TRACK_TYPE

MP4_CNTL_TRACK_TYPE

MP4_HINT_TRACK_TYPE

MP4_IPMP_TRACK_TYPE

MP4_MPEG7_TRACK_TYPE

MP4_MPEGJ_TRACK_TYPE

MP4_OCI_TRACK_TYPE

MP4_OD_TRACK_TYPE

MP4_SCENE_TRACK_TYPE

MP4_VIDEO_TRACK_TYPE

GetTrackDuration

$seconds = $mp4->GetTrackDuration($trackId)

GetTrackBitRate

$bps = $mp4->GetTrackBitRate($trackId)

GetTrackTimeScale

$scale = $mp4->GetTrackTimeScale($trackId)

MetadataDelete

$ok = $mp4->MetadataDelete()

DeleteMetadataName

$ok = $mp4->DeleteMetadataName()

DeleteMetadataArtist

$ok = $mp4->DeleteMetadataArtist()

DeleteMetadataWriter

$ok = $mp4->DeleteMetadataWriter()

DeleteMetadataComment

$ok = $mp4->DeleteMetadataComment()

DeleteMetadataTool

$ok = $mp4->DeleteMetadataTool()

DeleteMetadataYear

$ok = $mp4->DeleteMetadataYear()

DeleteMetadataAlbum

$ok = $mp4->DeleteMetadataAlbum()

DeleteMetadataGenre

$ok = $mp4->DeleteMetadataGenre()

DeleteMetadataGrouping

$ok = $mp4->DeleteMetadataGrouping()

DeleteMetadataCoverArt

$ok = $mp4->DeleteMetadataCoverArt()

DeleteMetadataTrack

$ok = $mp4->DeleteMetadataTrack()

DeleteMetadataDisk

$ok = $mp4->DeleteMetadataDisk()

DeleteMetadataTempo

$ok = $mp4->DeleteMetadataTempo()

DeleteMetadataCompilation

$ok = $mp4->DeleteMetadataCompilation()

GetMetadataName

$string = $mp4->GetMetadataName()

GetMetadataArtist

$string = $mp4->GetMetadataArtist()

GetMetadataWriter

$string = $mp4->GetMetadataWriter()

GetMetadataComment

$string = $mp4->GetMetadataComment()

GetMetadataTool

$string = $mp4->GetMetadataTool()

GetMetadataYear

$string = $mp4->GetMetadataYear()

GetMetadataAlbum

$string = $mp4->GetMetadataAlbum()

GetMetadataGenre

$string = $mp4->GetMetadataGenre()

GetMetadataGrouping

$string = $mp4->GetMetadataGrouping()

GetMetadataCoverArtCount

$number = $mp4->GetMetadataCoverArtCount()

GetMetadataCoverArt

$binary = $mp4->GetMetadataCoverArt()

GetMetadataTrack

($curr, $total) = $mp4->GetMetadataTrack()

GetMetadataDisk

($curr, $total) = $mp4->GetMetadataDisk()

GetMetadataTempo

$tempo = $mp4->GetMetadataTempo()

GetMetadataCompilation

$bool = $mp4->GetMetadataCompilation()

SetMetadataName

$ok = $mp4->SetMetadataName($string)

SetMetadataArtist

$ok = $mp4->SetMetadataArtist($string)

SetMetadataWriter

$ok = $mp4->SetMetadataWriter($string)

SetMetadataComment

$ok = $mp4->SetMetadataComment($string)

SetMetadataTool

$ok = $mp4->SetMetadataTool($string)

SetMetadataYear

$ok = $mp4->SetMetadataYear($string)

SetMetadataAlbum

$ok = $mp4->SetMetadataAlbum($string)

SetMetadataGenre

$ok = $mp4->SetMetadataGenre($string)

SetMetadataGrouping

$ok = $mp4->SetMetadataGrouping($string)

SetMetadataCoverArt

$ok = $mp4->SetMetadataCoverArt($binary)

SetMetadataTrack

$ok = $mp4->SetMetadataTrack($curr, $total)

SetMetadataDisk

$ok = $mp4->SetMetadataDisk($curr, $total)

SetMetadataTempo

$ok = $mp4->SetMetadataTempo($tempo)

SetMetadataCompilation

$ok = $mp4->SetMetadataCompilation($bool)

AUTHOR

Marcus Holland-Moritz <mhx@cpan.org>