I was wondering how I can write metadata/properties (comments specifically and other information) to a video file (mainly .mp4), using PHP.
Here is my function that I use to download a remote file ($sourceURL) to a local destination ($destinationURL). I am able to rename the file with the $destinationURL (just end it with /video.mp4). I am currently using cURL, but if it can only be done by something like fopen()/fwrite(), then I am open to suggestions :)
function downloadFile( $sourceURL, $destinationURL ) {
$options = array(
CURLOPT_FILE => is_resource( $destinationURL ) ? $destinationURL : fopen( $destinationURL, 'w' ),
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_URL => $sourceURL,
CURLOPT_FAILONERROR => true,
);
$ch = curl_init();
curl_setopt_array( $ch, $options );
$return = curl_exec( $ch );
if ( $return === false ) {
return curl_error( $ch );
} else {
return true;
}
}
What I have tried:
- getID3(): http://getid3.sourceforge.net/ Perhaps I am missing something, but when I try to write to an mp4 file, it gives me this error:
Changing the tag format to "id3v1" doesn't work either.
If I'm not mistaken, the tag format's "id3v2.3" and "id3v1" only work with .mp3 files.
- Answers from: writing exif data in php - These only seem to work for image files
Thank you so much for your time and I look forward to any comments/answers I may receive.
Kind Regards
Joshua Lochner