From a8537c622ed8ff58b26a74a8d86e7c5b890f8af2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Jan 2021 15:31:31 +0100 Subject: [PATCH] Use veryfast preset for default transcoding profile --- server/lib/video-transcoding-profiles.ts | 2 ++ server/tests/plugins/plugin-transcoding.ts | 4 ++-- shared/extra-utils/videos/videos.ts | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/lib/video-transcoding-profiles.ts b/server/lib/video-transcoding-profiles.ts index 76d38b6ca..b7f9178c4 100644 --- a/server/lib/video-transcoding-profiles.ts +++ b/server/lib/video-transcoding-profiles.ts @@ -28,6 +28,7 @@ const defaultX264VODOptionsBuilder: EncoderOptionsBuilder = async ({ input, reso return { outputOptions: [ + `-preset veryfast`, `-r ${fps}`, `-maxrate ${targetBitrate}`, `-bufsize ${targetBitrate * 2}` @@ -40,6 +41,7 @@ const defaultX264LiveOptionsBuilder: EncoderOptionsBuilder = async ({ resolution return { outputOptions: [ + `-preset veryfast`, `${buildStreamSuffix('-r:v', streamNum)} ${fps}`, `${buildStreamSuffix('-b:v', streamNum)} ${targetBitrate}`, `-maxrate ${targetBitrate}`, diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 90ef01b92..ecea21e69 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts @@ -203,10 +203,10 @@ describe('Test transcoding plugins', function () { it('Should use the new vod encoders', async function () { this.timeout(240000) - const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video' })).uuid + const videoUUID = (await uploadVideoAndGetId({ server, videoName: 'video', fixture: 'video_short_240p.mp4' })).uuid await waitJobs([ server ]) - const path = buildServerDirectory(server, join('videos', videoUUID + '-720.mp4')) + const path = buildServerDirectory(server, join('videos', videoUUID + '-240.mp4')) const audioProbe = await getAudioStream(path) expect(audioProbe.audioStream.codec_name).to.equal('opus') diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index 392eddcc5..110552c77 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts @@ -641,10 +641,12 @@ async function uploadVideoAndGetId (options: { nsfw?: boolean privacy?: VideoPrivacy token?: string + fixture?: string }) { const videoAttrs: any = { name: options.videoName } if (options.nsfw) videoAttrs.nsfw = options.nsfw if (options.privacy) videoAttrs.privacy = options.privacy + if (options.fixture) videoAttrs.fixture = options.fixture const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs) -- 2.41.0