Firefox x indicating video problems

Nginx and HTML5 Video in Firefox

Recently I moved my site to a new VPS run by me, the whole process went smoothly and after removing a few server specific .htaccess commands the site was up and running again.

I noticed however that the HTML5 video files that I have been using on a trial basis had stopped working with a big X in the middle of the video frame, but only in Firefox.

This indicates many possible problems with the video, some of which I could immediately dismiss as the file worked fine and other browsers such as Chrome had no issues playing it.

I remembered that it’s important to make sure the mime types are set correctly in apache, easily done with a modification of the .htaccess file in the site’s root directory, however I already had them in place, after trying different things I finally realised that nginx was serving the files directly so I did the following steps:

Open up the Nginx mime type configuration file, eg: /etc/nginx/mime.types
Paste these lines after the last video mime type, in my case it was avi:

    video/ogg                             ogm;
    video/ogg                             ogv;
    video/ogg                             ogg;

Restart nginx, it should then serve ogg video correctly to Firefox users.

Published by

TechGremlin

Owner and main content writer.

5 thoughts on “Nginx and HTML5 Video in Firefox”

  1. Well, not quite the best code to put in; I use this one:


    video/ogg ogv;
    audio/ogg oga ogg;
    application/ogg ogx;

    It is more in-line with the official recommendation. 🙂 Although I used your post as a first guide/start.

  2. Thanks for the help Odin, hopefully it won’t be needed for too much longer, I’ve noticed there’s less that is needed to be added to the mime types file in the later versions of nginx now, it’s starting to work much better out of the box.

  3. Still can’t seem to get it to work. Running latest stable nginx, I’ve tried both your configurations of mime-types, but still fails. The usual X error code thingie, that is. Ideas?

  4. Is it working in any browser? The issue I had only occurred in Firefox, Chrome for example played the file fine without the mime type change, make sure the file is properly encoded for streaming.

    Ever since Nginx 7.x I haven’t needed to add any mime types to get it working properly, however this coincided with the change to pure Nginx, as previously when I had this error I was running Apache with Nginx as a reverse proxy, in this setup I also had to make sure Apache’s mime types (configured in /etc/apache2/mods-enabled/mime.conf and using /etc/mime.types instead) were also set up.

  5. This is the 3rd time I’ve been caught out by this when setting up a new server, so thanks for this, even if it served to reminded me how I just don’t learn 😉

Leave a Reply

Your email address will not be published. Required fields are marked *