Skip to content

Instantly share code, notes, and snippets.

@jeasonstudio
Last active July 29, 2023 19:32
Show Gist options
  • Save jeasonstudio/914981b346746309828ae31ecda9264c to your computer and use it in GitHub Desktop.
Save jeasonstudio/914981b346746309828ae31ecda9264c to your computer and use it in GitHub Desktop.
Use FFmpeg rtmp streaming in macOS
#! /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"
@gMan1990
Copy link

不行,直播间一直转圈圈,黑屏。

  1. 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
  2. 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