This commit is contained in:
eric
2023-05-03 01:30:09 +08:00
parent 2b742e6c12
commit c6a4f037a1
10 changed files with 115 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,106 @@
## ffmpeg实现直播推流
<img src="https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202305022018231.png" title="" alt="" width="153">
> 使用树莓派4B (raspberry pi)
直播推流,可以使用开源的`OBS`软件,跨平台,体验好,功能强大
<img src="https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202305022013241.jpg" title="" alt="" width="320">
也可以使用低功耗的arm开发板,用`ffmpeg`进行rtmp推流
这里使用的硬件
- 1.树莓派4B
- 2.usb免驱摄像头
使用usb摄像头是因为线材足够长,而`csi摄像头`长度有限制,且需要对应的兼容模块
---
## usb_camera测试
> 使用cheese和Video4linux
在使用ffmpeg之前,先确定摄像图能否驱动和实际效果
启动cheese
<img src="https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202305022013670.png" title="" alt="" width="377">
使用`Video4Linux2`
```
$ ffmpeg -i /dev/video0 -c:v rawvideo -pix_fmt yuv420p -f sdl "SDL output"
```
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202305022013758.png)
---
## 获取推流地址
> 主要是url和密匙
以油管为例子
<img src="https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202305022014851.png" title="" alt="" width="369">
ffmpeg最佳参数
```
$ ffmpeg -f v4l2 -i /dev/video0 \
-f alsa -i hw:0,0 \
-c:v libx264 -pix_fmt yuv420p -framerate 15 -g 30 -b:v 500k \
-c:a aac -b:a 128k -ar 44100 -ac 2 \
-preset ultrafast -tune zerolatency \
-f flv rtmp://a.rtmp.youtube.com/live2/a8rx-y9t2-vrxh-cy6p-a5v6
```
---
## 注意事项
> 油管推流,必须有音频
由于购买的usb摄像头,并没有麦克风
![](https://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202305022014706.jpg)
所以在使用ffmpeg进行live 推流的时候,需要设置音频配置项为`静音`
核心参数
```
-f lavfi -i anullsrc
```
---
## 最后
> 个人微信: `hackrobot`
创建了一个`微信群`供交流,欢迎加入
添加好友后,回复关键词: 加群
本文参数以及引用:
[How to Stream Video From Webcam to Network Using FFmpeg | Baeldung on Linux](https://www.baeldung.com/linux/ffmpeg-webcam-stream-video)

View File

@@ -10,6 +10,15 @@ encryptText 为对 用户唯一标识 加密后得到的结果 消息加解密
我们使用 APPID 和 EncodingAESKey 对 用户唯一标识 进行加密
```
查询参数
```
http_method=get
inputArguments=%E6%88%91%E7%88%B1%E4%BD%A0
```
---
从header里,获取uid [openid]

View File

@@ -4,26 +4,18 @@ orangepi5 微信机器人 加群=> vip
nanopi openwrt软路由
orange pi 3 lts 电销机器人/短信/闪信 | 各种bot
orange pi 3lts 直播rtmp/live [乌龟缸]
orange pi 3 lts [智能家居-网关] MQTT [传感器/浇水套件ESP32]
零刻 16g nextcloud
mini主机 8g 企业运维服务
mini主机 16g 小程序业务
其他
树莓派 kali linux

View File

@@ -12,8 +12,6 @@
单身的小伙伴通过户外运动认识异性,也比相亲局靠谱的多
周末可以一起轻松游玩`莲花山`,也可以一起探险`梧桐山`
不建议有心脏病,等其他身体机能不适宜的小伙伴参加
@@ -25,8 +23,6 @@
*组织方会为大家准备户外安全护理包
*沿途有少量便利店和自助售货机
> 微信群
加入交流群,多多参与活动报名接龙吧