笔记 MAC 上 nginx + rtmp的推流命令

Mac + nginx + rtmp

详见的推流命令,做备忘

把本地音视频推到流服务器
ffmpeg -re -i /Users/fengsh/Documents/ffmpeg/test.mp4 -c copy -f flv rtmp://localhost:1935/myapp/room

查看当前本本支持的摄像头设备情况
ffmpeg -f avfoundation -list_devices true -i ""

摄像头(不带麦)推流命令
ffmpeg -f avfoundation -pixel_format bgr0 -framerate 30 -video_size 640x480 -i  "0" -vcodec libx264 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/myapp/room


ffmpeg -f avfoundation -pixel_format uyvy422 -framerate 30 -video_size 640x480 -i "0" -c:v libx264 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/myapp/room

ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -i  "0"  -vf format=yuyv422,crop=800:200:100:50 -preset ultrafast -acodec libfaac -f flv rtmp://localhost:1935/myapp/room


这个是推啥的?
ffmpeg -f avfoundation -pixel_format uyvy422 -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/myapp/room

推录屏
ffmpeg -f avfoundation -pixel_format uyvy422 -i "1" -f flv rtmp://localhost:1935/myapp/room


只推麦
ffmpeg -f avfoundation -i ":0" -vcodec libx264 -preset ultrafast -acodec libmp3lame -ar 44100 -ac 1 -f flv rtmp://localhost:1935/myapp/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://localhost:1935/myapp/room



碰到下面的情况说明推流命令中要增加-pixel_format 选个支持的类型
Trailing options were found on the commandline.
[avfoundation @ 0x7fb2a7807000] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7fb2a7807000] Supported pixel formats:
[avfoundation @ 0x7fb2a7807000]   uyvy422
[avfoundation @ 0x7fb2a7807000]   yuyv422
[avfoundation @ 0x7fb2a7807000]   nv12
[avfoundation @ 0x7fb2a7807000]   0rgb
[avfoundation @ 0x7fb2a7807000]   bgr0
[avfoundation @ 0x7fb2a7807000] Overriding selected pixel format to use uyvy422 instead.


https://blog.csdn.net/lishenglong666/article/details/51906943
-b:v主要是控制平均码率
-vcodec 可简写为 -c:v //用来指定视频编码器如 h264
-acodec 可简写为 -c:a //用来指定音视编码器如 aac
crop=w:h:x:y         //如 crop=800:200:100:50  裁剪的宽为800,高为200,把整图左裁200,上裁50


libx264 的参数
-preset的值有ultrafast、superfast、veryfast、faster、fast、medium、slow、slower、veryslow、placebo。从快到慢,参数越来越EP。默认是medium


ffmpeg常见的命令https://www.cnblogs.com/frost-yen/p/5848781.html


阅读更多

没有更多推荐了,返回首页