-
Notifications
You must be signed in to change notification settings - Fork 18
FFmpeg
FFmpeg object's are obtained from FFmpegFactory.CreateFFmpeg()
Example:
var ff = FFmpegFactory.CreateFFmpeg();
Indicates Whether FFMpeg core wasm loaded or not
Examples:(razor)
var isLoaded=ff.IsLoaded;
Download pure Wasm On Client side around ~25 MB , for 1st time
Arguments:
-
triggerEvent
whether to trigger events like progress at object level or not, if false FFmpegFactory.Progress can give progress ratio
Examples:
await ff.Load();
//or
ff.Progress+=(p)=>Console.WriteLine(p.Ratio);
await ff.Load(true); //true triggers event at instance level
-
Logger
an event to get log messages, a quick example isff.Logger+=(e) => console.WriteLine(e.message);
-
Progress
a event to trace the progress, a quick example isff.Progress+=(p) => Console.Writeline(p);
This is the major function in ffmpeg.wasm, you can just imagine it as ffmpeg native cli and what you need to pass argument in the same way. Arguments:
-
Parameters
variables number of params you can pass around
Examples:
await ff.Run("-i", "myFile.mp4", "output.mp3");
Read In-Memory Wasm File (Ideal Method)
Arguments:
-
fileName
in-memory file name
Examples:
var res = await ff.ReadFile("output.mp3");
Delete In Memory Wasm file Arguments:
-
path
path to in-memory file to delete
Examples:
ff.UnlinkFile("myFile.mp4");
Write buffer of C# to WASM in-memory File so that FFmpeg can interact Arguments:
-
path
path to in-memory file to write -
buffer
>array bytes to write
Examples:
ff.WriteFile("myFile.mp4", buffer);
slow method to do Custom Emscripten File System Operation (Use faster ReadFile, WriteFile Instead) Arguments:
-
method
: method Name to call eg : readFile,unlinkFile -
args
>variable no of argument can be passed
Examples:
ff.FS("unlinkFile", "vid.mp4");
Exit out or terminate any ffmpeg running task Arguments:
Examples:
ff.Exit();