闲置了一台2C2G50G 的云服务器,想着研究下直播,找到kplayer,具体就看这个教程就可以了:KPlayer文档
准备好云服务器,运行
curl -fsSL get.kplayer.net | bash
找到kplayer文件夹,编辑 config.json.example
把 config.json.example 替换成 config.json , 然后把内容换成以下的内容, 但是有两个地方需要注意,
lists 中的地址, 换成自己想要播放的视频的地址,
path 中的路径, 换成自己的推流链接
推流链接的获取地址如下,
找到推流入口文件, 然后替换 config.js 中的 path
{
"version": "2.0.0",
"resource": {
"lists": [
"/data/kplayer/mv.mp4",
"/data/kplayer/pingtan.mp4"
]
},
"play": {
"play_model": "loop"
},
"encode": {
"video_width": 1920,
"video_height": 1080,
"video_fps": 25,
"audio_channel_layout": 3,
"audio_sample_rate": 44100,
"bit_rate": 0,
"avg_quality": 0
},
"output": {
"lists": [
{
"path": "rtmp://31191.lps.aodianyun.com/lms_31191/lbmm7kmpr"
}
]
}
}
启动命令
./kplayer play start --daemon
使用后台 Daemon模式时,执行以下命令来结束 KPlayer 的后台运行
./kplayer play stop
毛桃博客








评论前必须登录!
注册