Last active
July 29, 2023 19:32
-
-
Save jeasonstudio/914981b346746309828ae31ecda9264c to your computer and use it in GitHub Desktop.
Use FFmpeg rtmp streaming in macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# Diffusion bilibili live avec ffmpeg | |
# Make sure you have FFmpeg installed in your mac | |
# list avfoundation devices | |
ffmpeg -f avfoundation -list_devices true -i "" | |
# change the param after `-i` and `-f flv` | |
# use 140m mermory | |
ffmpeg \ | |
-f avfoundation \ | |
-re -i "2" \ | |
-vcodec libx264 \ | |
-preset ultrafast \ | |
-acodec aac \ | |
-ar 44100 \ | |
-ac 1 \ | |
-f flv "rtmp://example.com/path?key=xx" | |
# 560m mermory 90% cpu | |
ffmpeg \ | |
-f avfoundation \ | |
-video_size 1920x1080 \ | |
-framerate 30 \ | |
-i "2:0" -ac 2 \ | |
-vcodec libx264 -maxrate 2000k \ | |
-bufsize 2000k -acodec libmp3lame -ar 44100 -b:a 128k \ | |
-f flv "rtmp://example.com/path?key=xx" |
不行,直播间一直转圈圈,黑屏。
- frame= 149 fps=3.6 q=14.0 size= 14235kB time=00:00:38.53 bitrate=3026.2kbits/s speed=0.919x
frame= 384 fps=5.6 q=8.0 size= 22174kB time=00:01:05.60 bitrate=2769.0kbits/s speed=0.962x - frame= 659 fps= 26 q=30.0 size= 3231kB time=00:00:25.70 bitrate=1030.0kbits/s speed=1.01x
frame= 931 fps= 27 q=29.0 size= 4681kB time=00:00:35.16 bitrate=1090.4kbits/s speed=1.01x
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
0x00 Info
100%
左右, 内存占用 600m0x01 Usages
FFmpeg
自行 google可以看到
AVFoundation video devices
有三个, 分别是摄像头和两个屏幕, 前面的数字是代号;0x02 License