Skip to content

Commit

Permalink
Update FAQ for SRS Stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 24, 2024
1 parent 0e4157a commit 78d5205
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
32 changes: 32 additions & 0 deletions i18n/zh-cn/docusaurus-plugin-content-pages/faq-srs-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* [How SRS Re-streams to Custom Platforms](#how-srs-restreams-to-custom-platforms): SRS如何转推自定义平台: SRS的多平台转推,如何推到自定义的直播平台。
* [Why and How to Limit the Bitrate of Virtual Live Events](#why-and-how-to-limit-the-bitrate-of-virtual-live-events): 为什么要限制虚拟直播的码率,如何解除限制。
* [How to Setup the Font Style for AI Transcript](#how-to-setup-the-font-style-for-ai-transcript): 如何设置AI自动字幕的字体样式。
* [How to Setup the Video Codec Parameters for AI Transcript](#how-to-setup-the-video-codec-parameters-for-ai-transcript): 如何设置AI自动字幕的视频转码参数。
* [How to Replace FFmpeg](#how-to-replace-ffmpeg): 如何更换FFmpeg: 如何更换SRS Stack中的FFmpeg为自定义版本。
* [Installation of SRS is Very Slow](#installation-of-srs-is-very-slow): 宝塔安装SRS非常慢: 海外用宝塔安装非常慢,访问阿里云镜像太慢。
* [How to Install the Latest SRS Stack](#how-to-install-the-latest-srs-stack): 宝塔如何安装最新的SRS Stack: 手动安装宝塔插件,安装最新的插件。
Expand Down Expand Up @@ -544,6 +545,37 @@ ffmpeg -i ~/git/srs/trunk/doc/source.flv \
> Note: 如果要使用其他`Fontname`,请从谷歌字体下载,并将字体文件挂载到SRS Docker的`/usr/local/share/fonts/`中。
## How to Setup the Video Codec Parameters for AI Transcript

要在视频流中叠加字幕,FFmpeg参数应该是:

```bash
ffmpeg \
-i input.ts -vf '{subtitles}' \
-c:v libx264 \ # Video codec and its parameters
-c:a aac \ # Audio codec and its parameters
-copyts -y output.ts
```

您可以在Web用户界面上设置视频编解码器及其参数,默认情况下可能是:

```bash
-c:v libx264 -profile:v main -preset:v medium -tune zerolatency -bf 0
```

所以最终的FFmpeg命令行是:

```bash
ffmpeg \
-i transcript/2-org-4f06f7a5-7f83-4845-9b4b-716ffec1bead.ts \
-vf subtitles=transcript/2-audio-a982892f-1d56-4b4a-a663-f3b7f1a5b548.srt:force_style='Alignment=2,MarginV=20' \
-c:v libx264 -profile:v main -preset:v medium -tune zerolatency -bf 0 \
-c:a aac -copyts \
-y transcript/2-overlay-2ba4154c-03ed-4853-bdda-d8396fcb1f47.ts
```

请注意,强烈建议使用`-bf 0`来禁用B帧,因为WebRTC不支持B帧。

## How to Replace FFmpeg

如果使用Docker版本,可以更换SRS Stack中的FFmpeg为自定义版本,启动时指定命令:
Expand Down
32 changes: 32 additions & 0 deletions src/pages/faq-srs-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Quick Content
* [How SRS Re-streams to Custom Platforms](#how-srs-restreams-to-custom-platforms): How SRS multi-platform re-streaming pushes to custom live platforms.
* [Why and How to Limit the Bitrate of Virtual Live Events](#why-and-how-to-limit-the-bitrate-of-virtual-live-events): Why and how to limit the bitrate of virtual live events.
* [How to Setup the Font Style for AI Transcript](#how-to-setup-the-font-style-for-ai-transcript): How to set up the font style for AI transcript.
* [How to Setup the Video Codec Parameters for AI Transcript](#how-to-setup-the-video-codec-parameters-for-ai-transcript): How to set up the video codec parameters for AI transcript.
* [How to Replace FFmpeg](#how-to-replace-ffmpeg): How to replace the FFmpeg in SRS Stack with a custom version.
* [Installation of SRS is Very Slow](#installation-of-srs-is-very-slow): Overseas aaPanel installation is very slow, access to Alibaba Cloud image is too slow.
* [How to Install the Latest SRS Stack](#how-to-install-the-latest-srs-stack): Manually install aaPanel plugin, install the latest plugin.
Expand Down Expand Up @@ -623,6 +624,37 @@ Here are the descriptions of frequently used parameters, for more details, pleas
> Note: If want to use other `Fontname`, please download from Google Font and mount font file to `/usr/local/share/fonts/` in the SRS Docker.
## How to Setup the Video Codec Parameters for AI Transcript

For overlaying the subtitle in video stream, the FFmpeg parameters should be:

```bash
ffmpeg \
-i input.ts -vf '{subtitles}' \
-c:v libx264 \ # Video codec and its parameters
-c:a aac \ # Audio codec and its parameters
-copyts -y output.ts
```

You are able to set the video codec and its parameters on the web UI, by default it is likely:

```bash
-c:v libx264 -profile:v main -preset:v medium -tune zerolatency -bf 0
```

So the final FFmpeg command line is:

```bash
ffmpeg \
-i transcript/2-org-4f06f7a5-7f83-4845-9b4b-716ffec1bead.ts \
-vf subtitles=transcript/2-audio-a982892f-1d56-4b4a-a663-f3b7f1a5b548.srt:force_style='Alignment=2,MarginV=20' \
-c:v libx264 -profile:v main -preset:v medium -tune zerolatency -bf 0 \
-c:a aac -copyts \
-y transcript/2-overlay-2ba4154c-03ed-4853-bdda-d8396fcb1f47.ts
```

Note that `-bf 0` is strongly recommended to disable B-frames, which is not supported by WebRTC.

## How to Replace FFmpeg

If you are using the Docker version, you can replace the FFmpeg in SRS Stack with a custom version by
Expand Down

0 comments on commit 78d5205

Please sign in to comment.