Buffering settings for the <video> object

So, I am trying to play videos hosted on a remote server, the problem I am facing is that it takes a lot of time for large videos. It seems that all the videos need to be downloaded before the video starts playing (comparing the time it takes to start the video playback, taking into account the time it takes to download it). Does anyone have tips on how to set up a video to start showing as soon as even a small amount has downloaded it.

0
source share
1 answer

to handle individual downloads, you want to use something like ffmpeg to move metadata (the MOOV atom) to the front of the video:

./ffmpeg -y -i SourceFile.mp4 -s 1280x720 -c:v libx264 -b 3M -strict -2 -movflags faststart DestFile.mp4 

The above result will give you an output of 1280x720 at a speed of 3 Mbps, using h264 in the mp4 container, and also make a second pass to move the moov element to the front of the file, which allows it to start the stream faster. It will not transcode audio, so it will retain the quality that you started with

You might want to play around with freesis and bitrate to get a file size that matches what you like / needs.

to do this in the background, you'll want to look at something like this to call ffmpeg with PHP, or use http://ffmpeg-php.sourceforge.net/ , or if it's easier to use a remote transcode service like http: / /ffmpegasaservice.com/

+1
source

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