我正在使用ffmpeg将wmv转换为mp4文件,但它不能在html5视频标签上播放

I am using version of ffmpeg 1.2.3 in php . It successfully converts the video to mp4 which i can play using flv player but when i add this video to html5 video tag it doest work properly.

The Command is

shell_exec("/usr/bin/ffmpeg -i /var/www/html/vid/upload/inputfile.wmv -s 500x400 -strict -2  /var/www/html/vid/mp4videos/outputfile.mp4 2>&1");

HTML CODE

<video width="100%" height="100%" controls><source src="mp4videos/outputfile.mp4" type="video/mp4"></video>

You have to use -vcodec libx264 (to use H264 video format) in command line.

ffmpeg -i /var/www/html/vid/upload/inputfile.wmv -s 500x400 -vcodec libx264 -strict -2  /var/www/html/vid/mp4videos/outputfile.mp4

The HTML5 video does not read every video format.

Wikipedia link.

shell_exec("/usr/bin/ffmpeg -i /var/www/html/vid/upload/inputfile.wmv -f mp4 -s 500x400 -strict -2  /var/www/html/vid/mp4videos/outputfile.mp4 2>&1");

This works for me

 exec("ffmpeg -y -i /var/www/html/vid/upload/inputfile.wmv -c:v libx264 -c:a aac -pix_fmt yuv420p -movflags faststart -hide_banner /var/www/html/vid/mp4videos/outputfile.mp4");

The faststart option is very important.