ffmpeg将mov文件转换为HTML5视频标签IE9的mp4 [英] ffmpeg convert mov file to mp4 for HTML5 video tag IE9
问题描述
我在这里和google上看到无处不在 - 没有适用于IE9的有效命令。
一些如何IE9缺少的东西。
我尝试的所有工作都在其他地方:chrome,safari,移动设备等...
我想要一个将转换它的命令,我可以在每个设备中使用它,假设在HTML5视频标签中支持mp4
I looked everywhere here and on google - there is no valid command that works for IE9. some how IE9 is missing something. All that I tried worked everywhere else: chrome,safari,mobile device etc... I want one command that will convert it and I can use it in every device suppose to support mp4 in HTML5 video tag.
我使用这个命令:
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 ..再次,所有这些命令产生一个有效的m p4文件,它可以在chrome,safari等上工作,甚至当我使用Windows媒体播放器在Windows中启动它们时也可以使用。
当我把这个文件放在视频标签(我正在使用 http://videojs.com/ )在IE9它不是' t / b>
etc.. again all this commands produce a valid mp4 file which works on chrome,safari etc... and works even when I launch them in windows itself using window media player. When I put this file in the video tag (I am using http://videojs.com/) in IE9 it isn't working !
<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>
如果我使用软件< a href =http://www.mirovideoconverter.com/> miro视频转换器将相同的mov文件转换为mp4 - 它转换好,我可以在IE9中播放!
miro转换器也在其中使用embedd ffmpeg,所以我确定它只是一个正确的ffmpeg命令和参数的一个Meter。
在我的apache htaccess中,我为我的文件设置了正确的mime类型,当查看IE开发人员工具时,我看到它确实是正确的:
If I use the software miro video converter to convert the same mov file to mp4 - it converted fine and I can play it in IE9! miro converter is also using embedd ffmpeg inside it so I am sure it's only a metter of the right ffmpeg command and parameters. In my apache htaccess I set the correct mime types for my files and I see it indeed correct when looking 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 am struggling with this for a long time so any help would be much appreciated.
谢谢!
推荐答案
ffmpeg
:
ffmpeg -i {input}.mov -vcodec h264 -acodec aac -strict -2 {output}.mp4
您还可以添加 -q:v
/ -q:a
参数,以指定视频的质量。您也可以使用比ffmpeg更简单的编码器的HandBrake。
You may also add the -q:v
/-q:a
parameter to specify the quality of the video. You may also use HandBrake which is a simpler encoder than ffmpeg.
对于 HandBrake
:
handbrakecli -i {input}.mov -e x264 -E facc -o {output}.mp4
相同 ffmpeg
命令使用。 br>
编辑:我不得不重新上传视频,因为我的主机服务现在已经关闭了。现在它是在mediafire上。我发现他们是最好的文件共享服务。最小广告,无注册,30秒等待。
Same ffmpeg
command used.
I had to re-upload the video, since my hosting service is down for now. Now it is hosted on mediafire. I found they are the best file sharing service. Minimum ads, no registration, no 30 sec wait.
另外,关于videojs网站的这个讨论: http://help.videojs.com/discussions/problems/1020-ffmpeg-command-produce-your-demonstration-video 。
非常重要!确保点击允许活动内容按钮在本地运行时允许视频!
VERY IMPORTANT! Make sure to click the 'Allow Active Content' button to allow the video when running locally!
我遇到的问题的视频和我的解决方案:看到我上面提到的演示。
Video of the problem I have and my solution: See my demo mentioned above.
测试时使用的HTML代码:
HTML code used while 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>
我分析了w3schools提供的工作测试视频(它适用于IE),我发现他们使用HandBrake编码视频。
I analyzed a 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`
这篇关于ffmpeg将mov文件转换为HTML5视频标签IE9的mp4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!