如何在 HTML 视频标签中播放 FLV 视频?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18414015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Play FLV Video in HTML Video tags?
提问by Alexander Nazarkin
I have had a look at a couple of players like Flow Player, JW Player and a couple more but I can't get it to work exactly in PHP code.
我已经看过几个播放器,如 Flow Player、JW Player 和其他一些播放器,但我无法让它在 PHP 代码中完全正常工作。
Is there any way to play FLV within HTML Video Tags?
有没有办法在 HTML 视频标签中播放 FLV?
I know MP4 and OGG files will but the thing that I am working on will produce an FLV file.
我知道 MP4 和 OGG 文件会,但我正在做的事情会产生一个 FLV 文件。
回答by Ron
You should look at video.js
from www.videojs.comI have been using it streaming live video feeds. It mimicks the video tag like this:
你应该video.js
从www.videojs.com看我一直在使用它流式传输实时视频源。它像这样模仿视频标签:
<video id="example_video_1" class="video-js vjs-default-skin"
controls preload="auto" width="640" height="480"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup='{"example_option":true}'>
<source src="rtmp://localhost/live/test" type="rtmp/flv">
</video>
Works very well for me.
对我来说效果很好。
回答by Afzaal Ahmad Zeeshan
You might consider using some other players that are able to play FLV files; Known browsers (Chrome, Firefox etc...) are not able to run FLV files untill or unless you use some kind of flash player.
您可以考虑使用其他一些能够播放 FLV 文件的播放器;已知的浏览器(Chrome、Firefox 等)无法运行 FLV 文件,除非您使用某种 Flash 播放器。
If you are using PHP, you might want to use a flash player! Use Adobe Flash Player, don't be shy! YouTube and many other websites use it.
You can also try to stick to the flayers you have already tried.
You can convert videos to MP4 or format of OGG. So that every browser can play the video file using the HTML5
<video></video>
tag.
如果您使用的是 PHP,您可能想使用 Flash 播放器!使用 Adobe Flash Player,不要害羞!YouTube 和许多其他网站都使用它。
你也可以尝试坚持你已经尝试过的劫掠者。
您可以将视频转换为 MP4 或 OGG 格式。这样每个浏览器都可以使用 HTML5
<video></video>
标签播放视频文件。
But Remember:Each browser has its own limitaion for playing a video file; you can read browser support here: Mozilla Developer Network
但请记住:每个浏览器对播放视频文件都有自己的限制;您可以在此处阅读浏览器支持:Mozilla Developer Network
回答by Hauns TM
Play it with Flash. I think it is the only way: http://css-tricks.com/forums/topic/how-to-play-flv-in-html5/
用 Flash 播放。我认为这是唯一的方法:http: //css-tricks.com/forums/topic/how-to-play-flv-in-html5/
回答by user
You can do it using flv.jsor via MediaElement.js(that will use flv.js underneath), although the support is limited to FLVs that contain H.264 video with AAC/MP3 audio.
您可以使用flv.js或通过MediaElement.js(将在下面使用 flv.js)执行此操作,但支持仅限于包含带有 AAC/MP3 音频的 H.264 视频的 FLV。
Use MediaInfosoftware or your favorite video player to check what codecs are used in your FLVs.
使用MediaInfo软件或您最喜欢的视频播放器来检查您的 FLV 中使用了哪些编解码器。
And if you have H.264 + AAC inside, you can also convert it to MP4 losslessly, without reencoding:
如果你里面有 H.264 + AAC,你也可以无损地将其转换为 MP4,而无需重新编码:
ffmpeg -i input.flv -codec copy output.mp4
回答by Arnaud Leyder
Technically speaking the HTML5 video specification is codec/protocol agnostic so one could imagine support for flv files could be possible. Problem is: none of the major web browser has implemented it (probably because flv is a proprietary container from Adobe). You will need a flash component to play it back. Either one of the players you mentioned or if you are looking for a standalone free flash player try strobe from Adobe. You can try it here.
从技术上讲,HTML5 视频规范与编解码器/协议无关,因此可以想象支持 flv 文件是可能的。问题是:主要的网络浏览器都没有实现它(可能是因为 flv 是 Adobe 的专有容器)。您将需要一个 Flash 组件来播放它。您提到的播放器之一,或者如果您正在寻找独立的免费 Flash 播放器,请尝试来自 Adobe 的 strobe。你可以在这里试试。
If you can produce .f4v files you may have success in renaming them to mp4 and then try and play them in an HTML5 video tag.
如果您可以生成 .f4v 文件,您可能成功地将它们重命名为 mp4,然后尝试在 HTML5 视频标签中播放它们。