Skip to content

Commit

Permalink
[ffmpeg] drawtext
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhang-gh committed Dec 4, 2024
1 parent 35bd20c commit 5bcdc87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/software/ffmpeg.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,16 @@ ffmpeg -i input.mp4 -c copy -vn output.aac

## 添加文字

[`drawtext`](https://ffmpeg.org/ffmpeg-filters.html#drawtext-1) filter

```shell
style_str="fontfile=noto-sans.ttf:fontsize=36:fontcolor=white:shadowx=2:shadowy=2:shadowcolor=black"
ffmpeg -i input.mp4 -vf "drawtext=text='hello world':x=60:y=60:$style_str" -crf 16 output.mp4
```

- `text` 参数里还可以使用变量,比如 `text=%{n}` 表示帧号,起始为 0(由另一个参数 `start_number` 控制)
- `box` 参数可以给文字加背景框,`box=1:boxcolor=white@0.5:boxborderw=5`

## GPU

[Using FFmpeg with NVIDIA GPU Hardware Acceleration – NVIDIA Docs](https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html#quality-testing)
Expand Down

0 comments on commit 5bcdc87

Please sign in to comment.