ExpressionMediaPlayer to play .mpeg - c#

I'm trying to write a Silverlight application that reads a media file from a database (most likely a .mpeg or .mpg) and play it on the fly using either a Silverlight MediaPlayer or ExpressionMediaPlayer. When I try using Expression Media Player it plays .wmv and .mp4 files but NOT .mpeg or .mpg file extensions. Is this even possible? If so, HOW?!
I tried going a different route originally where I wrote a Service to Encode the file using a LiveJob and then play it on the ExpressionMediaPlayer from the port using mms://localhost:8080 but I couldn't figure out how to use that to Play/Pause the video. It just ran through once and stopped. Any suggestions on that?
I'm using Expression Encoder 3 & Silverlight 4 by the way.

i think you're out of luck, check out this page from msdn.
You are going to have to re-encode the file if you want it to play in Silverlight.

Related

How can I transform a sequence of images into a playable video using LibVLCSharp?

I have a sequence of images that I was able to extract from a video using LibVLCSharp. This sample to be more specific. I'm creating a small video library manager for learning purposes, and I would like to extract frames and create thumbnails to play when the user hovers the mouse over the previewer.
Using the aforementioned sample I was able to create a WPF UI around the same loging and extract the frames from a video file. However what I want now is to convert these extracted frames into a video file, using them as preview for the video, just like happens on YouTube.
I wasn't able, however, to find out how to achieve this using LibVLCSharp or just LibVLC. Using this answer on Super User I was able to achieve my goal and put those frames together into a video using ffmpeg.
I haven't taken the time yet to study FFmpeg.Autogen, so I don't know if I would be able to extract the frames from the video files in the same way I can do with LibVLCSharp, but I don't see with good eyes using both libraries on my application, one to export the frames and one to generate these frames into a video.
So, is there a way to get the output frames and convert them into a playable video using LibVLCSharp (or libvlc) itself?
I don't see with good eyes using both libraries on my application
You already are, LibVLC ships with ffmpeg.
So, is there a way to get the output frames and convert them into a playable video using LibVLCSharp (or libvlc) itself?
It is possible that there is a way, but I cannot find it right now. Using libvlc for this would be awkward and an inflexible solution. I would use ffmpeg.
You are not forced to use FFmpeg.Autogen for conversion scenarios you can achieve with ffmpeg.exe. I would start a ffmpeg process to do the conversion, and read the ffmpeg stdout for the video data, if you don't want to save it somewhere.
I think there is a way to play images at a specific rate (look at the VLC CLI options), but I don't know how well it works as I never used that

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

Extracting and splitting a MP3 audio stream from an AVI file

I want to develop a desktop application by programming in C# and using the .Net framework 4.
The goal of my application is to extract a MP3 audio stream from a supplied AVI file.
I have learned from the Internet that an AVI file is a container and it might contain different audio streams.
If the supplied AVI file contains one MP3 audio stream at least then I want to extract it and split it.
I want to split the MP3 audio stream into MP3 audio parts identified with a start time and an end time.
I have looked on the Internet for any .Net library I could use but without success.
Does someone know what documented .Net library would be useful ?
Maybe you can try this:
Simple C# Wrapper for the AviFile Library
It is targeted at AVI video but there might be some clues as how to use the same methods to extract the audio only.
Either use it as-is or use the example to incorporate what you need into your own code.
Since tools for this task already exist, I see no point in creating another one unless you're curious about how to do this yourself and learn something new.
If so, using a ready-made library would defeat the entire idea of learning something which is why I strongly recommend you try implementing the splitter yourself.
You can find descriptions of the AVI file format online, that should get you started.

How to stream online radio on WP7?

I am trying to create a radio app, which contains a collection of MP3-stream urls. However, I have run into some trouble streaming (or playing back) the audio.
I am trying to connect to a raw data stream like the ones you plug into VLC. An example url is http://mp3.ht-stream.net/;80 (just plugged this one and a few others into VLC and it worked perfectly). Basically your standard internet radio feed.
I have created the AudioPlaybackAgent, filled in what I think is needed to get this up and running, and everything works fine when I stream regular .mp3 files over the internet. But when I try to connect to these streams, it doesn't do (or play) anything.
I reckon it could be because I'm not using an AudioStreamingAgent (with a MediaStreamSource implementation), but that stuff is a bit too advanced for me, and as I understood after some hours searching the interwebs, mp3 streams could use the AudioPlaybackAgent instead.
Any advice on how I can make this work? Will I have to use an AudioStreamingAgent instead? Is there any open source examples as to how I implement this mysterious MediaStreamSource class? Should I scrap my great idea? Any answers will be greatly appreciated.
My AudioPlayer.cs code is available here if you'd like a peek - but it's mostly the standard stuff.
You can't easily play audio from the provided link because of this is not a regular audio file. This is SHOUTcast stream.
You can check some open source implementations and to figure out how to work with this audio stream. For example: Shoutcast MediaStreamSource.
So I can say that you need to implement a lot of stuff in your app to play this stream. There is no quick and easy way.
Look at the Background Audio Streamer sample.

How to play mp3 file from a different server in .NET 2.0 (c#/vb.net)?

I want to create a window application which will play an mp3 file, which will be on a different server.
For an example,
I have a URL (http://songs.mastemag.com/indian-movie-songs/L/download.php?get=2cdeb5bfb354f297e97ba6b6b3b53203&file=1/love-aaj-kal/01%20~%20Twist%20(MastiMag.com).mp3). I want to play this file from window application on my local machine without downloading this file.(with the help of streaming)
I have code that is using 'winmm.dll' and plays local mp3 file. Is there a way in which I can use this dll to play this kind of file.
You can also suggest me any other approach as well.
Take a look at NAudio
The simple way will be to use the Window Media Player Control (in hidden mode).
It can work with http urls and local (file) urls.
Howto: use it with .NET

Categories

Resources