Please wait...

小波Note

四川 · 成都市15 ℃
English

Mac Douyin Live Streaming

This article is optional language
成都Thu, March 20, 2025 at 11 PM3.50k123Estimated reading time 6 min
QR code
FavoriteCtrl + D

Solving the issue when Mac doesn't have Douyin Companion, making it impossible to livestream. Packet capturing may have some issues, and the stream key changes each time.
Therefore, you still need to prepare a Windows computer, or a virtual machine will also work.

Other solutions include using a capture card, but the cost is too high. For occasional use, it's not recommended.
You can also try NDI.

So directly use nginx to build an rtmp server, then use obs to stream.

You Need to Prepare a Linux Environment

CentOS download
Choose the 1GB version.

nginx download

nginx-rtmp-module download

The extracted nginx and nginx-rtmp-module-master need to be in the same directory.

Recommended to place them under /usr/local/src.

Compilation and Installation

Install Dependencies

bash
        yum install gcc
yum install pcre pcre-devel
yum install openssl openssl-devel
yum install zlib zlib-devel
yum -y install libxslt-devel
yum install gd gd-devel
yum install unzip

    

Compilation

bash
        ./configure --prefix=/xxx --with-http_ssl_module --add-module=../nginx-rtmp-module-master

make

make install

    

--prefix=/xxx specifies the installation directory, for example: /usr/local/app/nginx. When running:

  • Start: /usr/local/app/nginx/sbin/nginx
  • Stop: /usr/local/app/nginx/sbin/nginx -s stop
  • Restart: /usr/local/app/nginx/sbin/nginx -s reload

Nginx RTMP Configuration

nginx.conf
        worker_processes auto;
events {
    worker_connections 1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    server {
        listen 80;
        server_name localhost;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }
    }
}

rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application live {
            live on;
            record off;
        }
    }
}

    

Ports Need to Be Opened

bash
        firwall-cmd --zone=public --add-service=http --permanent
firwall-cmd --zone=public --add-port=1935/tcp --permanent
firwall-cmd --zone=public --add-port=1935/udp --permanent
firwall-cmd --reload

    

Mac Considerations

Ensure that Mac can access the nginx port. If you can access the address in a browser, there should be no problem.

Make sure obs has permission to access the local network.
mac

Start Streaming

Push and Pull Stream Addresses

  • Push stream address: rtmp://ip/live/room
  • Pull stream address: rtmp://ip/live/room

OBS Streaming Configuration

The stream key is just a name. You can write anything, but remember it as you'll need it later when pulling the stream.
obs

Douyin Companion

Select a scene -> Add material -> Choose online video -> Enter the RTMP address.

Result

douyin

Astral