Step by step instructions for using FFmpeg as a live video/audio encoder with Wowza Media Server.
Updated for FFMpeg build r25705 (22 November 2010)
Note: Wowza Media Systems provides these instructions on as "AS-IS" basis. FFmpeg is not a Wowza Media Systems product. If you have problems getting FFmpeg to work properly it is best to contact the FFmpeg through their forums or wiki.
To get started, download and install FFmpeg for your platform on the same machine running Wowza Media Server. We will be re-streaming the sample filesample.mp4. The following tutorial is for Windows only. I used the most recent daily build of FFmpeg from this site:
http://ffmpeg./autobuilds/ (編譯好的windows版FFmpeg下載地址)
FFmpeg Setup (Windows)
上面的代碼有誤,應(yīng)該為: ffmpeg -i "%WMSAPP_HOME%/content/sample.mp4" -re -vcodec libx264 -fpre C:\usr\local\share\ffmpeg\libx264-ipod640.ffpreset -g 60 -vb 150000 -strict experimental -acodec aac -ab 96000 -ar 48000 -ac 2 -vbsf h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316
使用ffmpeg實(shí)時(shí)轉(zhuǎn)碼mms直播流有問題,官方文檔使用mmst(mms over tcp)或者mmsh(mms over http),使用時(shí)均報(bào)錯(cuò)。待解決。 解決辦法:開啟wms的http功能,在根節(jié)點(diǎn)上開啟。使用播放地址:mmsh://220.189.247.171/yswh,mmst播放有問題。
Next, follow the instructions in the following tutorial article:
How to publish and play a live stream (MPEG-TS based encoder)
See Also:
Note: The sample.mp4 file is about 6 minutes long. FFmpeg will stop when it hits the end of this file. So you may have to re-start FFmpeg several times during configuration and testing.
Note: The above FFmpeg command lines will produce a low bitrate, low complexity, low quality stream that should be playable on most playback devices and systems. The following is a higher quality version just to provide a glimpse of what VLC can do:
Code: ffmpeg -i "%WMSAPP_HOME%/content/sample.mp4" -re -vcodec libx264 -vpre default -vpre main -g 60 -vb 500000 -strict experimental -acodec aac -ab 128000 -ar 48000 -ac 2 -vbsf h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316 Note: FFmpeg can also be used to transcode a RTSP, native RTP or MPEG-TS stream. Simply change the first argument of each of the command lines (the path to the sample.mp4 file) to the desired source to be transcoded and remove the -re command line option. Here are a few examples:
Code: RTSP/RTP camera: MPEG-TS stream: Native RTP stream: Note: If you would like to host FFmpeg on a different machine as the server hosting Wowza Media Server, you can modify any of the command lines above by changingudp://127.0.0.1:10000 to the IP address of the server running Wowza Media Server 2 and any destination UDP port. Be sure the specified UDP port is open on any routers or firewalls between the server running VLC and the server running Wowza Server.
Note: FFmpeg can publish stream using other outgoing protocols such as RTMP and RTSP/RTP (QuickTime ANNOUNCE).
To send a stream using RTMP, change the destination portion of the FFmpeg URL:
Code: from: to: The format of the RTMP URL portion is:
Code: rtmp://[wowza-ip-address]/[application]/[streamName] To send a stream using RTSP/RTP, change the destination portion of the FFmpeg URL:
Code: from: to: The format of the RTMP URL portion is:
Code: rtsp://[wowza-ip-address]:1935/[application]/[streamName] ![]() |
|