# HTML5 video not working in IE9



## SimonT182 (Jul 16, 2010)

I've been experimenting with embedding video files on my website using HTML5 code, which I got from W3schools website.

Now, the video example they use on THIS page plays fine in IE9.

But when I tried to replicate this on my own site (with my own video) the player doesn't load, I just get the default error message about "your browser doesn't support the tag", even though the video player on the w3schools site loads up fine.

My video plays in Chrome and Firefox, as well as the default browser on my Galaxy Tab 3 and the Silk browser on the Kindle Fire. It just doesn't want to work in IE9, despite the fact the HTML5 player works fine on W3schools site. :banghead:

Wondering if this might be something to do with my web host, rather than my browser, but anyway. You can see my test page for yourself HERE

Any suggestions for this peculiar anomoly? 

Thanks in advance!


----------



## SimonT182 (Jul 16, 2010)

Oh yeah, code is as follows (inserted between the BODY tags)

<video width="480" height="360" controls>
<source src="afterdeathtrlr1-1.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>


----------



## Fjandr (Sep 26, 2012)

Do you know what codec your video file uses?


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> Do you know what codec your video file uses?


According to VLC media player... 

Video Codec: H264-MPEG-4 AVC (part 10) (avc1)

Audio Codec: MPEG AAC audio (mp4a)


Shouldn't the player still load though, even if it won't play the video?


----------



## Fjandr (Sep 26, 2012)

IE will play H264 files. Yes, it should still load anyway, but it's one less potential issue to look at.

Open the site in IE, and hit F12 to open the Dev Tools. Find the video file in the list and check what it says under the "Type" column. Does it say "video/mp4"?


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> IE will play H264 files. Yes, it should still load anyway, but it's one less potential issue to look at.
> 
> Open the site in IE, and hit F12 to open the Dev Tools. Find the video file in the list and check what it says under the "Type" column. Does it say "video/mp4"?


If I'm looking at the same thing you say I should be looking at, then yes it says "Video/MP4" (see attatched file)


----------



## Fjandr (Sep 26, 2012)

Yes, that's telling you the MIME type the server is sending. If it wasn't video/mp4, it would cause the player to fail.

I'll do a bit more looking when I get a chance, and see what other things would cause it to fail in IE9.


----------



## KoosHopeloos (Nov 3, 2004)

Have you added 'AddType video/mp4 .mp4' to your .htaccess?

If that doesn't help, which kind of server do you have? Apache or IIS?


----------



## Fjandr (Sep 26, 2012)

The server is already sending the correct Mime type.

Try going through the MSDN example and compare it to your code. HTML5 - Internet Explorer 9 Guide for Developers


----------



## SimonT182 (Jul 16, 2010)

OK, tried adding the line you mentioned to the .htaccess file, no joy.

I use Hostmonster, who I believe run Apache servers.

Have looked at the MSDN example, only difference between their example and my code was they added the type of codecs used. 

I tried this and still got no joy.

Again though, the video page on the W3schools site loads up and plays fine in my ie9 browser, so I'm guessing it might be something to do with my host?


----------



## Fjandr (Sep 26, 2012)

I don't have a copy of IE9 handy. Can you attach a screenshot of the page loaded in IE9?


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> I don't have a copy of IE9 handy. Can you attach a screenshot of the page loaded in IE9?


Here you go


----------



## Fjandr (Sep 26, 2012)

Try re-encoding the video using ffmpeg using the below command (this would be entered into either a command prompt window in Windows or a terminal window in Linux, while in the ffmpeg directory. The program can be downloaded from ffmpeg.com.


```
ffmpeg  -i <infile> -vcodec libx264 -vpre normal -acodec libfaac -threads 0 <outfile>.mp4
```
Also, are you using IE9 on 32bit Windows, or 64bit Windows?


----------



## SimonT182 (Jul 16, 2010)

I'm using Windows 64 bit. Seem to be having a spot of trouble getting FFmpeg to run. I click on the exe file, a cmd window pops up, then dissapears again and nothing else happens?. So I'm not sure what I'm doing wrong?


----------



## Fjandr (Sep 26, 2012)

You need to open the command window by itself first. Clicking the .exe to run it is working, but the command line needs other input in order to do its thing properly. It's outputting that it needs more parameters and then exiting, all faster than you can read.

Copy the video file into the ffmpeg directory.
Run "cmd" from the Start menu search box, then type "cd \directory\to\ffmpeg"
Once in the ffmpeg directory, input the command I posted earlier to re-encode the video file. Depending on the size, and the power of your machine, it may take a while to complete.


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> You need to open the command window by itself first. Clicking the .exe to run it is working, but the command line needs other input in order to do its thing properly. It's outputting that it needs more parameters and then exiting, all faster than you can read.
> 
> Copy the video file into the ffmpeg directory.
> Run "cmd" from the Start menu search box, then type "cd \directory\to\ffmpeg"
> Once in the ffmpeg directory, input the command I posted earlier to re-encode the video file. Depending on the size, and the power of your machine, it may take a while to complete.


Thanks for trying to help, but I really cannot get to grips with FFMpeg. Isn't there another program that can encode in H624? I've been using WinFF. Also tried a program called AnyVideoConverter which encodes in H624, but the results where the same.

Interestingly though, the video played OK on my friends laptop, who uses IE11.


----------



## SimonT182 (Jul 16, 2010)

Here's where it gets interesting

I downloaded the test video from the W3schools test page

This plays fine on their page, but when I uploaded it to my web site, got the aforementioned "your browser does not support this tag" message.

However, on the test page you can try out your own html, so I put in the URL back to the file on my site, and that played fine. So I can play that file from my site on their page, but not on my own site? 

However, when I posted the link to one of my own encoded videos, I got a blank page in IE9 (though it played in Chrome)?

So, I can play their videos on their site, if I upload one of their videos to my site and link it back to theirs, I can play it. But I can't play their videos on my site and my videos don't work when linked back to theirs in IE9, but they do work in Chrome? :banghead:

Maybe its partly an encoding issue and partly a server issue?


----------



## Fjandr (Sep 26, 2012)

It's entirely possible the problem is a combination of issues. It certainly seems more likely given that your video plays correctly from another site when linked to yours.

As for encoding, ffmpeg is the only encoder I've heard mentioned that's solved issues very similar to yours. What is your difficulty in using it? It should simply be a matter of unzipping the package into a directory, opening a command prompt, using the cd command to change to the ffmpeg directory, pasting the posted command (must be done via the top-left icon on the command window edit > paste, as CTRL+V doesn't work in a command window), and hitting enter.


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> It should simply be a matter of unzipping the package into a directory, opening a command prompt, using the cd command to change to the ffmpeg directory, pasting the posted command (must be done via the top-left icon on the command window edit > paste, as CTRL+V doesn't work in a command window), and hitting enter.


Got the FFmpeg file on my D drive

changed the cmd prompt to D drive, then entered "FFmpeg\bin\ffmpeg.exe"

I then get the following (see attatched file). Tried the command prompts you posted earlier, nothing happend.


----------



## Fjandr (Sep 26, 2012)

The -h is added after the ffmpeg command to access the help documentation -> "ffmpeg -h"

I did forget to mention that <infile> and <outfile> in the command should be replaced with the actual file names. <infile> should be the name of the file to be re-encoded, which you should copy to the ffmpeg directory. <outfile> can be any file name you wish. For example:


```
ffmpeg  -i my_vid.mp4 -vcodec libx264 -vpre normal -acodec libfaac -threads 0 my_re-encoded_vid.mp4
```
Any time you see an example command that accesses a file, there will usually be a placeholder for the actual filename which will need to be changed by the end user. I apologize for not making sure that was clear.


----------



## SimonT182 (Jul 16, 2010)

OK, next problem. I typed in

FFmpeg\bin\ffmpeg.exe -i <name of my input file> -vcodec libx264 -vpre normal -acodec libfaac -threads 0 <name of my output file>.mp4 

I got a message saying "could not find this file in the directory"?

I put the file in the FFmpeg folder, I also moved it to the bin folder where the .exe file is, still nothing?


----------



## Fjandr (Sep 26, 2012)

Since there's a path before the ffmpeg command, I assume you didn't cd into the ffmpeg directory. It looks for the file in the directory in which you run the command.

If you don't change into the ffmpeg directory, you need to specify the full path before the input file name.


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> Since there's a path before the ffmpeg command, I assume you didn't cd into the ffmpeg directory. It looks for the file in the directory in which you run the command.
> 
> If you don't change into the ffmpeg directory, you need to specify the full path before the input file name.


I did the CD command, it didn't do anything


----------



## Fjandr (Sep 26, 2012)

The command has to be followed with the directory into which you want to change.


```
C:\Windows\User> cd "C:\Program Files\ffmpeg"
```
That's an example of what the command line would look like to change into the directory after the cd command.









Also note that the ffmpeg syntax was changed a bit. It's been a while since I used it, and presets have changed. Instead of "-vpre normal" in the example I gave earlier, it's "-preset medium".


----------



## SimonT182 (Jul 16, 2010)

The FFmpeg folder is located on my D drive, I've put in 

cd D:\FFmpeg

Nothing!


----------



## Fjandr (Sep 26, 2012)

Apparently Microsoft inexplicably changed the cd syntax for Win7 when it comes to drives. I haven't had reason to change drives using the command line since starting to use Win7 (it was actually probably changed in Vista, which I never used).

To change to D:, the command is "cd /d D:". I'd like to see the person responsible for that decision fired, and blacklisted from development for the rest of their lives, but that's just me.


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> Apparently Microsoft inexplicably changed the cd syntax for Win7 when it comes to drives. I haven't had reason to change drives using the command line since starting to use Win7 (it was actually probably changed in Vista, which I never used).
> 
> To change to D:, the command is "cd /d D:". I'd like to see the person responsible for that decision fired, and blacklisted from development for the rest of their lives, but that's just me.


Aah, that might partly explain why I haven't been getting on too well with this then. Right, I'll have another tinker with it shortly...


----------



## SimonT182 (Jul 16, 2010)

OK, next problem. The file I'm trying to convert is an MPG file named "afterdeathtrlr1".

But when I put the command in I get "no such file or directory"? :banghead:

I've tried putting the file in both the FFmpeg folder and in the bin subfolder where the exe file is located, but no joy (see screengrab)


----------



## Fjandr (Sep 26, 2012)

You're running the command from the root of D:\ not from the directory the file is in. You either have to prepend the directory name to the filename in the command or change to the ffmpeg directory before running the command.


----------



## SimonT182 (Jul 16, 2010)

OK, SOME progress in getting FFmpeg to work. Seems you have to press "shift and right click" in the Bin directory and you get the option to open the cmd window in that folder.

However, it seems FFmpeg has changed its commands. When I typed in your command line, first I got an error saying "preset for normal not found", so I removed that part. THEN I got an error saying "preset for libfaac not found". After I removed that I found FFmpeg then worked and encoded the clip fine.

However, it still won't load up in an embedded HTML5 player in IE9 (I checked the codec used on the finished file and it was H264).

As this only affects IE9, would it be simpler just to post a link straight to the video file, so that it pops up and plays on the device's default media player, rather than trying to embedded it in a web page?

Just thinking this would be the path of least resistence. As I could always embed the files and change the links at a later date when people have updated their browsers.


----------



## Fjandr (Sep 26, 2012)

Fjandr said:


> Also note that the ffmpeg syntax was changed a bit. It's been a while since I used it, and presets have changed. Instead of "-vpre normal" in the example I gave earlier, it's "-preset medium".


As for going around embedding, that's an option. IE9 is a much older version, so it's reasonable to drop support for it unless you have good reason not to.


----------



## SimonT182 (Jul 16, 2010)

Fjandr said:


> As for going around embedding, that's an option. IE9 is a much older version, so it's reasonable to drop support for it unless you have good reason not to.


OK, well thanks for your help on this one.

Yeah I think to begin with, I'll just link straight to the MP4 file and maybe see about embedding at a later date.

Thanks again for trying to help with this. I'll put the embedding problems down to Hostmonster not giving full support to IE9.


----------



## Fjandr (Sep 26, 2012)

Sorry I couldn't help you get it working as an embedded video. From others posting similar problems, it does seem that Hostmonster's setup does interfere with some forms of streaming. Whether or not that's the case here I have no idea.


----------

