cmxl / FFmpeg.NET

.NET wrapper for common ffmpeg tasks
MIT License
611 stars 99 forks source link

Ability to pass data to ffmpeg stdin from C# code #56

Closed psynomorph closed 2 years ago

psynomorph commented 3 years ago

In my use case i need to asynchronously receive chunks of video from net and pass it to ffmpeg process to transcode and send to another server.
This pr add internal interface which defines methods to handle process lifetime events (Started and Exited). It give us ability to access StandardInputWriter of process and use it for writing to ffmpeg stdin after process will be started.
Also it add two inputs which uses this interface to populate process stdin. First, StreamInput allows us to use objects inheriting standard System.IO.Streamas input for ffmpeg process. Second, StandardInputWriter allows to start ffmpeg process and pass new chunks of data to ffmpeg stdin when available.

cmxl commented 2 years ago

This one looks great. I'll check it out soon and will merge it.