mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Don't block video update on storyboard generation
This commit is contained in:
parent
e8ac84f1b3
commit
8ab6f23a00
4 changed files with 14 additions and 10 deletions
|
@ -6,6 +6,7 @@ import {
|
|||
EncoderProfile,
|
||||
SimpleLogger
|
||||
} from '@peertube/peertube-models'
|
||||
import { MutexInterface } from 'async-mutex'
|
||||
import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
|
||||
|
||||
export interface FFmpegCommandWrapperOptions {
|
||||
|
@ -82,7 +83,7 @@ export class FFmpegCommandWrapper {
|
|||
this.command = undefined
|
||||
}
|
||||
|
||||
buildCommand (input: string) {
|
||||
buildCommand (input: string, inputFileMutexReleaser?: MutexInterface.Releaser) {
|
||||
if (this.command) throw new Error('Command is already built')
|
||||
|
||||
// We set cwd explicitly because ffmpeg appears to create temporary files when trancoding which fails in read-only file systems
|
||||
|
@ -96,6 +97,12 @@ export class FFmpegCommandWrapper {
|
|||
this.command.outputOption('-threads ' + this.threads)
|
||||
}
|
||||
|
||||
if (inputFileMutexReleaser) {
|
||||
this.command.on('start', () => {
|
||||
setTimeout(() => inputFileMutexReleaser(), 1000)
|
||||
})
|
||||
}
|
||||
|
||||
return this.command
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue