2022-10-23 13:35:43 +02:00
|
|
|
---
|
2022-10-23 14:11:44 +02:00
|
|
|
title: FFMPEG
|
2022-11-19 15:27:25 +01:00
|
|
|
visible: true
|
2022-10-23 13:35:43 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
[toc]
|
2023-02-23 14:48:51 +01:00
|
|
|
|
2022-10-23 13:35:43 +02:00
|
|
|
## List supported codecs and formats
|
|
|
|
|
2023-02-23 14:48:51 +01:00
|
|
|
`$ ffmpeg -codecs`
|
|
|
|
|
|
|
|
`$ ffmpeg -formats`
|
2022-10-23 13:35:43 +02:00
|
|
|
|
2022-10-23 14:32:53 +02:00
|
|
|
## Video Encoding
|
2023-02-23 14:48:51 +01:00
|
|
|
|
2022-10-23 13:35:43 +02:00
|
|
|
### H.264
|
|
|
|
|
2023-02-23 14:48:51 +01:00
|
|
|
> [H.264 Encoding Guide](https://trac.ffmpeg.org/wiki/Encode/H.264)
|
2022-10-23 13:35:43 +02:00
|
|
|
|
|
|
|
### AV1
|
2023-02-23 14:48:51 +01:00
|
|
|
|
|
|
|
> [AV1 Encoding Guide](https://trac.ffmpeg.org/wiki/Encode/AV1)
|
2022-10-23 13:56:17 +02:00
|
|
|
|
2022-10-23 14:32:53 +02:00
|
|
|
#### libaom
|
2023-02-23 14:48:51 +01:00
|
|
|
|
|
|
|
```sh
|
|
|
|
ffmpeg -i "/mnt/storage/MediaLibrary/input/Joker/test.mkv" -metadata title="Joker" -disposition 0 \
|
2022-10-23 13:56:17 +02:00
|
|
|
-c:v libaom-av1 -crf 23 -b:v 0 -cpu-used 6 -row-mt 1 -map 0:v:0 -metadata:s:v:0 title="Video" \
|
|
|
|
-c:a libopus -b:a 768k -ac:a 8 -map 0:a:0 -map 0:a:3 -metadata:s:a:0 title="English [7.1ch]" -metadata:s:a:0 language=eng -metadata:s:a:1 title="German [7.1ch]" -metadata:s:a:1 language=ger -disposition:a:0 default \
|
|
|
|
-c:s copy -map 0:s:0 -map 0:s:1 -metadata:s:s:0 title="English [PGS]" -metadata:s:s:0 language=eng -metadata:s:s:1 title="German [PGS]" -metadata:s:s:1 language=ger -disposition:s:0 default \
|
|
|
|
/mnt/storage/MediaLibrary/output/Joker/test-libaom-av1.mkv
|
|
|
|
```
|
|
|
|
|
2023-02-23 14:48:51 +01:00
|
|
|
Additional settings for increased speed and cpu usage:
|
|
|
|
|
2022-10-23 13:56:17 +02:00
|
|
|
```
|
|
|
|
-g 239: keyframes every ~10s (fps * 10)
|
|
|
|
-tiles 2x2: multiple parallel encoding tiles to speed up performance (4 in total here)
|
|
|
|
```
|
2023-02-23 14:48:51 +01:00
|
|
|
|
|
|
|
```sh
|
|
|
|
ffmpeg -i "/mnt/storage/MediaLibrary/input/Joker/test.mkv" -metadata title="Joker" -disposition 0 \
|
2022-10-23 13:56:17 +02:00
|
|
|
-c:v libaom-av1 -crf 23 -b:v 0 -cpu-used 6 -row-mt 1 -g 239 -tiles 2x2 -map 0:v:0 -metadata:s:v:0 title="Video" \
|
|
|
|
-c:a libopus -b:a 768k -ac:a 8 -map 0:a:0 -map 0:a:3 -metadata:s:a:0 title="English [7.1ch]" -metadata:s:a:0 language=eng -metadata:s:a:1 title="German [7.1ch]" -metadata:s:a:1 language=ger -disposition:a:0 default \
|
|
|
|
-c:s copy -map 0:s:0 -map 0:s:1 -metadata:s:s:0 title="English [PGS]" -metadata:s:s:0 language=eng -metadata:s:s:1 title="German [PGS]" -metadata:s:s:1 language=ger -disposition:s:0 default \
|
|
|
|
/mnt/storage/MediaLibrary/output/Joker/test-libaom-av1-tiling-keyframes.mkv
|
|
|
|
```
|
2022-10-23 14:23:22 +02:00
|
|
|
|
2022-10-23 14:32:53 +02:00
|
|
|
#### SVT-AV1
|
2023-02-23 14:48:51 +01:00
|
|
|
|
|
|
|
```sh
|
|
|
|
ffmpeg -i "/mnt/storage/MediaLibrary/input/Joker/test.mkv" -metadata title="Joker" -disposition 0 \
|
2022-10-23 14:38:04 +02:00
|
|
|
-c:v libsvtav1 -crf 23 -preset 8 -g 239 -map 0:v:0 -metadata:s:v:0 title="Video" \
|
|
|
|
-c:a libopus -b:a 768k -ac:a 8 -map 0:a:0 -map 0:a:3 -metadata:s:a:0 title="English [7.1ch]" -metadata:s:a:0 language=eng -metadata:s:a:1 title="German [7.1ch]" -metadata:s:a:1 language=ger -disposition:a:0 default \
|
|
|
|
-c:s copy -map 0:s:0 -map 0:s:1 -metadata:s:s:0 title="English [PGS]" -metadata:s:s:0 language=eng -metadata:s:s:1 title="German [PGS]" -metadata:s:s:1 language=ger -disposition:s:0 default \
|
|
|
|
/mnt/storage/MediaLibrary/output/Joker/test-libsvtav1-keyframes.mkv
|
2022-10-23 14:32:53 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Audio Encoding
|
2023-02-23 14:48:51 +01:00
|
|
|
|
2022-10-23 14:32:53 +02:00
|
|
|
> [High Quality Audio Encoding Guide](https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio)
|
|
|
|
|
2022-10-23 14:23:22 +02:00
|
|
|
## Video Quality
|
2023-02-23 14:48:51 +01:00
|
|
|
|
2022-10-23 14:23:22 +02:00
|
|
|
### VMAF
|
|
|
|
|
2023-02-23 14:48:51 +01:00
|
|
|
> [A practical guide for VMAF](https://medium.com/a-practical-guide-for-vmaf-481b4d420d9c)
|
|
|
|
|
|
|
|
_Note: The order of the input videos is important. Make sure to place the distorted video first_
|
|
|
|
|
|
|
|
```sh
|
|
|
|
ffmpeg -i (distorted) -i (original) -filter_complex libvmaf -f null -
|
|
|
|
```
|