Hi I am using FFMPEG to convert the uploaded video with PHP.
echo "conversion exercise started...<br/><br/>";
/* looping through all files in the directory */
if ($handle = opendir('assets/uploaded_videos')) {
while (false !== ($entry = readdir($handle))) {
/* filtering the desired extensions */
if ($entry != "." && $entry != ".." && in_array(substr($entry, strrpos($entry, '.')), array(".wmv", ".mpg", ".mpeg", ".flv", ".ogg", ".mp4")))
{
$filename = substr($entry, 0, strrpos($entry, '.'));
//$command = "ffmpeg -i assets/uploaded_videos/$entry -vcodec libx264 assetss/videos/$filename.mp4";
$command = "ffmpeg -i assets/uploaded_videos/$entry -vcodec mpeg4 -acodec libfaac files/videos/$filename.mp4";
echo $command."<br />";
shell_exec($command."> /dev/null 2>/dev/null &");
}
}
closedir($handle);
}
I have embedded the player in view file like this:
<video width="350" poster="<?php echo $first_video['thumb_path'];?>" controls>
<source src="<?php echo $first_video['video_path']; ?>" />
<span id="silverlight_player_for_fallback"></span>
</video>
Now, when I run in IE10, the player gives me invalid source error. I am having this issue with both libx264
and mpeg4
MP4 codecs.
Any ideas whats going wrong?
Update
Following Ian's direction, I finally get it working. I have used baseline-level3 profile with libx264. You can provide extra parameters but I guess profile is the key! I experimented couple of profiles and observed that all HTML5 videos on vimeo and youtube use this baseline L3 profile.
Anyone struggling with MP4 can consider the following command for conversion:
/* following command converted all my uploaded *.wmv files to mp4 */
$command = "ffmpeg -i files/uploaded_videos/$entry -vcodec libx264 -profile:v baseline -level 3 files/videos/$filename.mp4";