Search code examples
phppythonffmpegmp3id3-tag

ffmpeg get meta data in php or python


I am trying to parse ffmpeg output in php to extract all meta data of a mp3 URL.

Is there any pre-written API or something in php or python?

We can use this command to generate a new mp3 file with specified tags:

ffmpeg -i inputfile -metadata title="Movie Title" -metadata year="2010" outputfile

But how can we extract them in an array or object?

Something like

$ffmpeg->setUrl(---- MP3 URL ---- );
$ffmpeg->getArtist();
$ffmpeg->getAlbum();
$ffmpeg->getYear();

Thanks,


Solution

  • I think this is what you are looking for.

    From the API documentation:

    $movie->getTitle()
    $movie->getArtist()
    $movie->getTrackNumber()
    $movie->getYear()
    $movie->getFrameHeight()
    $movie->getFrameWidth()
    $movie->getPixelFormat()
    $movie->getBitRate()
    

    and so on