Ffmpeg convert mov to mp4 file for HTML5 IE9 video tag

I searched everywhere here and on google - there is no valid team that works for IE9. some like IE9 something is missing. Everything I tried worked everywhere: chrome, safari, mobile device, etc ... I need one command that will convert it, and I can use it in each device to support mp4 in the HTML5 tag.

I use the following commands:

ffmpeg -i movie.mov -vcodec copy -acodec copy out.mp4 ffmpeg -i movie.mov -vcodec libx264 -vprofile high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -acodec libvo_aacenc -b:a 128k -pix_fmt yuv420p outa.mp4 ffmpeg -i movie.mov -b:V 1500k -vcodec libx264 -preset fast -g 30 adel.mp4 ffmpeg -i movie.mov -acodec aac -strict experimental -ac 2 -ab 160k -vcodec libx264 -preset slow -f mp4 -crf 22 lamlam.mp4 ffmpeg -i movie.mov -acodec aac -strict experimental -ac 2 -ab 160k -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -f mp4 -threads 0 adiel.mp4 

etc. again, all these commands produce a valid mp4 file that works on chrome, safari, etc .... and works even when I run them in the windows themselves using the window media player. When I put this file in the video tag (I use http://videojs.com/ ) in IE9, it does not work!

 <div class="vidoco-content" style="margin-top: 20px;"> <video id="divVid" class="video-js vjs-default-skin vidoco-center" controls preload="none" width="600" height="400" poster="<?php echo(DOMAIN); ?>static/test.jpg"> <source src="<?php echo(DOMAIN); ?>static/out.mp4" type="video/mp4" /> </video> 

If I use the miro video converter software to convert the same mov file to mp4, it will convert perfectly and I can play it in IE9! miro converter also uses embedd ffmpeg inside it, so I'm sure this is only an indication of the correct ffmpeg command and parameters. In my apache htaccess, I set the correct mime types for my files, and I see that this is really correct when searching in IE developer tools:

 AddType audio/aac .aac AddType audio/mp4 .mp4 .m4a AddType audio/mpeg .mp1 .mp2 .mp3 .mpg .mpeg AddType audio/ogg .oga .ogg AddType audio/wav .wav AddType audio/webm .webm AddType video/mp4 .mp4 .m4v AddType video/ogg .ogv AddType video/webm .webm 

I have been struggling with this for a long time, so any help would be greatly appreciated.

Thank!

+44
internet-explorer-9 html5-video ffmpeg video codec
Mar 20 '13 at 13:21
source share
6 answers

For ffmpeg :

 ffmpeg -i {input}.mov -vcodec h264 -acodec aac -strict -2 {output}.mp4 

You can also add the -q:v / -q:a option to specify the quality of the video. You can also use HandBrake, which is a simpler encoder than ffmpeg.

For HandBrake :

 handbrakecli -i {input}.mov -e x264 -E facc -o {output}.mp4 

EDIT: I found a solution! Here is a ZIP with a working demo that I tested in IE 9 and Firefox!

http://www.mediafire.com/download/kyavlpudybg0bc1/HTML5_video.zip

In addition, the above demo has a flash reserve, so it should work on IE8 and less.

The ffmpeg command used.
EDIT: I had to re-upload the video since my hosting is not working yet. Now it is hosted on mediafire. I found that they are the best file sharing services. Minimal ads, without registration, without waiting 30 seconds.

Also check out this discussion on the videojs website: http://help.videojs.com/discussions/problems/1020-ffmpeg-command-produce-your-demonstration-video .

VERY IMPORTANT! Be sure to click the "Allow Active Content" button to allow the video to start locally at startup!

Video of the problem I have and my solution: See my demo mentioned above.

HTML used during testing:

 <!DOCTYPE html> <html> <body> <video width="320" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag. </video> </body> </html> 

I analyzed the working test video that w3schools provides (it works on IE), and I found out that they used HandBrake to encode the video.

 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: mp42isomavc1 creation_time : 2010-05-11 10:32:06 encoder : HandBrake 0.9.4 2009112300 Duration: 00:00:12.61, start: 0.000000, bitrate: 202 kb/s Chapter #0.0: start 0.000000, end 12.612000 Metadata: title : Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 80 kb/s, 29.65 fps, 29.97 tbr, 90k tbn, 59.31 tbc Metadata: creation_time : 2010-05-11 10:32:06 Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 115 kb/s Metadata: creation_time : 2010-05-11 10:32:06 Stream #0:2(und): Subtitle: mov_text (text / 0x74786574) Metadata: creation_time : 2010-05-11 10:32:06` 
+82
Mar 29 '13 at 0:13
source share

A Primary Journey at ffmpeg




Download the latest version of ffmpeg and its presets http://www.ffmpeg.org/download.html

Follow the instructions to install the ffmpeg binary on Windows




Instruction:

  • Get the latest build from the autobuilds arrozcru page
  • Unzip the folder to the C: / Program Files / ffmpeg folder
  • Add C: / Program Files / ffmpeg / bin to your PATH system environment variables

Additional pre-installation of libx264:

If you are using the libx264 presets (using the -vpre flag), you need to complete the following setup.

  • Create a HOME environment variable so that your user points to your home directory. (e.g. for Vista / 7/8 C: / Users / moose or for XP C: / Documents and Settings / moose)
  • Create a .ffmpeg folder in your home directory
  • Copy the pre-installed files from C: / Program Files / ffmpeg / share / *. ffpreset in% HOME% /. ffmpeg
  • Now you can open the command prompt and use ffmpeg .: D (for example, this is my Vimeo video conversion command. Ffmpeg -i input.mov -vcodec libx264 -vpre hq -crf 24 -g 25 -acodec libmp3lame -ab 192k -ar 44100 output .mp4)
    * NOTE: libfaac is not included in the assembly since libfaac is considered a non-free plugin

Remember to set the HOME environment variable in windows

  • Copy the presets to the environment variable folder
  • To convert using ffmpeg you need to use the following commands:

For mp4 (H.264 / ACC):

 ffmpeg -i INPUTFILE -b 1500k -vcodec libx264 -vpre slow -vpre baseline -g 30 "OUTPUTFILE.mp4" 

For webm (VP8 / Vorbis):

 ffmpeg -i "INPUTFILE" -b 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 "OUTPUTFILE.webm" 

For ogv (Theora / Vorbis):

 ffmpeg -i "INPUTFILE" -b 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 "OUTPUTFILE.ogv" 
+10
Mar 31 '13 at 1:46
source share

from orig link ...

WebM is fully supported in ffmpeg 0.6 and later. At the command prompt, run ffmpeg with no parameters and make sure that it was compiled with VP8 support:

 you@localhost$ ffmpeg FFmpeg version SVN-r23197, Copyright (c) 2000-2010 the FFmpeg developers built on May 19 2010 22:32:20 with gcc 4.4.3 configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis --enable-libvpx 

If you do not see the magic words " --enable-libvorbis " and " --enable-libvpx ", you do not have the correct version of ffmpeg. (If you compiled ffmpeg yourself, check if you have two versions. Thats fine, they will not conflict with each other. You just need to use the full path to the ffmpeg version with VP8 support.)

I am going to make two pass code. Pass 1 simply looks at the input video file (-i pr6.dv) and writes some statistics to a log file (which will be automatically named pr6.dv-0.log). I am specifying a video codec with the -vcodec option:

 you@localhost$ ffmpeg -pass 1 -passlogfile pr6.dv -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i pr6.dv -vcodec libvpx -b 614400 -s 320x240 -aspect 4:3 -an -y NUL 

Most of the ffmpeg command line has nothing to do with VP8 or WebM. libvpx supports several VP8-specific options that you can pass to ffmpeg, but I still don't know how they work. As soon as I find a good explanation for them, I will link it here and include it in the story, if it's worth it.

For the second pass, ffmpeg will read the statistics that he wrote during the first pass and actually do the video and audio encoding. It will write the .webm file.

 you@localhost$ ffmpeg -pass 2 -passlogfile pr6.dv -threads 16 -keyint_min 0 -g 250 -skip_threshold 0 -qmin 1 -qmax 51 -i pr6.dv -vcodec libvpx -b 614400 -s 320x240 -aspect 4:3 -acodec libvorbis -y pr6.webm 

There are five important parameters here:

  • -vcodec libvpx indicates that encoding is using VP8 Video Codec. WebM always uses VP8 video.
  • -b 614400 indicates the bitrate. Unlike other formats, libvpx expects bitrate in real bits, not kilobits. If you want a 600 Kbps video, multiply 600 by 1024 to get 614400.
  • -s 320x240 sets the size of the target, width in height.
  • -aspect 4:3 indicates the aspect ratio of the video. Standard definition video is usually 4: 3, but most high-definition video is 16: 9 or 16:10. During testing, I found that I had to specify this explicitly on the command line, instead of relying on ffmpeg to auto-detect it.
  • -acodec libvorbis indicates that encoding is using Vorbis Audio Codec. WebM always uses Vorbis sound.
+4
Mar 31 '13 at 2:07
source share

I spent many hours trying to figure it out. I finally found how to do it right using avconv (or ffmpeg)

  • Convert video to MPEG4 using the H.264 codec. You don't need anything interesting, just let avconv do the work for you:

     avconv -i video.mp4 -vcodec libx264 pre_out.mp4 
  • Move the file information to the file header so that the browser starts playing it as soon as it starts to download it. THIS IS THE KEY FOR IE9 !!!

     qt-faststart pre_out.mp4 out.mp4 

qt-faststart are Quicktime utilities that also support the H.264 / ACC file format. This is part of the libav-tools package.

+1
Mar 13 '14 at a.m.
source share

My problem was pixel formatting.

Adding -pix_fmt yuv420p fixed in IE for me.

+1
Dec 08 '15 at 0:48
source share

Had the same problem a while ago, and I successfully solved this way:

First download the latest version of ffmpeg (or create from the official github repository ( https://github.com/FFmpeg/FFmpeg ) if you want to do some experimentation).

Then try the following:

 ffmpeg -i input.mov -c:v libx264 -c:a libfaac -strict experimental output.mp4 

Hope this helps!

0
Apr 03 '13 at 20:11
source share



All Articles