I have the folowing problem.
I allowed users of my website to upload videos and I use getID3(). All vides are being converted to mp4 format. In most cases everything works perfect but every day some video fails - mp4 file does not play.
When I open the problematic file in a text editor, I see the following:
Code: Select all
GIF89a € ÿÿÿ !ù , „ ;
I don't allow to upload gif files, the only allowed formats are:
Code: Select all
wmv|avi|mpg|mp4|mov|ogg|flv|3gp|3g2|m4v
Each file is being checked twice:
1) By a jquery script when user selects file,
2) By a php script + getID3() that checks:
- mime type, frame_rate, playtime_seconds, file type.
I tried to rename a gif file to mp4. I can not upload it and I am getting error about wrong mime type.
Do you have any idea where is the problem? What produces files that start with "GIF89a"?
Below are my avconv commands that I use in php to convert files to mp4:
Code: Select all
$thuc = exec("avconv -y -i $file -map 0 -c:v libx264 -crf 22 -c:a copy $file2");
if ($video_width > 800) {
$thuc = exec("avconv -y -i $file2 -filter:v scale=\"750:trunc(ow/a/2)*2\" -c:a copy $file3");
}