织梦CMS - 轻松建站从此开始!

罗索

关于ffmpeg输入流crtmpserver参考的资料

落鹤生 发布于 2012-02-27 11:54 点击:次 
FFmpeg with Crtmp Server (MPEG-TS) http://www.wowzamedia.com/forums/content.php?213-FFmpeg-with-Wowza-Server - Step by step instructions for using FFmpeg as a live video/audio encoder with Crtmp Media Server 2. Updated for Crtmp Media Server 2.2.0 (
TAG:

FFmpeg with Crtmp Server (MPEG-TS)

 http://www.wowzamedia.com/forums/content.php?213-FFmpeg-with-Wowza-Server-

Step by step instructions for using FFmpeg as a live video/audio encoder with Crtmp Media Server 2.

Updated for Crtmp Media Server 2.2.0 (22 November 2010)

Updated for FFMpeg build r25705 (22 November 2010)

Note: Crtmp Media Systems provides these instructions on as "AS-IS" basis. FFmpeg is not a Crtmp 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 Crtmp Media Server 2. We will be re-streaming the sample file sample.mp4. The following tutorial is for Windows only. I used the most recent daily build of FFmpeg from this site:

http://ffmpeg.arrozcru.org/autobuilds/

FFmpeg Setup (Windows)

1.    In the root the C: drive create the following directory structure:

Code:

C:/usr/local/share/ffmpeg

Copy all the files from the presets folder of the FFmpeg package into this new directory.

2.    Open a command prompt and change directory to the FFmpeg bin folder.

3.    Enter the following FFmpeg command which will re-streaming the file sample.mp4 from the [install-dir]/content folder of the Crtmp Media Server 2 installation:

Code:

ffmpeg -i "%WMSAPP_HOME%/content/sample.mp4" -re -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


Next, follow the instructions in the following tutorial article:

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 Crtmp Media Server, you can modify any of the command lines above by changing udp://127.0.0.1:10000 to the IP address of the server running Crtmp 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 Crtmp 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://[crtmp-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://[crtmp-ip-address]:1935/[application]/[streamName]

(zorru)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201202/15763.html]
本文出处:百度博客 作者:zorru 原文
顶一下
(0)
0%
踩一下
(1)
100%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容