OSX下面用ffmpeg抓取桌面以及摄像头推流进行直播
在osx系统下通过ffmpeg查看设备
1 ffmpeg -f avfoundation -list_devices true -i ""
参考命令
ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0" -vcodec libx264 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/zbcs/room
ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0" -vcodec libx264 -acodec libfaac -f flv rtmp://localhost:1935/zbcs/room
ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0" \-c:v libx264 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/zbcs/room
ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0" -vcodec libx264 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/zbcs/room
ffmpeg -f avfoundation -framerate 30 -video_size 640x480 -i "0" -pixel_format nv12 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/zbcs/room
ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -i "0" -vf format=yuv444p,crop=426:240:507:339 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/zbcs/room
ffmpeg -f avfoundation -capture_cursor 1 -i 1:0 -r 30000/1001 -s 1280x800 -vsync 2 -c:v libvpx-vp9 -c:a libopus -b:v 1M -b:a 128K capture.webm -f flv rtmp://localhost:1935/zbcs/room
ffmpeg -f avfoundation -pixel_format uyvy422 -i "1" -f flv rtmp://localhost:1935/zbcs/room
//推流桌面 - 只有桌面内容
ffmpeg -f avfoundation -pixel_format uyvy422 -i "1" -f flv rtmp://192.168.10.61:1935/zbcs/room
ffmpeg -f avfoundation -i "1" -vcodec libx264 -preset ultrafast -acodec libfaac -f flv rtmp://192.168.10.61:1935/zbcs/room
//推流摄像头
ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -i "0" -vcodec libx264 -acodec libfaac -f flv rtmp://192.168.10.61:1935/zbcs/room
//只推流麦克风
ffmpeg -f avfoundation -i ":0" -vcodec libx264 -preset ultrafast -acodec libmp3lame -ar 44100 -ac 1 -f flv rtmp://192.168.10.61:1935/zbcs/room
//摄像头+麦克分
ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -i "0:0" -vcodec libx264 -preset ultrafast -acodec libmp3lame -ar 44100 -ac 1 -f flv rtmp://192.168.10.61:1935/zbcs/room
ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -i "0:0" -vsync 2 -vcodec libx264 -preset ultrafast -acodec libmp3lame -ar 44100 -ac 1 -b:v 1M -b:a 128K -f flv rtmp://192.168.10.61:1935/zbcs/room
参考文章:http://blog.csdn.net/arctan90/article/details/50828771