Optimize video thumbnail generation
Process images in worker threads Reduce ffmpeg calls
@@ -1,3 +1,4 @@
|
||||
import { FfprobeData } from 'fluent-ffmpeg'
|
||||
import { FFmpegCommandWrapper, FFmpegCommandWrapperOptions } from './ffmpeg-command-wrapper.js'
|
||||
import { getVideoStreamDuration } from './ffprobe.js'
|
||||
|
||||
@@ -38,10 +39,11 @@ export class FFmpegImage {
|
||||
async generateThumbnailFromVideo (options: {
|
||||
fromPath: string
|
||||
output: string
|
||||
ffprobe?: FfprobeData
|
||||
}) {
|
||||
const { fromPath, output } = options
|
||||
const { fromPath, output, ffprobe } = options
|
||||
|
||||
let duration = await getVideoStreamDuration(fromPath)
|
||||
let duration = await getVideoStreamDuration(fromPath, ffprobe)
|
||||
if (isNaN(duration)) duration = 0
|
||||
|
||||
this.commandWrapper.buildCommand(fromPath)
|
||||
|
||||
BIN
packages/tests/fixtures/thumbnail-playlist.jpg
vendored
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
BIN
packages/tests/fixtures/video_short.mp4.jpg
vendored
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
BIN
packages/tests/fixtures/video_short.ogv.jpg
vendored
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
BIN
packages/tests/fixtures/video_short.webm.jpg
vendored
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
BIN
packages/tests/fixtures/video_short1.webm.jpg
vendored
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.2 KiB |
BIN
packages/tests/fixtures/video_short2.webm.jpg
vendored
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
BIN
packages/tests/fixtures/video_short3.webm.jpg
vendored
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
@@ -652,7 +652,7 @@ describe('Test video playlists', function () {
|
||||
let video3: string
|
||||
|
||||
before(async function () {
|
||||
this.timeout(60000)
|
||||
this.timeout(120000)
|
||||
|
||||
groupUser1 = [ Object.assign({}, servers[0], { accessToken: userTokenServer1 }) ]
|
||||
groupWithoutToken1 = [ Object.assign({}, servers[0], { accessToken: undefined }) ]
|
||||
|
||||