Skip to content

Commit

Permalink
新增输出格式自定义配置
Browse files Browse the repository at this point in the history
  • Loading branch information
auqhjjqdo committed Apr 16, 2023
1 parent f3701ad commit 8625555
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install Dependencies
run: |
pip3 install --upgrade pip setuptools
pip3 install pyinstaller
pip3 install pyinstaller wheel
pip3 install -r requirements.txt
- name: Pyinstaller Build
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ python3 -m main.py

更多格式参照[streamlink代理文档](https://streamlink.github.io/cli/proxy.html)

### 输出格式配置

`format`的值为直播录制输出文件的封装格式(非编码格式),默认为`mp4`

支持所有ffmpeg的视频输出格式,详见[FFmpeg官方文档](https://ffmpeg.org/ffmpeg-formats.html#Muxers)

### 直播录制配置

按照示例修改`user`列表,注意逗号、引号和缩进
Expand Down Expand Up @@ -110,6 +116,6 @@ YouTube的频道ID一般是由`UC`开头的一段字符,由于YouTube可以自

默认将直播录制文件输出到运行目录的`output`文件夹

输出文件直接使用ffmpeg封装为`mp4`格式,音视频编码为直播平台直播流默认(一般视频编码为`H.264`,音频编码为`AAC`),录制清晰度为最高画质
输出文件默认直接使用ffmpeg封装为`mp4`格式,可通过配置文件自定义输出格式,音视频编码为直播平台直播流默认(一般视频编码为`H.264`,音频编码为`AAC`),录制清晰度为最高画质

输出文件名命名格式为`[年.月.日 时.分.秒][平台][主播名]直播标题.mp4`,日期时区为系统默认时区
输出文件名命名格式为`[年.月.日 时.分.秒][平台][主播名]直播标题.格式`,日期时区为系统默认时区
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"proxy": "http://127.0.0.1:7890",
"format": "mp4",
"user": [
{
"platform": "Bilibili",
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
class LiveRecoder:
def __init__(self, config: dict, user: dict):
self.proxy = config.get('proxy')
self.format = config.get('format', 'mp4')

self.id = user['id']
platform = user['platform']
Expand Down Expand Up @@ -124,7 +125,7 @@ def create_pipe(self, filename):
ffmpeg
.input('pipe:')
.output(
f'output/{filename}.mp4',
f'output/{filename}.{self.format}',
loglevel='warning',
codec='copy',
map_metadata=-1,
Expand Down

0 comments on commit 8625555

Please sign in to comment.