WPF/C# - Decode/View IIS Smooth Streaming Content - c#

I'm trying to write an application that is able to download the "chunks" sent by a IIS Smooth Streaming server and capture thumbnails of the video. I'm able to create the proper GET requests to download the chunks, but I'm having trouble finding a way to play or view the chunks I download.
Does anybody know of a way to combine and play/view the video sent? I know there are Silverlight players that will play the stream, but I'm trying to do this in a WPF application. Also any info on the file type that is sent from the server would be helpful in finding a way to play the content.
Thanks.

You need to split the packages and extract the video and audio frames. Then you need to decode the video and audio. After this you need to render the decodec frames.
So best solution would be an DirectShow filter doing the download and splitting. With this filter you can then use the DirectShow system to decode and render the stream. Does anybody know if there is such a filter available?

Related

How to make audio broadcast live streaming

I need to broadcast audio content to the network, receive it and play in the browser “on the fly”. The audio content is just list of mp3 files. and on client side it should looks like endless audio stream without state. Something like YouTube live streams. Or smth like online radio.
But I really don’t know anything about that. Can anyone helps me with that? How it works, which protocol is used for sending and receiving data? Anything that can help me with that.
At the best I’m looking for a solution for .NET, but I will be glad for anything that can help, at least to understand how it works in general.
Thank you.
One way to do it would be with help of ffmpeg.
You can use ffmpeg to create DASH or HLS playlist https://ffmpeg.org/ffmpeg-formats.html#hls-2
FFMPEG supports other streaming solutions too.
To invoke ffmpeg you have to find binaries that are compatible with your system that your server is running on (windows, linux). Here is how can you start external process from C#: How do I start a process from C#?
To play your playlist in browser you can use VideoJS. It has built-in support for DASH and HLS: https://videojs.com/ (it can play audio too)
Build your logic to manage / update playlists and then you just need to create HTTP service that can serve your playlist file. VideoJS will play it for you.
If you go with HLS then you probably should read this: https://developer.apple.com/streaming/
If you go with DASH then read this:
https://mpeg.chiariglione.org/standards/mpeg-dash
Another way is to use out of the box solutions which often aren't free:
https://azure.microsoft.com/en-us/services/media-services/
https://www.wowza.com/

MediaPlayer custom stream source

I’m developing an UWP app that should be able to play videos transferred through a custom TCP protocol implementation.
Videos are MP4, so there’s no need to decode frames.
My current solution is to download the file first, and then allow the user to play it, but with big files this is quite annoying.
As a workaround I tried to implement IRandomAccessStream to feed the MediaPlayer while the file gets downloaded, but this isn’t a good solution for sure as there’s no buffering (and the video is just laggy on bad networks) nor visual download progress in the TransportControls.
I know it is possible to create a custom MediaStreamSource, but it requires known encoding properties to be created and anyway it sounds like an overkill to have to decode frames by myself to feed it.
So I’m wondering if there’s any solution to my problem.

Play video file being written

I developed a socket based p2p system where i stream mp4 video from a client to a server. The video data are transferred using byte[].
The transfer works, however i am struggling to figure out how i could play, in continuous, a mp4 file being transferred to another PC? The PC application, that would play the file, is in WPF.
I tried using a MediaElement to play the file, being written to the disk, but for some reason it doesnt play at all. I can play it with VideoLan tho.
Any hint of where to look? I am lost from here!
Thanks in advance!
Its going to be different with every player. Mp4 is probably the worst possible container for this application. The container is designed to be used with random access media, such has a hard disk. The player has the ability, and sometimes requirement to seek around within the file, and not just plat start to finish. Either you need to make the protocol mp4 aware (parse the file, and download the block that will most like be needed next), or use a streamable container such as TS, or flv.
Its is also possible that the player knows the file is incomplete. The atoms sizes are encoded within the file. If the file size doest match, the combined atom sizes, the player could assume a corrupt file.If this is what is happening, you can try to pre allocate the file. it may trick the player enough to play

How to save video in Silverlight 5

Is it possible to capture video and audio in Silverlight5 and save it as movie in any video format?
Silverlight 5 can automatically detect video and audio capture devices, which you can open operations on using the System.Windows.Media.CaptureDeviceConfiguration class and associated classes.
http://chris.59north.com/post/Audio-recording-and-encoding-in-Silverlight.aspx has info on how to use those classes to save the audio to a Stream (as well as compressing it), which you can then save to disk.
http://www.dotnetfunda.com/articles/article1751-how-to-access-a-video-and-snap-a-picture-from-webcam-in-silverlight.aspx has similar info on how to access video and save images from webcams on to disk using Silverlight.
Pro Silverlight 5 in C# (excerpt on Google Books) has more information on how to do this.
I have been doing quite a lot of searching and I have yet to find any samples of anyone actually saving video. The best I have been able to come up with is saving a sequence of images. That doesn't really sound like a good solution

How we can perform live encoding of videos to mp4 and stream it in ASP.NET

I'm using flow player for streaming videos to my browser.The videos are uploaded by the users and they may upload different formats. What will be solution to stream the videos as mp4 , what ever be the format they upload. I'm currently using ffmpeg commands.
The problem is after encoding the video is getting down scaled.Also if the user upload large video file the encoding itself takes more time.
I need to stream the videos as soon as its uploaded to the server, what ever may be the format(like in youtube).
I'd look into ffmpeg as it allows yo to transcode just about every video format on the planet.
However; I'm not sure of it's real-time capabilities or it's abilities to stream it's output. Might be a good place to start though.
I think you could do this by automating expression encoder on the server even though it is mainly used for smooth streaming format but expression encoder isn't opensource or free :(

Categories

Resources