Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can MediaFile support a byte[] or Stream #101

Open
agentKnipe opened this issue Jun 24, 2019 · 3 comments
Open

Can MediaFile support a byte[] or Stream #101

agentKnipe opened this issue Jun 24, 2019 · 3 comments

Comments

@agentKnipe
Copy link

can instantiating a MediaFile object be updated to support working with byte arrays or streams?

@sklenma
Copy link

sklenma commented Apr 8, 2020

Any solutions ?

@JPVenson
Copy link

I dont think this is possible as the MediaToolkit is just an wrapper to the FFmpeg assembly. The FFmpeg assembly running in another process, cannot stream its data to another process the same way it would be possible with interopt.

@blackholeearth
Copy link

blackholeearth commented Jul 13, 2021

if this library can do it. its possible to do.

url : https://stackoverflow.com/questions/15881574/get-image-from-video-stream-in-c-sharp

answer :

It is possible to capture frames with free VideoConverter for .NET that actually is a wrapper to FFMpeg tool. The idea is using live streaming capabilities (to C# Stream) of VideoConverter for special FFMpeg format "rawvideo" that actually is bitmap stream that can be processed by C# program, something like that:


var videoConv = new FFMpegConverter();
var ffMpegTask = videoConv.ConvertLiveMedia(
    "input.mp4",
    null, // autodetect live stream format
    rawBmpOutputStream,  // this is your special stream that will capture bitmaps
    "rawvideo",
    new ConvertSettings() {
        VideoFrameSize = "320x200",  // lets resize to exact frame size
        CustomOutputArgs = " -pix_fmt bgr24 ", // windows bitmap pixel format
        VideoFrameRate = 5, // lets consume 5 frames per second
        MaxDuration = 5 // lets consume live stream for first 5 seconds
    });

VideoConverter can read live streams from another .NET Stream (if input format can be used with live stream conversion).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants