I have an HTML5 page that plays a small video (1.5MB) with autoplay and loop enabled.

The problem is, sometimes it takes up to 10 seconds after loading the page before the video starts playing. I've seen this happen in both Firefox and Chrome.

The only explanation I can think of is that the browser needs to download the entire video before playback begins.

Is this normal, or have I perhaps encoded the videos in a streaming-unfriendly way?

Edit: The video is 10 seconds of 25 fps video encoded by ffmpeg, here are the parameters I used to build them:

//OGV (Theora/Vorbis - used for firefox)
ffmpeg -i input -b 2000k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30  video.ogv

//MP4 (Used by IE, Safari, Chrome)
ffmpeg -i input -b 1500k -vcodec libx264 -vpre slow -vpre baseline -g 30 video.mp4
  • Operating system? The decoders are often different per platform. – Itai Mar 9 '13 at 3:28
  • It was encoded in Linux (Ubuntu 12.0 server), I'm viewing in Windows 7. – CaptainCodeman Mar 10 '13 at 13:37

It is normal to buffer a few seconds of videos before starting playback. That prevents having a lot of hiccups and interruptions during playback. The problem is that your video is only a few seconds, so it would most likely be cached in its entirely.

That being said, you are correct in saying that some formats are not easy to stream. The most common ones used online are though. We cannot know your particular case because you have not given any information about video.

Lastly, this depends both on the video codec used and the decoder because even if the format is capable, it does not mean the decoder can. Firefox and Chrome use different codecs and even different ones depending on the platform. So, once again, more information is needed.

  • Hello, thanks for your comment. The video is 10 seconds of 25fps video, I use OGV and MP4 which are compatible with Firefox and Chrome respectively. I added the encoder params in the original question. – CaptainCodeman Mar 9 '13 at 2:53
  • 1
    @CaptainCodeman - Window playback should be streamed with MP4 under Chrome. Since you are encoding your own, you can simply test by making a longer video (repeat the frames for the exercise), say 1 min, and see if the same happens. – Itai Mar 10 '13 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.