Is there a way to process frames from a stream(or image file or video file) and save the frames in encoded video file without using Media Foundation API. I am not familiar with C++ and COM technology, so I ask is there any way to make video stream from set of images with C#?
It might be possible with some .NET wrappers for Media Foundation. Perhaps SharpDX has them.
Related
I"m trying to consume an mp4 stream in C# (WPF) direct from sources without any server/mid software to convert. The stream is continuous. No control or audio are necessary, just the constant video stream.
media element & embedded web browser controls with some added codecs tried but no luck.
just want a simple, continuous mp4 stream. Once working, application will read many streams simultaneously for multiple source monitoring without any control or audio of media so a rolled class is an option if a simple stream converter/consumer isn't available.
any assistance is appreciated - thanks
I have a problem regarding unity 3d video stream, I want to open I can open mp4 videos but with the video player I can't open m3u8 video streams, is there a way to open this kind of videos.Is there any way to play it via u3dxt plugin
EasyMovieTexture is able to play m3u8 format
The AVPro Video plugin for Unity has really good adaptive video file support (both DASH and HLS/m3u8) and supports many platforms. Much easier to use compared to EasyMovieTexture as well.
Using AVPro Video and the Vimeo Unity plugin together is also really helpful if you need to host and transcode videos to the m3u8 format.
I need to cut a part of video clip which is possible by ffmpeg but not want to use ffmpeg and want to strict with Media Foundation approach in asp.net. Can anyone suggest me how could be that possible.
Requirement is that want to cut the live stream from end position to 4 minute back and then save in video file. We have to cut the video from live stream not for video saved already.
I can recommend you use ffmpeg or other video editor. Media Foundation is low level framework which is used for playing or encoding video. It does not include any functionality for cut of video clip. Of course, it is possible to write code for cut of video with Media Foundation, but it needs write all code from scratch. I have a rich experience with Media Foundation and I can compare it with 'LEGO' blocks - collection very 'tiny' elements. I think that it can take half year or more for implementing of your idea.
By the way - you can find my source code for working with camera via Media Foundation Capturing Live-video from Web-camera on Windows 7 and Windows 8 and you can view complexity of code. It supports splitting video on two stream - viewing and other (for example recording). It is possible record video into the file via other stream, then after finishing of video recording create Media Foundation Media Session, open temp video file, set position video reader on for minutes from end, and rewrite into the destination file. However, you must understand Media Foundation very well. There is a book about Media Foundation. It includes code for Media Foundation Media Session.
One way to create a subclip from an MP4 file is to use Source Reader and Sink Writer of Media Foundation API so that you start "reading" from all streams of your interest from certain position and stop respectively. The data is to be passed through to Sink Writer instance to produce a subclip file.
This can be done both with and without video re-compression. Note that Media Foundation is native code API and you might need a wrapper library that provides respective interface into ASP.NET.
Another way is a UWP MediaTranscoder API, with TrimStartTime/TrimStopTime properties. Transcoding media sample should give you an insight.
I need to play the audio files like mp3 and .wav using c#. I don't want to use the com dll's and I need some functionality like to set the current time and end time of the file to play. etc.
Need some sample exmaples for the same.
To play audio using C# at some point the managed code will need to call into unmanaged APIs. NAudio provides wrappers for four different Windows audio playback APIs. WaveOut would be the most appropriate choice for you, since it is not COM based.
To decode MP3, you have a choice of using the codecs that come with Windows or trying to find a fully managed MP3 decoder. NAudio provides interop wrappers for two different Windows MP3 decoders - the Fraunhofer ACM codec that comes with Windows XP and above and the DirectX Media Object decoder that comes with Windows Vista and above. If you want a fully managed MP3 decoder, you can try NLayer which is a port I made of JavaLayer to .NET, although its public API doesn't currently allow it to slot neatly into an NAudio app.
I want to transcode a lot of audio from its source format to PCM without resampling or messing with the sample size. I figure if Windows Media Player can play the file and it doesn't use a legacy ACM codecs it must be using DirectSound to do so (this is on Windows XP and Windows Server 2k3). So is it possible to access DirectSound from C# and do so? I've tried searching the web but all the examples have been about playback which I have no interest in doing.
DirectSound is an audio playback API, you mean DirectShow. Windows Media player does use DirectShow to play audio files. In theory, all you need to do is build the same playback graph that media player uses, but replace the audio driver on the end with a .WAV writer filter.
This is somewhat easier to do in C++ code, since the DirectShow graph object is really designed to be called from C++, but with a good set of interop definitions, you can do this in C#.
There's http://directshownet.sourceforge.net/ for serious hacking with DirectShow in .NET, but that's probably overkill for your problem.
I would suggest getting a copy of GraphEdit if you don't already have one. You can use it to "prototype" direct show graphs interactively. drop a file into graphedit. then delete the filter on the end and replace it with a file writer filter.
One problem you will have is that there is no .WAV file writer filter in the default set of o DirectShow filters, you will have to find or write one.
If you just want to get the files converted, and could care less about learning how to write code using DirectShow, I would suggest that you just get a copy of Sound Forge (possibly even a demo version). It has a scripting language (C#,vb) that can be used to easily batch process most audio file formats.
Conversion to WAV can be done from the Windows command line using SoX (Sound eXchange, http://sox.sourceforge.net/). You could write a batch file or a C# application that calls SoX with the proper attributes. I'm not sure how WinAMP's feature works specifically, but it has a file writer output option built in as well. You can stream the entire playlist to wave files.
Have a look at this article on CodeProject about audio conversion here and here.