代码拉取完成,页面将自动刷新
同步操作将从 努力加贝/xplay 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
专为树莓派(Raspberry Pi)设计的多媒体播放器,支持(视频、音频、流媒体、图片、摄像头、动画、文本、二维码)
注意:这个开源项目免费提供 xplay 的控制端源码(暂时支持:python、golang),且免费提供 xplay 程序 ...
硬件 | 分辨率 | FPS | 测试 |
---|---|---|---|
Raspberry Pi Zero | 1080p/v720p | 30 | 已测试 |
Raspberry Pi 3A+ | 1080p/v720p | 30 | 已测试 |
Raspberry Pi 3B+ | 1080p/v720p | 30 | 已测试 |
Raspberry Pi 2B | 1080p/v720p | 30 | 未测试 |
Raspberry Pi 3B | 1080p/v720p | 30 | 未测试 |
Raspberry Pi 4B | GL1 Mode | 无 | 待适配 |
理论上支持所有树莓派,但是经过测试的树莓派只有上面几款
系统 | 日期 | 安装 | 测试 |
---|---|---|---|
Raspbian Buster with desktop | 2019-09-26 | buster/install | 已测试 |
Raspbian Buster Lite | 2019-09-26 | buster-lite/install | 已测试 |
1. 显存设置
文件 | 设置 |
---|---|
/boot/config.txt | gpu_mem=192 (显存内存分配不能少于192M)(重启生效) |
2. 安装程序
git clone https://github.com/nulijiabei/xplay.git
cd xplay/
cd buster/ # Raspbian Buster with desktop 或者 cd buster-lite/ # Raspbian Buster Lite
sh -x install
3. 运行程序
参数 | 默认 | 说明 |
---|---|---|
-R x,y,width,height | 0,0,1920,1080 | 分辨率设置 |
-fps n | 30 | 帧率设置 |
-noloop | 无 | 视频在播放到结尾时是否停留在最后一帧 |
-mute | 无 | 静音设置 |
-sample_rate n | 44100 | 音频采样频率设置 |
-cpuid | 无 | 显示CPUID |
// 分辨率 1920x1080 【默认】
// 帧率 30fps 【默认】
// 音频采样率 44100 【默认】
// 视频循环播放【默认】
// 播放声音【默认】
/usr/bin/xplay
// 分辨率设置 1280x720
// 音频采样率设置 48000
// 视频循环设置 视频在播放到结尾时停留在最后一帧
// 【未设置则使用默认设置】
/usr/bin/xplay -R 0,0,1280,720 -sample_rate 48000 -noloop
4. 播放测试
// 测试工具
apt-get install telnet
// 测试指令
root@raspberrypi:~# telnet 127.0.0.1 8700
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
// 指令内容
{
"libName": "video",
"params": {
"path": "/root/sample.mp4",
"width": 1920,
"height": 1080,
"zIndex": 10
},
"type": "play"
}
#End
5. 查看日志
tail -n 100 /dev/shm/xplay.log
指令类型(type) | 说明 |
---|---|
play | 播放 |
stop | 停止 |
素材类型(libName) | 说明 |
---|---|
video | 视频/流媒体 |
camera | 摄像头 |
pic | 图片 |
gif | 动画 |
qrcode | 二维码 |
text | 文本 |
// 指令说明
{
"id": "Z10_Play_1557737960000", // 唯一标记(自定义唯一标识)【非必填】
"type": "play", // 指令类型【必填】
"start": -1, // 开始时间(默认:-1,立即播放,本地毫秒时间戳)【非必填】
"libName": "video", // 素材类型(video、pic、camera、gif、qrcode、text)【必填】
"params": { // 参数集合【必填】
"zIndex": 10, // 层(支持多层播放,层数越小画面越靠前)【必填】
"path": "/root/sample.mp4", // 素材路径【必填】
"left": 0, // 距左像素(X轴)【非必填】
"top": 0, // 距顶像素(Y轴)【非必填】
"width": 1920, // 宽(素材显示的宽,非素材原始尺寸,支持缩放拉伸)【必填】
"height": 1080, // 高(素材显示的高,非素材原始尺寸,支持缩放拉伸)【必填】
"screen_mode": "landscape", // 屏幕模式(横屏:landscape,竖屏:portrait,默认横屏)【非必填】
"screen_rotate": 0 // 旋转角度(横屏角度:0、180,竖屏角度:90、270,默认横屏)【非必填】
}
}
#End // 指令结束【必填】
// 显示视频
{
"id": "Z10_Play_1557737960000",
"type": "play",
"start": -1,
"libName": "video",
"params": {
"zIndex": 10,
"path": "/root/sample.mp4",
"left": 0,
"top": 0,
"width": 1920,
"height": 1080,
"screen_mode": "landscape",
"screen_rotate": 0
}
}
#End
// 显示流媒体(暂时通过测试的只有http流)
{
"id": "Z10_Play_1557737960000",
"libName": "video",
"start": -1,
"type": "play",
"params": {
"path": "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8",
"height": 1080,
"width": 1920,
"left": 0,
"top": 0,
"screen_mode": "landscape",
"screen_rotate": 0,
"zIndex": 10
}
}
// 显示图片
{
"id": "Z10_Play_1556637960000",
"type": "play",
"start": -1,
"libName": "pic",
"params": {
"zIndex": 10,
"path": "/root/cat.jpg",
"top": 0,
"left": 0,
"height": 1080,
"width": 1920,
"screen_mode": "landscape",
"screen_rotate": 0
}
}
#End
// 显示摄像头
// 启用摄像头 raspi-config > Interfacing Options > P1 Camera
// "device": "/dev/video0" // 摄像头 设备地址
// "camera_width": 1280 // 摄像头 video_size 宽
// "camera_height": 720 // 摄像头 video_size 高
{
"id": "Z9_Play_1558837960000",
"type": "play",
"start": -1,
"libName": "camera",
"params": {
"zIndex": 9,
"device": "/dev/video0",
"camera_width": 1280,
"camera_height": 720,
"top": 0,
"left": 0,
"width": 1920,
"height": 1080,
"screen_mode": "landscape",
"screen_rotate": 0
}
}
#End
// 显示动画
{
"id": "Z9_Play_1554437960000",
"type": "play",
"start": -1,
"libName": "gif",
"params": {
"zIndex": 9,
"path": "/root/aaa.gif",
"top": 0,
"left": 0,
"height": 100,
"width": 100,
"screen_mode": "landscape",
"screen_rotate": 0
}
}
#End
// 显示文本
// 注意:文本使用层需要小于其它素材层(例如:视频或者图片素材使用10层那文本或其它悬浮层使用2-9层)
// 说明:文本使用的宽度需要大于内容实际长度(例如:文字长度50,显示宽度40,则Play失败)
// "content": "欢迎使用 xplay 多媒体播放器" // 文本内容
// "color": "rgba(0, 128, 0, 100%)" // 字体颜色及透明度
// "bgcolor": "rgba(0, 0, 0, 0%)" // 背景颜色及透明度
// "font_size": 14 // 字号
// "align": "center" // 排列方式
{
"type": "play",
"id": "Z9_Play_1572344489512",
"libName": "text",
"start": -1,
"params": {
"top": 0,
"left": 0,
"width": 300,
"height": 50,
"zIndex": 9,
"screen_rotate": 0,
"screen_mode": "landscape",
"content": "欢迎使用 xplay 多媒体播放器",
"color": "rgba(0, 128, 0, 100%)",
"bgcolor": "rgba(0, 0, 0, 0%)",
"font_size": 14,
"align": "center"
}
}
#End
// 显示二维码
{
"id": "Z9_Play_1558837960000",
"type": "play",
"start": -1,
"libName": "qrcode",
"params": {
"zIndex": 9,
"content": "http://www.danoonetwork.com",
"top": 0,
"left": 0,
"height": 100,
"width": 100,
"screen_mode": "landscape",
"screen_rotate": 0
}
}
#End
// 停止全部层
{
"type": "stop",
"params": {
"all": true
}
}
#End
// 停止指定层
{
"type": "stop",
"params": {
"ids": ["10", "11", "12"]
}
}
#End
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。