Monday, April 18, 2016

convert avi video to HTML5 video tag supported format

convert avi video to HTML5 video tag supported format

.h264 is just a raw H.264 bytestream. That's just video content, which can be played back by sophisticated players, but usually you want to put everything into a container format, such as MPEG-4 Part 14 ("MP4").

So, run:

# ffmpeg -i test_video.avi -c:v libx264 -pix_fmt yuv420p test_video.mp4

For HTML5 progressive download you may want to move the moov atom of the MP4 container to the beginning of the file, which allows instant playback:

# ffmpeg -i test_video.avi -c:v libx264 -pix_fmt yuv420p -movflags faststart test_video.mp4

You may be interested in: What is a Codec (e.g. DivX?), and how does it differ from a File Format (e.g. MPG)?

<html>
<body>
<h1>Test Video</h1>
<video width="300" height="300" autoplay loop>
  <source src="test_video.mp4" type="video/mp4">
</video>
</body>
</html>


Reference:

http://superuser.com/questions/750811/convert-avi-into-h-264-that-works-inside-an-html5-video-tag

No comments: