MCPcopy
hub / github.com/webadderallorg/Recordly / resolveNativeVideoEncoder

Function resolveNativeVideoEncoder

electron/ipc/export/native-video.ts:3945–3973  ·  view source on GitHub ↗
(
	ffmpegPath: string,
	encodingMode: NativeExportEncodingMode,
)

Source from the content-addressed store, hash-verified

3943}
3944
3945export async function resolveNativeVideoEncoder(
3946 ffmpegPath: string,
3947 encodingMode: NativeExportEncodingMode,
3948) {
3949 if (
3950 cachedNativeVideoEncoder?.ffmpegPath === ffmpegPath &&
3951 cachedNativeVideoEncoder?.encodingMode === encodingMode
3952 ) {
3953 return cachedNativeVideoEncoder.encoderName;
3954 }
3955
3956 const availableEncoders = await getAvailableNativeVideoEncoders(ffmpegPath);
3957 const candidates = [
3958 ...new Set([...getPreferredNativeVideoEncoders(process.platform), "libx264"]),
3959 ];
3960
3961 for (const encoderName of candidates) {
3962 if (!availableEncoders.has(encoderName)) {
3963 continue;
3964 }
3965
3966 if (await probeNativeVideoEncoder(ffmpegPath, encoderName, encodingMode)) {
3967 setCachedNativeVideoEncoder({ ffmpegPath, encodingMode, encoderName });
3968 return encoderName;
3969 }
3970 }
3971
3972 throw new Error("No usable FFmpeg encoder was available for native export");
3973}
3974
3975export function canCopyAudioCodecIntoMp4(codec?: string | null) {
3976 const normalized = (codec ?? "").trim().toLowerCase();

Callers 1

registerExportHandlersFunction · 0.90

Tested by

no test coverage detected