【FFMPEG】在MacBook Pro上用FFMPEG推rtmp流

上一篇讲了怎么在Mac上捕获桌面和摄像头,然后保存在文件里,这里单独说下如何推rtmp流。

我先用red5建了个服务,下了他的样例oflaDemo,然后运行下面的指令

./ffmpeg -f avfoundation -pixel_format uyvy422 -i "1" -f flv rtmp://localhost/oflaDemo/pid123456789


ffmpeg支持的rtmp协议可以查下

./ffmpeg -formats | grep 'flv'

有两种

 DE flv             FLV (Flash Video)

 D  live_flv        live RTMP FLV (Flash Video)

我跑live_flv,提示不支持 Requested output format 'live_flv' is not a suitable output format

只好改成flv

还会提示加像素格式,程序里面推荐使用uyvy422 所以我们再加上-pixel_format uyvy422 


最后是rtmp的格式

rtmp://localhost/oflaDemo/pid123456789

rtmp://域名/服务名/name 其中name是pid123456789这个是推流者自己定义的。


想停止捕获就在shell里面按q键。


=======================我是分割线==================================

官方文档里面,AVFoundation支持的输入选项如下:

-list_devices <TRUE|FALSE>

If set to true, a list of all available input devices is given showing all device names and indices.

-video_device_index <INDEX>

Specify the video device by its index. Overrides anything given in the input filename.

-audio_device_index <INDEX>

Specify the audio device by its index. Overrides anything given in the input filename.

-pixel_format <FORMAT>

Request the video device to use a specific pixel format. If the specified format is not supported, a list of available formats is given and the first one in this list is used instead. Available pixel formats are: monob, rgb555be, rgb555le, rgb565be, rgb565le, rgb24, bgr24, 0rgb, bgr0, 0bgr, rgb0, bgr48be, uyvy422, yuva444p, yuva444p16le, yuv444p, yuv422p16, yuv422p10, yuv444p10, yuv420p, nv12, yuyv422, gray

-framerate

Set the grabbing frame rate. Default is ntsc, corresponding to a frame rate of 30000/1001.

-video_size

Set the video frame size.

-capture_cursor

Capture the mouse pointer. Default is 0.

-capture_mouse_clicks

Capture the screen mouse clicks. Default is 0.


你可能感兴趣的:(直播)