Franc
Franc

Reputation: 67

Video hosting MP4 compression

I'm trying to add three videos on my website. I'm using jw-player. It works, but a simple ten seconds video (3MB) takes more than one minute to load. I thought it was an issue of my hosting service but I've tryed uploading another similar format video founded on internet, longer than mine (22MB), and it loads in a few seconds!

I'm cutting and converting a .avi (MPEG4, 9280 Kbps, 640X480, 25 fps, 273 MB, 4 minutes, without audio) video with Avidemux, into a .MP4 (H264, 2900 Kbps, 640X480, 25 fps, 3.64 MB, 10 seconds, without audio) video. I've tryed to change format compression, and by reducing bitrate too, but the load didn't improve.

The video founded online is a .MP4 (H264, 1621 Kbps, 960x540, 25 fps, 22.1 MB, 30 seconds, with AAC 48Khz audio). It loads fast, without problems.

Where am I wrong? I can't understand if there are some settings I have to give during the encoding to adapt my video webpages.

Upvotes: 5

Views: 1786

Answers (1)

Aleks G
Aleks G

Reputation: 57316

Ideally, you should use a streaming server to stream your video. You can get around it by using "progressive download" in a regular HTTP server. In order for this to work, you need to prepare your video in a special way. Normally, when you encode an mp4 video, the metadata of the video is at the end of the video file. Therefore the player needs to download the entire mp4 file before it can read the metadata and start playing the video.

You need to use a program, like qt-faststart, to relocate the metadata to the beginning of the mp4 file. Then the player can start playback of the video as soon as the video starts downloading, without the need to wait for the entire video to download.

Essentially, once you have your mp4 file, then just run

qt-faststart yourvideo.mp4 outputvideo.mp4
mv outputvideo.mp4 yourvideo.mp4

(This is assuming you're on a unix-like platform). The commands will be slightly different on windows, but the idea is the same. Once this is done, your video should play as you expect it.

Search for qt-faststart on google or wherever.

Upvotes: 6

Related Questions