Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
ffmpeg tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed May 30, 2023
1 parent ef575f4 commit de98677
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/instanceserver/src/FFMPEG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ export const startFFMPEG = async (useAudio: boolean, useVideo: boolean, onExit:
// require on demand as not to unnecessary slow down instance server
if (!ffmpeg) throw new Error('FFmpeg not found')

let cmdInputPath = `${__dirname}/recording/input-vp8.sdp`
let cmdOutputPath = `${__dirname}/recording/output-ffmpeg-vp8.webm`
let cmdCodec = ''
let cmdFormat = '-f webm -flags +global_header'

// Ensure correct FFmpeg version is installed
const ffmpegOut = Process.execSync(ffmpeg + ' -version', {
encoding: 'utf8'
Expand All @@ -58,6 +53,13 @@ export const startFFMPEG = async (useAudio: boolean, useVideo: boolean, onExit:
throw new Error('FFmpeg >= 4.0.0 not found in $PATH; please install it')
}

/** Init codec & args */

let cmdInputPath = `${__dirname}/recording/input-vp8.sdp`
let cmdOutputPath = `${__dirname}/recording/output-ffmpeg-vp8.webm`
let cmdCodec = ''
let cmdFormat = '-f webm -flags +global_header'

if (useAudio) {
cmdCodec += ' -map 0:a:0 -c:a copy'
}
Expand All @@ -78,7 +80,8 @@ export const startFFMPEG = async (useAudio: boolean, useVideo: boolean, onExit:
const cmdArgStr = [
'-nostdin',
'-protocol_whitelist file,rtp,udp',
'-analyzeduration 3000000',
'-analyzeduration 10M',
'-probesize 10M',
'-fflags +genpts',
`-i ${cmdInputPath}`,
cmdCodec,
Expand Down

0 comments on commit de98677

Please sign in to comment.