1

I am uploading the mp4 videos on server and playing them on the front end embeded with HTML video tag. Below is the code which is used.

<video width="480" height="294" controls="controls">
    <source src="http://server.com/user_data/machine/133/videos/1_2.mp4" type="video/mp4">
    <source src="http://server.com/user_data/machine/133/videos/1_2.mp4" type="video/webm">
    <source src="http://server.com/user_data/machine/133/videos/1_2.mp4" type="video/ogg">      
</video>

Problem is, it plays some of the videos and some not. Both are mp4 but it plays some of the videos and others not. And for some, they does not video but only the audio.

Can you help me out on what to check and how to resolve this.

thanks,

Purushottam zende
  • 552
  • 1
  • 6
  • 20
  • Check the source type – Afsar May 19 '15 at 07:03
  • As zan says, your source file extensions (.mp4) of the second two videos do not match the type (web and ogg). – Mick May 19 '15 at 12:49
  • @Mick, then do i need to also find a way to convert them to another two extensions in order to play them , like using ffmpeg library. Or is there any other solution. – Purushottam zende May 19 '15 at 15:48
  • @Purushottamzende - if you really want the video to be available on as many browsers and devices as possible then, unfortunately, yes. There are cloud based conversion services such as https://cloudconvert.com/mp4-to-ogg as alternatives to using ffmpeg yourself. If you don't need to get everybody then mp4 is probably the best bet for most coverage with a single format. – Mick May 19 '15 at 21:08

3 Answers3

1

For different source you should have different types of video

File    Type
MP4     video/mp4
WebM    video/webm
Ogg     video/ogg
Afsar
  • 3,104
  • 2
  • 25
  • 35
0

Zende if you want to embed .webm or .ogg format of video in website then you have to convert the video in .webm or .ogg format

  • Yes, i considered that, but it will take time and space to convert each video inot other type of extensions. And i guess i will be required to use "ffmpeg" file for this. – Purushottam zende May 19 '15 at 15:51
0

Also make sure your website serves the right MIME-type for the file. If you are using nginx you need to install the http_mp4_module.

Eric
  • 18,532
  • 2
  • 34
  • 39