From 3a149e9f8b2e99507c72792b80cee3a90df003b2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 22 Nov 2019 11:43:17 +0100 Subject: Add audio only transcoding tests --- server/lib/video-transcoding.ts | 55 +++++++++-------------------------------- 1 file changed, 11 insertions(+), 44 deletions(-) (limited to 'server/lib') diff --git a/server/lib/video-transcoding.ts b/server/lib/video-transcoding.ts index 9dd54837f..ab5200936 100644 --- a/server/lib/video-transcoding.ts +++ b/server/lib/video-transcoding.ts @@ -83,51 +83,18 @@ async function transcodeNewResolution (video: MVideoWithFile, resolution: VideoR const transcodeOptions = resolution === VideoResolution.H_NOVIDEO ? { - type: 'split-audio' as 'split-audio', - inputPath: videoInputPath, - outputPath: videoTranscodedPath, - resolution, - } + type: 'only-audio' as 'only-audio', + inputPath: videoInputPath, + outputPath: videoTranscodedPath, + resolution + } : { - type: 'video' as 'video', - inputPath: videoInputPath, - outputPath: videoTranscodedPath, - resolution, - isPortraitMode: isPortrait - } - - await transcode(transcodeOptions) - - return onVideoFileTranscoding(video, newVideoFile, videoTranscodedPath, videoOutputPath) -} - -/** - * Extract audio into a separate audio-only mp4. - */ -async function splitAudioFile (video: MVideoWithFile) { - const videosDirectory = CONFIG.STORAGE.VIDEOS_DIR - const transcodeDirectory = CONFIG.STORAGE.TMP_DIR - const extname = '.mp4' - const resolution = VideoResolution.H_NOVIDEO - - // We are sure it's x264 in mp4 because optimizeOriginalVideofile was already executed - const videoInputPath = join(videosDirectory, video.getVideoFilename(video.getOriginalFile())) - - const newVideoFile = new VideoFileModel({ - resolution, - extname, - size: 0, - videoId: video.id - }) - const videoOutputPath = join(CONFIG.STORAGE.VIDEOS_DIR, video.getVideoFilename(newVideoFile)) - const videoTranscodedPath = join(transcodeDirectory, video.getVideoFilename(newVideoFile)) - - const transcodeOptions = { - type: 'split-audio' as 'split-audio', - inputPath: videoInputPath, - outputPath: videoTranscodedPath, - resolution - } + type: 'video' as 'video', + inputPath: videoInputPath, + outputPath: videoTranscodedPath, + resolution, + isPortraitMode: isPortrait + } await transcode(transcodeOptions) -- cgit v1.2.3