Page MenuHomePhorge

D14474.1768466712.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D14474.1768466712.diff

diff --git a/lib/media/video-utils.js b/lib/media/video-utils.js
--- a/lib/media/video-utils.js
+++ b/lib/media/video-utils.js
@@ -137,22 +137,6 @@
return { action: 'process', thumbnailPath, outputPath, ffmpegCommand };
}
-function getHasMultipleFramesProbeCommand(path: string): string {
- const ffprobeCommand =
- '-v error ' +
- '-count_frames ' +
- '-select_streams v:0 ' +
- '-show_entries stream=nb_read_frames ' +
- '-of default=nokey=1:noprint_wrappers=1 ' +
- '-read_intervals "%+#2" ' +
- path;
- return ffprobeCommand;
-}
-
const videoDurationLimit = 3; // in minutes
-export {
- getVideoProcessingPlan,
- getHasMultipleFramesProbeCommand,
- videoDurationLimit,
-};
+export { getVideoProcessingPlan, videoDurationLimit };
diff --git a/native/media/ffmpeg.js b/native/media/ffmpeg.js
--- a/native/media/ffmpeg.js
+++ b/native/media/ffmpeg.js
@@ -1,15 +1,10 @@
// @flow
-import {
- FFmpegKit,
- FFprobeKit,
- FFmpegKitConfig,
-} from 'ffmpeg-kit-react-native';
+import { FFmpegKit, FFmpegKitConfig } from 'ffmpeg-kit-react-native';
-import { getHasMultipleFramesProbeCommand } from 'lib/media/video-utils.js';
import type { FFmpegStatistics, VideoInfo } from 'lib/types/media-types.js';
-import { getVideoInfo } from '../utils/media-module.js';
+import { getVideoInfo, hasMultipleFrames } from '../utils/media-module.js';
const maxSimultaneousCalls = {
process: 1,
@@ -144,18 +139,9 @@
}
hasMultipleFrames(path: string): Promise<boolean> {
- const wrappedCommand = () => FFmpeg.innerHasMultipleFrames(path);
+ const wrappedCommand = () => hasMultipleFrames(path);
return this.queueCommand('probe', wrappedCommand);
}
-
- static async innerHasMultipleFrames(path: string): Promise<boolean> {
- const session = await FFprobeKit.execute(
- getHasMultipleFramesProbeCommand(path),
- );
- const probeOutput = await session.getOutput();
- const numFrames = parseInt(probeOutput);
- return numFrames > 1;
- }
}
const ffmpeg: FFmpeg = new FFmpeg();
diff --git a/native/utils/media-module.js b/native/utils/media-module.js
--- a/native/utils/media-module.js
+++ b/native/utils/media-module.js
@@ -12,8 +12,13 @@
const MediaModule: {
+getVideoInfo: (path: string) => Promise<VideoInfo>,
+ +hasMultipleFrames: (path: string) => Promise<boolean>,
} = requireNativeModule('MediaModule');
export function getVideoInfo(path: string): Promise<VideoInfo> {
return MediaModule.getVideoInfo(path);
}
+
+export function hasMultipleFrames(path: string): Promise<boolean> {
+ return MediaModule.hasMultipleFrames(path);
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 15, 8:45 AM (10 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5937005
Default Alt Text
D14474.1768466712.diff (2 KB)

Event Timeline