Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

ffmpeg auto thread

Jorropo991feec9a3f3
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index c77249a028..2edfb267e8 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -29,6 +29,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
{ value: 50 * 1024 * 1024 * 1024, label: '50GB' }
]
transcodingThreadOptions = [
+ { value: 0, label: 'auto (not optimized)' },
{ value: 1, label: '1' },
{ value: 2, label: '2' },
{ value: 4, label: '4' },
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index f0e2c0af57..c170fc1a89 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -86,8 +86,10 @@ function transcode (options: TranscodeOptions) {
return new Promise<void>(async (res, rej) => {
let command = ffmpeg(options.inputPath, { 'niceness': FFMPEG_NICE.TRANSCODING })
.output(options.outputPath)
- .outputOption('-threads ' + CONFIG.TRANSCODING.THREADS)
.preset(standard)
+ if (CONFIG.TRANSCODING.THREADS > 0) {
+ command.outputOption('-threads ' + CONFIG.TRANSCODING.THREADS) // if we don't set any threads ffmpeg will chose automatically
+ }
let fps = await getVideoFileFPS(options.inputPath)
if (options.resolution !== undefined) {