https://github.com/itgoyo/ffmpeg-push
ffmpeg实现24小时不间断推流
https://github.com/itgoyo/ffmpeg-push
Last synced: 4 months ago
JSON representation
ffmpeg实现24小时不间断推流
- Host: GitHub
- URL: https://github.com/itgoyo/ffmpeg-push
- Owner: itgoyo
- Created: 2022-04-04T17:10:21.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-28T03:08:34.000Z (about 3 years ago)
- Last Synced: 2025-01-08T08:41:43.089Z (5 months ago)
- Size: 8.79 KB
- Stars: 78
- Watchers: 2
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 24h-Streaming
24小时推流直播推流的命令
```
ffmpeg -re -i 阳光电影www.ygdy8.com.侍神令.2021.HD.1080P.国语中英双字.mp4 -vcodec copy -acodec copy -f flv rtmp://192.168.123.144/live/Skn0AyEtO
```本地播放命令:
```
ffplay rtmp://127.0.0.1/live/Skn0AyEtO
```
```
tmux new-session -t itgoyotmux attach-session -t itgoyo
```无缝播放命令:
```
ffmpeg -re -f concat -safe 0 -i video.txt -vcodec copy -acodec copy -f flv rtmp://192.168.123.144/live/Skn0AyEtO
```但是上面的只能执行一次,我们需要循环执行,这样子就衍生出了下面这种方式
!!! **直播地址的双引号**很重要""```
#!/bin/bash
###
# @Description:自动循环推流脚本
# @Author: itgoyo
# @E-mail: [email protected]
# @Github: itgoyo
###while true
do
ffmpeg -re -f concat -safe 0 -i video.txt -vcodec copy -acodec copy -f flv "rtmp://live-push.bilivideo.com/live-bvc/?streamname=live_1276706key=0c32218670c24b8ea4bb8e45d1edule=rtmp&pflag=1"
done
```如果你想终止的话,以往的命令是终止不了的,只能先` ps -ef`,找到推流ffmpeg是那个端口,然后使用
`kill -9`端口来终止如果是在服务器上面的话,ps找不到后台运行的端口号的话,可以使用`ps -ef|grep nohup`或者使用`ps aux &`来查看,一般都是`ffmpeg`的端口号干掉就可以了

# 加水印
```
#!/bin/bash
###
# @Description:自动循环推流脚本
# @Author: itgoyo
# @E-mail: [email protected]
# @Github: itgoyo
###while true
do
ffmpeg -re -f concat -safe 0 -i video.txt -vf "movie=/Users/itgoyo/Downloads/logo.jpg [watermark]; [in][watermark] overlay=10:10 [out]" -c:v libx264 -c:a copy -f flv "rtmp://127.0.0.1/live/HyqY_aVDt"
done
```### .txt文本内容
格式如下,位置最好自己`pwd`,然后拼全,我这是因为放在了同一个根目录下
```
file 'magic_video1.mp4'
file 'magic_video2.mp4'
file 'magic_video3.mp4'
file 'magic_video4.mp4'
file 'magic_video5.mp4'
file 'magic_video6.mp4'
```