Zum Inhalt springen

Einstieg

GitHub

Sie können unsere KI-gestützte Einrichtung verwenden, um das Plugin zu installieren. Fügen Sie den Capgo-Fähigkeiten Ihrer KI-Werkzeug mit folgendem Befehl hinzu:

Terminal-Fenster
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Verwenden Sie dann folgende Anfrage:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-ffmpeg` plugin in my project.

Wenn Sie die manuelle Einrichtung bevorzugen, installieren Sie das Plugin, indem Sie die folgenden Befehle ausführen und die unten aufgeführten plattform-spezifischen Anweisungen befolgen:

Terminal-Fenster
bun add @capgo/capacitor-ffmpeg
bunx cap sync
import { CapacitorFFmpeg } from '@capgo/capacitor-ffmpeg';

Gibt die maschinenlesbare Fähigkeitsmatrix für die aktuelle Plattform zurück.

import { CapacitorFFmpeg } from '@capgo/capacitor-ffmpeg';
await CapacitorFFmpeg.getCapabilities();

Ein Video-Rekodierungsauftrag in der Warteschlange einlegen.

Bei iOS löst sich die zurückgegebene Promise, wenn die native Schicht den Auftrag akzeptiert hat. Die endgültige Erfolg oder Misserfolg wird über die progress Hörer.

Android und Web lehnen derzeit ab mit UNIMPLEMENTED.

import { CapacitorFFmpeg } from '@capgo/capacitor-ffmpeg';
await CapacitorFFmpeg.reencodeVideo({} as ReencodeVideoOptions);

Ein stillgelegtes Bild in eine andere Dateiformat umwandeln.

iOS unterstützt derzeit jpeg und .png. Android unterstützt derzeit .webp, jpeg, und .png. Web lehnt derzeit ab mit UNIMPLEMENTED.

import { CapacitorFFmpeg } from '@capgo/capacitor-ffmpeg';
await CapacitorFFmpeg.convertImage({} as ConvertImageOptions);

Convertieren Sie Audio in eine andere Container- oder Codec-Datei.

iOS unterstützt derzeit m4a. Android und Web lehnen derzeit mit UNIMPLEMENTED.

import { CapacitorFFmpeg } from '@capgo/capacitor-ffmpeg';
await CapacitorFFmpeg.convertAudio({} as ConvertAudioOptions);
export interface FFmpegCapabilitiesResult {
platform: string;
features: FFmpegCapabilitiesFeatures;
}
export interface ReencodeVideoOptions {
inputPath: string;
outputPath: string;
width: number;
height: number;
bitrate?: number;
}
export interface FFmpegAcceptedJob {
jobId: string;
status: 'queued';
}
export interface ConvertImageOptions {
inputPath: string;
outputPath: string;
format: ImageOutputFormat;
/**
* Compression quality in the inclusive range `0.0..1.0`.
*
* Native platforms reject values outside that range.
*/
quality?: number;
}
export interface ConvertImageResult {
outputPath: string;
format: ImageOutputFormat;
}
export interface ConvertAudioOptions {
inputPath: string;
outputPath: string;
format: AudioOutputFormat;
}
export interface ConvertAudioResult {
outputPath: string;
format: AudioOutputFormat;
}
export interface FFmpegProgressEvent {
jobId: string;
/**
* Normalized progress as a floating-point value in the inclusive range `0.0..1.0`.
*/
progress: number;
state: FFmpegProgressState;
message?: string;
outputPath?: string;
/**
* Legacy alias kept for compatibility while callers migrate to `jobId`.
*/
fileId?: string;
}
export interface PluginVersionResult {
version: string;
}
export interface FFmpegCapabilitiesFeatures {
getPluginVersion: FFmpegCapability;
getCapabilities: FFmpegCapability;
reencodeVideo: FFmpegCapability;
convertImage: FFmpegCapability;
convertAudio?: FFmpegCapability;
progressEvents: FFmpegCapability;
probeMedia: FFmpegCapability;
generateThumbnail: FFmpegCapability;
extractAudio: FFmpegCapability;
remux: FFmpegCapability;
trim: FFmpegCapability;
}
export type ImageOutputFormat = '.webp' | 'jpeg' | '.png';
export type AudioOutputFormat = 'm4a';

Diese Seite wird aus dem Plugin generiert. src/definitions.tsRe-run die Synchronisierung, wenn die öffentliche API upstream ändert.

Wenn Sie Einstieg um das Dashboard und API-Operationen zu planen, verbinden Sie es mit Mit @capgo/capacitor-ffmpeg für die native Fähigkeit in Mit @capgo/capacitor-ffmpeg, API-Übersicht für die Implementierungsdetails in API-Übersicht, Einführung für die Implementierungsdetails in Einführung, API-Schlüssel für die Implementierungsdetails in API-Schlüssel, und Geräte für die Implementierungsdetails in Geräten.