当前位置: 动力学知识库 > 问答 > 编程问答 >

display videos of different formats in html page

问题描述:

I have different formats of videos on my hard disk, i want to display then in a html page,

for example as of now i had .mp4 and .flv video formats = and trying to display with the below html code

<div style="padding-top:90px;">

<video id="vid" width="350" height="250" controls="controls">

<source src="/home/user/videos/django_cms_1280x720.mp4" type="video/mp4" />

</video>

<video id="vid_re" width="350" height="250" controls="controls">

<source src="/home/user/videos/1100000.flv" type="video/mp4" />

</video>

</div>

So when the html page is rendered/opened in the browser, django_cms_1280x720.mp4 video is playing with no problem, but the 1100000.flv is not playing.......

Can anyone please let me know how to display and play the videos of different format on html page ?

Edited

Since .flv videos are not supported by the html, i have converted them to mp4 and edited the code as below and still i am unable to play the video, the page just displaying the blank image of video

 <video id="vid_re" width="350" height="250" controls="controls">

<source src="/home/user/videos/1100000_cnvtd.mp4" type="video/mp4" />

</video>

网友答案:

FLV is not supported as a native format to be played by browsers. You'll have to use a plug-in to play flv on your website.

You can try:

http://flowplayer.org/
网友答案:

Based on the comments discussion, I think I have enough data to answer your question:

  1. Originally, your problem video had a .flv extension. This was most likely a format that an HTML5-compatible browser could not handle (I say 'likely' because it very well could have been a correct file with an incorrect file extension; the file extension would have triggered the wrong MIME type to be sent via the web server response which can confuse some browsers).
  2. Your quick, proof-of-concept video conversion is inadequate. ffmpeg -i v1.mp4 v2.mp4 will generate a .mp4 file that has MPEG-4 part 2 video, which is not generally supported by HTML5-compatible browsers. You will need to make sure the video is in H.264 format.

So, in general, make sure your videos fall into the fairly rigid constraints defined by your delivery mechanism. In this case, HTML5 video tag requires MP4 files with H.264 video and AAC audio.

分享给朋友:
您可能感兴趣的文章:
随机阅读: