2021-11-18 07:35:08 -06:00
|
|
|
import { VideoResolution } from '../file/video-resolution.enum'
|
2021-01-28 08:52:44 -06:00
|
|
|
|
|
|
|
// Types used by plugins and ffmpeg-utils
|
|
|
|
|
2021-08-06 06:35:25 -05:00
|
|
|
export type EncoderOptionsBuilderParams = {
|
2021-01-28 08:52:44 -06:00
|
|
|
input: string
|
2021-08-06 06:35:25 -05:00
|
|
|
|
2021-01-28 08:52:44 -06:00
|
|
|
resolution: VideoResolution
|
2021-08-06 06:35:25 -05:00
|
|
|
|
2022-02-11 03:51:33 -06:00
|
|
|
// If PeerTube applies a filter, transcoding profile must not copy input stream
|
|
|
|
canCopyAudio: boolean
|
|
|
|
canCopyVideo: boolean
|
|
|
|
|
|
|
|
fps: number
|
2021-08-06 06:35:25 -05:00
|
|
|
|
|
|
|
// Could be undefined if we could not get input bitrate (some RTMP streams for example)
|
|
|
|
inputBitrate: number
|
|
|
|
inputRatio: number
|
|
|
|
|
|
|
|
// For lives
|
2021-01-28 08:52:44 -06:00
|
|
|
streamNum?: number
|
2021-08-06 06:35:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export type EncoderOptionsBuilder = (params: EncoderOptionsBuilderParams) => Promise<EncoderOptions> | EncoderOptions
|
2021-01-28 08:52:44 -06:00
|
|
|
|
|
|
|
export interface EncoderOptions {
|
|
|
|
copy?: boolean // Copy stream? Default to false
|
|
|
|
|
2021-04-09 03:36:21 -05:00
|
|
|
scaleFilter?: {
|
|
|
|
name: string
|
|
|
|
}
|
|
|
|
|
2021-04-03 16:51:37 -05:00
|
|
|
inputOptions?: string[]
|
|
|
|
outputOptions?: string[]
|
2021-01-28 08:52:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// All our encoders
|
|
|
|
|
|
|
|
export interface EncoderProfile <T> {
|
|
|
|
[ profile: string ]: T
|
|
|
|
|
|
|
|
default: T
|
|
|
|
}
|
|
|
|
|
|
|
|
export type AvailableEncoders = {
|
|
|
|
available: {
|
|
|
|
live: {
|
|
|
|
[ encoder: string ]: EncoderProfile<EncoderOptionsBuilder>
|
|
|
|
}
|
|
|
|
|
|
|
|
vod: {
|
|
|
|
[ encoder: string ]: EncoderProfile<EncoderOptionsBuilder>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
encodersToTry: {
|
|
|
|
vod: {
|
|
|
|
video: string[]
|
|
|
|
audio: string[]
|
|
|
|
}
|
|
|
|
|
|
|
|
live: {
|
|
|
|
video: string[]
|
|
|
|
audio: string[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|