·您当前的位置:首页 > 技术教程 > Wowza教程 >

[wowza]基于ffmpeg软件推流到wowza应用(ffmpeg与wowza的结合应用(2)

时间:2015-02-10 09:33酷播
Next, follow the instructions in the following tutorial article: How to publish and play a live stream (MPEG-TS based encoder) See Also: FFmpeg website FFmpeg Documentation Note: The sample.mp4 file

Next, follow the instructions in the following tutorial article:

How to publish and play a live stream (MPEG-TS based encoder)

See Also:

FFmpeg website

FFmpeg Documentation

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:
ffmpeg -i "rtsp://192.168.1.22/mycamera" -vcodec libx264 -vpre default -vpre baseline -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

MPEG-TS stream:
ffmpeg -i "udp://localhost:1234" -vcodec libx264 -vpre default -vpre baseline -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

Native RTP stream:
ffmpeg -i "unicast.sdp" -vcodec libx264 -vpre default -vpre baseline -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

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:
-f mpegts udp://127.0.0.1:10000?pkt_size=1316

to:
-f flv rtmp://127.0.0.1/live/myStream

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:
-f mpegts udp://127.0.0.1:10000?pkt_size=1316

to:
-f rtsp rtsp://127.0.0.1:1935/live/myStream.sdp

The format of the RTMP URL portion is:

Code:

rtsp://[wowza-ip-address]:1935/[application]/[streamName]

Click here, if you are having problems or would like to discuss this article.

Leave a comment below, if there is some aspect of this article you would like to see changed or improved
 

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器