mirror of
https://github.com/ihmily/DouyinLiveRecorder.git
synced 2026-03-22 07:28:24 +08:00
Add docker configuration file
This commit is contained in:
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ffmpeg
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
56
README.md
56
README.md
@@ -2,6 +2,8 @@
|
||||
|
||||
## 💡简介
|
||||
[](https://www.python.org/downloads/release/python-3116/)
|
||||
[](https://github.com/ihmily/DouyinLiveRecorder)
|
||||
[](https://hub.docker.com/r/ihmily/douyinliverecorder)
|
||||

|
||||

|
||||
|
||||
@@ -104,7 +106,7 @@ AfreecaTV:
|
||||
https://play.afreecatv.com/sw7love/249471484
|
||||
```
|
||||
|
||||
直播间分享地址和网页端长地址都能正常进行录制(抖音尽量用长链接,避免因短链接转换失效导致不能正常录制)。
|
||||
直播间分享地址和网页端长地址都能正常进行录制(抖音尽量用长链接,避免因短链接转换失效导致不能正常录制,需要有nodejs环境,否则无法转换)。
|
||||
|
||||
</div>
|
||||
|
||||
@@ -130,7 +132,45 @@ GET https://hmily.vip/api/jx/live/convert.php?url=https://v.douyin.com/iQLgKSj/
|
||||
|
||||
在线播放m3u8和flv视频网站:[M3U8 在线视频播放器 ](https://jx.hmily.vip/play/)
|
||||
|
||||
 
|
||||
|
||||
## 🐋容器运行
|
||||
|
||||
首先确保已经安装了docker以及docker-compose,然后进入到项目文件夹,依次执行下面命令
|
||||
|
||||
1.构建镜像
|
||||
|
||||
```
|
||||
docker build -t douyin-live-recorder:2.0.7 .
|
||||
```
|
||||
|
||||
或者直接使用
|
||||
|
||||
```
|
||||
docker-compose build
|
||||
```
|
||||
|
||||
2.运行容器实例
|
||||
|
||||
运行之前确保URL配置文件中有直播间地址
|
||||
|
||||
```
|
||||
docker-compose -f docker-compose.yaml up
|
||||
```
|
||||
|
||||
可选 `-d` 在后台运行。第一次运行之后都可用 `docker-compose start` 启动已创建的容器。
|
||||
|
||||
3.停止容器实例
|
||||
|
||||
```
|
||||
docker-compose stop
|
||||
```
|
||||
|
||||
4.注意事项
|
||||
|
||||
①在docker容器内运行,请先在配置文件中添加要录制的直播间地址。②在容器内时,如果手动中断容器运行停止录制,会导致正在录制的视频文件损坏,所以一般不建议这么做。
|
||||
|
||||
如果想避免手动中断或者异常中断导致文件损坏的情况,请使用 `ts` 格式录制 (其他系统同理)。
|
||||
|
||||
 
|
||||
|
||||
@@ -142,15 +182,19 @@ GET https://hmily.vip/api/jx/live/convert.php?url=https://v.douyin.com/iQLgKSj/
|
||||
|
||||
## ⏳提交日志
|
||||
|
||||
- 20240102
|
||||
|
||||
- 修复Linux上运行,新增docker配置文件
|
||||
|
||||
- 20231210
|
||||
|
||||
|
||||
- 修复录制分段bug,修复bigo录制检测bug
|
||||
|
||||
|
||||
- 新增自定义修改录制主播名
|
||||
|
||||
|
||||
|
||||
|
||||
- 新增AfreecaTV直播录制,修复某些可能会发生的bug
|
||||
|
||||
|
||||
- 20231207
|
||||
|
||||
- 新增blued直播录制,修复YY直播录制,新增直播结束消息推送
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
排队读取网址时间(秒) = 0
|
||||
是否显示循环秒数 = 否
|
||||
分段录制是否开启 = 是
|
||||
视频分段时间(秒) = 3600
|
||||
视频分段时间(秒) = 1800
|
||||
生成时间文件 = 否
|
||||
TS录制完成后自动转为mp4格式 = 否
|
||||
TS录制完成后自动增加生成m4a格式 = 否
|
||||
|
||||
13
docker-compose.yaml
Normal file
13
docker-compose.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: douyin-live-recorder
|
||||
environment:
|
||||
- TERM=xterm-256color
|
||||
tty: true
|
||||
stdin_open: true
|
||||
build: .
|
||||
volumes:
|
||||
- .:/app
|
||||
restart: always
|
||||
25
main.py
25
main.py
@@ -4,8 +4,8 @@
|
||||
Author: Hmily
|
||||
GitHub: https://github.com/ihmily
|
||||
Date: 2023-07-17 23:52:05
|
||||
Update: 2023-12-10 22:03:56
|
||||
Copyright (c) 2023 by Hmily, All Rights Reserved.
|
||||
Update: 2024-01-02 05:57:10
|
||||
Copyright (c) 2023-2024 by Hmily, All Rights Reserved.
|
||||
Function: Record live stream video.
|
||||
"""
|
||||
|
||||
@@ -23,6 +23,7 @@ import time
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
import signal
|
||||
from spider import (
|
||||
get_douyin_stream_data,
|
||||
get_tiktok_stream_data,
|
||||
@@ -79,6 +80,12 @@ default_path = os.getcwd()
|
||||
|
||||
|
||||
# --------------------------用到的函数-------------------------------------
|
||||
def signal_handler(signal, frame):
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
|
||||
|
||||
def display_info():
|
||||
# TODO: 显示当前录制配置信息
|
||||
@@ -839,7 +846,6 @@ def start_record(url_tuple, count_variable=-1):
|
||||
ffmpeg_command.extend(command)
|
||||
_output = subprocess.check_output(ffmpeg_command, stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
# logging.warning(str(e.output))
|
||||
print(f"{e.output} 发生错误的行数: {e.__traceback__.tb_lineno}")
|
||||
@@ -863,7 +869,7 @@ def start_record(url_tuple, count_variable=-1):
|
||||
_output = subprocess.check_output(ffmpeg_command, stderr=subprocess.STDOUT)
|
||||
|
||||
if tsconvert_to_m4a:
|
||||
threading.Thread(target=converts_m4a, args=(file,)).start()
|
||||
threading.Thread(target=converts_m4a, args=(save_file_path,)).start()
|
||||
except subprocess.CalledProcessError as e:
|
||||
# logging.warning(str(e.output))
|
||||
print(f"{e.output} 发生错误的行数: {e.__traceback__.tb_lineno}")
|
||||
@@ -887,7 +893,7 @@ def start_record(url_tuple, count_variable=-1):
|
||||
_output = subprocess.check_output(ffmpeg_command, stderr=subprocess.STDOUT)
|
||||
|
||||
if tsconvert_to_m4a:
|
||||
threading.Thread(target=converts_m4a, args=(file,)).start()
|
||||
threading.Thread(target=converts_m4a, args=(save_file_path,)).start()
|
||||
except subprocess.CalledProcessError as e:
|
||||
# logging.warning(str(e.output))
|
||||
print(f"{e.output} 发生错误的行数: {e.__traceback__.tb_lineno}")
|
||||
@@ -926,11 +932,6 @@ def start_record(url_tuple, count_variable=-1):
|
||||
_output = subprocess.check_output(ffmpeg_command,
|
||||
stderr=subprocess.STDOUT)
|
||||
|
||||
if tsconvert_to_mp4:
|
||||
threading.Thread(target=converts_mp4, args=(file,)).start()
|
||||
if tsconvert_to_m4a:
|
||||
threading.Thread(target=converts_m4a, args=(file,)).start()
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
logging.warning(str(e.output))
|
||||
logger.warning(
|
||||
@@ -964,9 +965,9 @@ def start_record(url_tuple, count_variable=-1):
|
||||
_output = subprocess.check_output(ffmpeg_command, stderr=subprocess.STDOUT)
|
||||
|
||||
if tsconvert_to_mp4:
|
||||
threading.Thread(target=converts_mp4, args=(file,)).start()
|
||||
threading.Thread(target=converts_mp4, args=(save_file_path,)).start()
|
||||
if tsconvert_to_m4a:
|
||||
threading.Thread(target=converts_m4a, args=(file,)).start()
|
||||
threading.Thread(target=converts_m4a, args=(save_file_path,)).start()
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
# logging.warning(str(e.output))
|
||||
|
||||
Reference in New Issue
Block a user