- const videoStream = metadata.streams.find(s => s.codec_type === 'video')
- return res(videoStream.height)
- })
- })
+ return {
+ videoFileResolution: Math.min(videoStream.height, videoStream.width),
+ isPortraitMode: videoStream.height > videoStream.width
+ }
+}
+
+async function getVideoFileFPS (path: string) {
+ const videoStream = await getVideoFileStream(path)
+
+ for (const key of [ 'r_frame_rate' , 'avg_frame_rate' ]) {
+ const valuesText: string = videoStream[key]
+ if (!valuesText) continue
+
+ const [ frames, seconds ] = valuesText.split('/')
+ if (!frames || !seconds) continue
+
+ const result = parseInt(frames, 10) / parseInt(seconds, 10)
+ if (result > 0) return result
+ }
+
+ return 0