[FFmpeg-user] "Piping" to c#

Phil Rhodes phil_rhodes at rocketmail.com
Thu Jun 28 01:29:05 CEST 2012

> I'd like to encode images I create in c# directly into a video using  
> ffmpeg.

The best engineering solution to a situation like this is to p/invoke  
libavformat etc. from within your C# application. It is theoretically  
possible to do this, but although I think it's been tried I'm not sure it  
has ever been done successfully (though this information is a year or two  
old and may be out of date).

There are some reasonably significant technical challenges. The libraries  
concerned talk amongst themselves using a lot of strange datatypes and you  
would need to understand these datatypes, how they're arranged in memory,  
the calling conventions in use, and so on, as well as the basic  
understanding of how the libraries are supposed to work under normal  
circumstances in C.

None of this is particularly different to what you'd face trying to  
p/invoke any other library, but in this case it's opensource so the  
documentation is fairly partial (and I'm being kind there) and you are  
likely to face open hostility from the development community who by and  
large view anything Microsoft as spawn of the devil.

That said, this is exactly what p/invoke is supposed to be for, to get  
native code to do the heavy lifting around a managed framework, and I  
would be more than happy to pitch in to any effort to get it working.


More information about the ffmpeg-user mailing list