0

Good evening. I'm struggling to figure out a set of ffmpeg6 commands/flags for the following scenario: I have a large batch of 1080p 5.1ch lossless MKV's (courtesy of MakeMKV) that I want to encode to Ogg Theora specifically, downscale to 720p, 2ch audio, and both video and audio at a somewhat higher Q (quality) setting for both. Can anyone offer some direction? I am stuck on MacOS on a 2020 Intel Macbook Air, and no Linux or BSD distro can use the built in keyboard and trackpad so far as I can tell (believe me, I have tried many.) GUI tools like nch prism and miro produce poor quality, laggy video while ffmpeg6 does well, but I'd really like to encode more than one at a time. Thank you.

1 Answer 1

0

Use GNU Parallel for encoding more than one at a time, since libtheora is not multithreaded.

parallel ffmpeg -v 24 -i {} -c:v libtheora -q:v 7 -vf "scale=-2:720:flags=lanczos+accurate_rnd" -c:a libvorbis -q:a 5 -ac 2 {.}.ogg ::: *.mkv

Because you're using Theora, I'm guessing you want something compatible with older software that can read OGG, so I picked Vorbis for audio. This sets Theora quality to 7 (~3Mbps for a low-motion video I tested), Vorbis quality to 5 (160 kbps), downscales the video to 720p using the high-quality Lanczos rescaling algorithm, and downmixes the audio to stereo (I think this drops LFE though). All .mkv files in the current directory will be converted to .ogg files (without removing the originals).

My test with a 20 second low-motion 720p shows the following for SSIM:

| Quality | Bitrate | SSIM    |
-------------------------------
| -q:v 0  | 530k    | .940290 |
| -q:v 1  | 660k    | .952972 |
| -q:v 2  | 814k    | .963344 |
| -q:v 3  | 1025k   | .971422 |
| -q:v 4  | 1322k   | .978433 |
| -q:v 5  | 1649k   | .982819 |
| -q:v 6  | 2152k   | .986383 |
| -q:v 7  | 2983k   | .989660 |
| -q:v 8  | 3938k   | .990908 |
| -q:v 9  | 5095k   | .992417 |
| -q:v 10 | 6659k   | .993693 |

Do you have to use Theora? It's an ancient codec which has really poor compression efficiency. Almost anything will be better than it. It's not even competitive with H.264 baseline! Both Theora and Vorbis are based on ~25 year old technology. If you can use other algorithms but want to use free ones, then I would suggest AV1 for video (via libsvtav1) and Opus for audio (via libopus). In my own quick test, AV1 was only slightly slower to encode (just 10% slower) but it managed to match Theora's quality at only half the bitrate (AV1 at 1500k matched Theora at 3000k).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.