下载

下载kplayer

curl -fsSL [get.kplayer.net](<http://get.kplayer.net/>) | bash

cd kplayer查看文件, ls -l

-rw-r--r-- 1 root root 285 3月  23 18:23 config.json.example
-rwxr-xr-x 1 root root 27M 7月  29 11:12 kplayer

使用 ./kplayer 命令查看当前版本

配置

复制重命名配置文件:cp config.json.example config.json

修改配置:

{
    "version": "2.0.0",
    "resource": {
        "lists": [
            "/creammint/kplayer/movie/test2.mp4", #视频文件绝对路径
            "/creammint/kplayer/movie/test.mp4"
        ]
    },
    "output": {
        "lists": [
            {
		            #推流地址
                "path": "rtmp://live-push.bilivideo.com/live-bvc/?streamname=live_*********_********&key=**************&schedule=rtmp&pflag=1"
            }
        ]
    },
    ## 播放配置
    "play": {
        "fill_strategy": "ratio",
        ## 启用推流编码缓存,会生成缓存,命中缓存节约CPU资源
        "skip_invalid_resource": true,
        "cache_on": true,
         # 播放模式为按顺序且循环播放
        "play_model": "loop"
  }
}

#如果启动失败尝试删掉注释行

启动

运行kplayer:./kplayer play start

或后台运行(推荐):./kplayer play start --daemon

停止

查看正在运行的kplayer PID

ps aux | grep kplayer

杀掉进程

kill 22647


参考:https://blog.csdn.net/t2736416901/article/details/142311713

项目地址:https://github.com/bytelang/kplayer-go

在线文档:https://docs.kplayer.net/v0.5.8/