How to Play FLV Video in HTML Video tags?

て烟熏妆下的殇ゞ 提交于 2019-11-30 13:12:02

问题


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.

Is there any way to play FLV within HTML Video Tags?

I know MP4 and OGG files will but the thing that I am working on will produce an FLV file.


回答1:


You should look at video.js from www.videojs.com I have been using it streaming live video feeds. It mimicks the video tag like this:

<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.




回答2:


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.

  1. 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.

  2. You can also try to stick to the flayers you have already tried.

  3. 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.

But Remember: Each browser has its own limitaion for playing a video file; you can read browser support here: Mozilla Developer Network




回答3:


Play it with Flash. I think it is the only way: http://css-tricks.com/forums/topic/how-to-play-flv-in-html5/




回答4:


You can do it using flv.js or 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.

Use MediaInfo software or your favorite video player to check what codecs are used in your FLVs.

And if you have H.264 + AAC inside, you can also convert it to MP4 losslessly, without reencoding:

ffmpeg -i input.flv -codec copy output.mp4



回答5:


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.

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.



来源:https://stackoverflow.com/questions/18414015/how-to-play-flv-video-in-html-video-tags

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!