HTML5 video: MP4 encoded by ffmpeg does not play in any browser (although it plays in VLC)

I am trying to use HTML5 video in MP4 and WEBM formats. I can not get all browsers to work:

  • Browsers that support WEBM (Chrome desktop, Firefox desktop) play video very well.

  • Browsers that use MP4 do not work (IE, Safari, Android).

  • WEBM is served as video/webm.

  • MP4 is served as video/mp4.

Minimum JSFiddle at: http://jsfiddle.net/#&togetherjs=5Ql5MmrV4j


Browser Errors:

  • IE11: 11.0.9600.17126/11.0.9 KB2957689

    Error: Unsupported video type of invalid file path

  • Android Browser and Chrome Android:

    No errors, the video just does not start


Stability Test - The following three values ​​are equal:

  • The resulting file size: curl <video URL> | wc -c

  • Actual file size: stat -c %s <video file>

  • : Content-Length HTTP-.


:


HTML (, .. ):

<video preload="metadata" controls="controls">
  <source type="video/mp4" src="http://hackology.co.uk/wp-content/uploads/2014/06/hd720-24.mp4">
  <source type="video/webm" src="http://hackology.co.uk/wp-content/uploads/2014/06/hd720-24.webm">
</video>

JSFiddle at http://jsfiddle.net/#&togetherjs=5Ql5MmrV4j

+4
1

MP4 , , MP4 - MS Apple, -/ .

FFMPEG:

-pix_fmt yuv420p
-preset slow
-profile:v baseline

:

ffmpeg
  <INPUT DEFINITION>
  -an
  -s hd720
  -vcodec libx264
  -b:v BITRATE
  -vcodec libx264
  -pix_fmt yuv420p
  -preset slow
  -profile:v baseline
  -movflags faststart
  -y <OUTPUT PATH>

, .

+5

Source: https://habr.com/ru/post/1548041/


All Articles