Answers.Body: <p>Use GNU Parallel for encoding more than one at a time, since libtheora is not multithreaded.</p>
  <pre><code>parallel ffmpeg -v 24 -i {} -c:v libtheora -q:v 7 -vf &quot;scale=-2:720:flags=lanczos+accurate_rnd&quot; -c:a libvorbis -q:a 5 -ac 2 {.}.ogg ::: *.mkv
  </code></pre>
  <p>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).</p>
  <p>My test with a 20 second low-motion 720p shows the following for SSIM:</p>
  <pre><code>| 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 |
  </code></pre>
  <p>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 <em>half</em> the bitrate (AV1 at 1500k matched Theora at 3000k).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-05-06T04:13:44.833Z
Answers.LastActivityDate: 2024-05-06T05:31:32.693Z
Answers.LastEditDate: 2024-05-06T05:31:32.693Z
Answers.UserDisplayName: veppy
Answers.Body: <p>Try any AV1 on e.g. a 8 core 16Gb ram machine to discover how extremely slow it is. Even in ultrafast (worse quality).</p>
  <p>The conversion speed also depends on special settings and resolution.</p>
  <p>And yes theora is a bit of a mess with ffmpeg, in a linux bash script e.g. The confusion between ffmpeg2theora and -c:v libtheora for one. How to set the special theora settings etc...</p>
  <p>Another thing in our messed-up formats world is the aspect. 16:9 most common today. It wouldn't be what it is if also there is a formats problem/conflict there. There is 'standard', there is 'youtube', there is 'pure'. To be sure, to avoid any banding, I choose 'pure'. True 16:9 resolutions of 1.77:1 (divide width by height and you should get 1.77endless for a rightful 16:9 resolution). Width and height should also give a round number when you divide them each by the number 8.
  Examples: 640x360, 768x432, 1280x720.</p>
  <p>Needless to say that re-inventing formats, contributing to the WWW-videoconversionconfusion, helps the sales of chips and computer manufacturers as they expect you to buy heavier and heavier machines.</p>
  <p>If you want a modest, fast and still quality rich video file on the before mentioned 8 core 16Gb machine, I would go for something like x264 (24fps) crf 22 to 23, 640x360 (A) or x264 (24fps) crf 25 768x432 (B). Resolutions higher than the latter start making conversions slower and files bigger.</p>
  <p>x264 A will give a speed of 25 to 27x (subme=3), B a speed of 17 to 22x (subme=3).
  x265 half or a third of that speed and you will probably have to go for super- and ultrafast.
  AV1, a turtle on sleeping pills.
  Then there is vpx and theora...</p>
  <p>And how to use all those formats and aaaaall their settings in code/script, e.g. with ffmpeg, in a human friendly way...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-01T09:54:04.253Z
Answers.LastActivityDate: 2024-11-01T10:53:24.490Z
Answers.LastEditDate: 2024-11-01T10:53:24.490Z
Answers.UserDisplayName: suahuab
Body: <p>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.</p>
  
Tags: <ffmpeg><mac>
Title: How Do I Batch Convert to Ogg Theora with FFmpeg6?
UserDisplayName: MrXio
ThreadText: # How Do I Batch Convert to Ogg Theora with FFmpeg6?
  
  (Asked by: username_0 on 2023-10-06)
  
  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.
  
  **Tags:** ffmpeg, mac
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2024-05-06. Score: 1
  
  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).
  
  
  ---
  
  ### Answer by username_2 on 2024-11-01. Score: 0
  
  Try any AV1 on e.g. a 8 core 16Gb ram machine to discover how extremely slow it is. Even in ultrafast (worse quality).
  
  The conversion speed also depends on special settings and resolution.
  
  And yes theora is a bit of a mess with ffmpeg, in a linux bash script e.g. The confusion between ffmpeg2theora and -c:v libtheora for one. How to set the special theora settings etc...
  
  Another thing in our messed-up formats world is the aspect. 16:9 most common today. It wouldn't be what it is if also there is a formats problem/conflict there. There is 'standard', there is 'youtube', there is 'pure'. To be sure, to avoid any banding, I choose 'pure'. True 16:9 resolutions of 1.77:1 (divide width by height and you should get 1.77endless for a rightful 16:9 resolution). Width and height should also give a round number when you divide them each by the number 8.
  Examples: 640x360, 768x432, 1280x720.
  
  Needless to say that re-inventing formats, contributing to the WWW-videoconversionconfusion, helps the sales of chips and computer manufacturers as they expect you to buy heavier and heavier machines.
  
  If you want a modest, fast and still quality rich video file on the before mentioned 8 core 16Gb machine, I would go for something like x264 (24fps) crf 22 to 23, 640x360 (A) or x264 (24fps) crf 25 768x432 (B). Resolutions higher than the latter start making conversions slower and files bigger.
  
  x264 A will give a speed of 25 to 27x (subme=3), B a speed of 17 to 22x (subme=3).
  x265 half or a third of that speed and you will probably have to go for super- and ultrafast.
  AV1, a turtle on sleeping pills.
  Then there is vpx and theora...
  
  And how to use all those formats and aaaaall their settings in code/script, e.g. with ffmpeg, in a human friendly way...
  
  
  ---
  
  