+async function canDoQuickTranscode (path: string) {
+ // NOTE: This could be optimized by running ffprobe only once (but it runs fast anyway)
+ const videoStream = await getVideoStreamFromFile(path)
+ const parsedAudio = await audio.get(path)
+ const fps = await getVideoFileFPS(path)
+ const bitRate = await getVideoFileBitrate(path)
+ const resolution = await getVideoFileResolution(path)
+
+ // check video params
+ if (videoStream[ 'codec_name' ] !== 'h264')
+ return false
+ if (fps < VIDEO_TRANSCODING_FPS.MIN || fps > VIDEO_TRANSCODING_FPS.MAX)
+ return false
+ if (bitRate > getMaxBitrate(resolution.videoFileResolution, fps, VIDEO_TRANSCODING_FPS))
+ return false
+
+ // check audio params (if audio stream exists)
+ if (parsedAudio.audioStream) {
+ if (parsedAudio.audioStream[ 'codec_name' ] !== 'aac')
+ return false
+ const maxAudioBitrate = audio.bitrate[ 'aac' ](parsedAudio.audioStream[ 'bit_rate' ])
+ if (maxAudioBitrate != -1 && parsedAudio.audioStream[ 'bit_rate' ] > maxAudioBitrate)
+ return false
+ }
+
+ return true
+}
+