How to correctly encode .mp4 files for streaming

最近为了在ubuntu上搭建流媒体服务器,目的是为了在ipad上观看电脑上的视频并且不用将视频文件下载到本地,这是找到的编码相关的资料~

For HTTP pseudo-streaming to iPhones, and RTSP streaming to other mobiles, .mp4 files need to be correctly encoded. 


Normally a .mp4 file has its data information included at the end which, if streamed, would require the entire video to be downloaded before playback can begin. 

Videos can be correctly encoded using ffmpeg but for a less stressful process, using a graphical interface, install Handbrake. Unfortunately there is no longer .deb package available for Ubuntu, but the PPA may be added to Synaptic: 

deb http://ppa.launchpad.net/stebbins/handbrake-snapshots/ubuntu lucid main
deb-src http://ppa.launchpad.net/stebbins/handbrake-snapshots/ubuntu lucid main 

with the signing key: 1024R/816950D8 

Or use: 
~$ sudo add-apt-repository ppa:stebbins/handbrake-snapshots 

Update the package list: 
~$ sudo aptitude update 

and install Handbrake 
~$ sudo aptitude install handbrake 

Handbrake will now be available in “Applications > Sound & Video > HandBrake” 

Choose the output format that you require, making sure to select the “Web Optimized” box as well. 

To complete the encoding time data must now be added to the .mp4 file. Install MP4Box using: 
~$ sudo aptitude install gpac 

and run: 
~$ MP4Box -hint YOURFILENAME.mp4 

The .mp4 file can now be uploaded to the server for streaming :) 

If you are using HTTP streaming, for instance to an iPhone, ensure that your server does not have the Apache module “mod_h264_streaming” enabled as this interferes with HTTP progressive block requests.
posted @ 2013-05-04 17:38  Gigbit  阅读(213)  评论(0编辑  收藏  举报