ishowcode.eth

ishowcode.eth

区块链小白

Live streaming tool Kplayer teaches you how to live stream on Bilibili 24/7.

Preparatory work before starting#

Linux server
(1) KPlayer currently only supports Linux environment and requires hardware environment with x86_64 (amd64) and aarch64 (arm64) CPU architectures. We have statically linked the relevant dependency libraries to the main program, which means you do not need to install any third-party libraries to support the operation of KPlayer. In subsequent iterative versions, cross-platform support will be provided for different CPU architectures and different operating systems.
(2) Here, you can rent a server from mainstream cloud platforms (Alibaba Cloud, Tencent Cloud), and the configuration does not need to be very high. 1 core and 2GB of RAM should be sufficient. You can also use a virtual machine locally as a server, but of course, your own computer must be on 24/7. This method can be used by some small partners who just want to try it out.

Download and install KPlayer#

  1. Prepare a folder to install KPlayer.
  2. Enter this folder.
wget http://download.bytelang.cn/kplayer-v0.5.6-linux_amd64.tar.gz
tar zxvf kplayer-v0.5.6-linux_amd64.tar.gz
  1. After decompression, the installation is complete. Use the following command to check.
./kplayer

Image

Prepare for Bilibili live streaming#

  1. Real-name authentication
    This is self-explanatory and very simple.
  2. Prepare the Bilibili streaming code
    Open the Bilibili website, click on "Live" on the homepage, click on the avatar to open the live streaming center, select "My Live Room", and you can view the streaming code (of course, you need to select a category and start the live streaming to see it, so wait for a moment here).
    Image
  3. Create a configuration file
cp config.json.example config.json

Use the cp command to make a copy of the configuration file.
Open the config.json file for editing.

{
    "version": "2.0.0",
    "resource": {
        "lists": [
            "/video/example_1.mp4",
            "/video/example_2.mp4"
        ]
    },
    "output": {
        "lists": [
            {
                "path": "rtmp://127.0.0.1:1935/push"
            }
        ]
    }

In the resource -> list section, configure the location of your videos. Note that you need to add a comma after each entry except the last one.
In the output -> list section, configure the streaming address.
Now you can select a category and start the live streaming. Then, concatenate the address and key marked by the dashed line in the above image, and copy it to the configuration file. The configuration file is ready.

Start KPlayer#

./kplayer play start
./kplayer play start --daemon

The above two are start commands. The following is the command for running in the background.

After successful execution, it will output a success log.
Image
After successful background execution, you can check the running log in the /kplayer/log/core.log file.

You can now go to your live room to watch.

Welcome to visit my live room: https://live.bilibili.com/26709867

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.