I'm trying to add flv support to my Windows Phone 8.1 (XAML) app. The idea is to retrieve multiple urls (containing 30-minute segments of a video) from a (single) call to an api (in this case, Twitch API) and use the resulting links for playback.
The problem is WP has no native support for .flv files, so I can't seem to play the files using Microsoft's Media Player Framework.
I've dug around a little and others seem to be suggesting (albeit non-trivially) creating a MediaStreamSource and connecting the links (or even writing my own container), though it seems like a huge hassle.
Has anyone come across any helpful libraries or any solutions to this problem? Would prefer not to have to download each segment to the phone (for obvious reasons) and simply create a 'stream' if possible.
Note: If it's any help, according to this thread, the flv files from Twitch are h264/aac content (which IS a supported video codec from the link above).
Example (single) link returned from the api call to Twitch:
http://media-cdn.twitch.tv/store92.media67/archives/2014-10-12/live_user_riotgames_1413100271.flv
Thanks.
Related
I did some research on converting video's to audio (MP3) on Windows Phone, but I can't find any converter or even basic functionality on the Windows Phone core to do this. Is this even possible?
You have a NuGet package named: MediaToolkit which is available with the NuGet package manager and also here: https://www.nuget.org/packages/MediaToolkit/
The library exposes features which convert video files into various other video formats. Grab images from videos. Perform a range of other audio / video transcoding tasks, even cutting / splitting videos.
To find the source code / code examples, visit GitHub: https://github.com/AydinAdn/MediaToolkit
To download it straight in to your project, use the Project Manager Console for NuGet: PM> Install-Package MediaToolkit.
There are no classes inside the Windows Phone 8 framework, the best thing to do is to go with an external library (like the one #Gaurav Deochakke) posted.
I've looked at the supported Win32 and COM APIs inside the WP8 framework, there are lots of API's that can help you (dis)playing media files, but none of them will help you either capture the desired audio or convert the video file to an audio file.
Although you might want to look at IAudioCaptureClient and IAudioClient (less documented), they might be able to help you with capturing the output of a file that has audio (a video for example). The only downside of this will be that you will have to loop through the video per second.
As stated above I'd go with a simple library to complete your task, but if you have time and you are interested in creating the solution yourself, I'd go with the links I posted.
I am developing application that receives media content(.mp3/.mp4/.avi) in form of bytes.
However, as WPF doesn't support playing media from stream, So I started with WMP.dll.
I am creating class library that receives media in form of bytes and media format and play media accordingly.
Referring Creating the WMP Programmatically, however, I didn't find method to pass bytes stream.
So My question is how do I play media from bytes using wmp.dll?
Edit: I am using WMP.dll using COM located at C:\WINDOWS\system32\wmp.dll
I've been through this process a long time ago ...
Basically I would advise you NOT to go down the WMP route at all. It's heavy, cumbersome and not very nice to work with. I encountered lots of issues along the way basically. Least of all it being feature rich (which it isn't).
The best solution I found and the one I'm still using now is a library called BASS from Un4SeenDevelopments.
This library is tiny < 100k and basically it's awesome. Never had a problem with it and it has it's own .NET wrapper that is a free download from the site.
The support is amazing and the compatibility via a massive selection of plugins and additional libraries is staggering.
Highly recommended for what you want to do.
"BASS is an audio library for use in software on several platforms. Its purpose is to provide developers with powerful and efficient sample, stream (MP3, MP2, MP1, OGG, WAV, AIFF, custom generated, and more via OS codecs and add-ons), MOD music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), and recording functions. All in a compact DLL that won't bloat your distribution."
I have a device that provides an H.264 video stream from a URL like:
rtsp://192.168.0.10:554/videoservice
Since this is live video I don't need to be able to control it (pause, rewind, etc), just play. Is this supported by MediaElement or another standard class, do I need something like Smooth Streaming Client SDK or is this a lot more complicated than I thought?
Update:
I downloaded Microsoft's Player Framework but this doesn't play the stream either. I can't find anything in the examples about RTSP.
Update:
I used Wireshark to compare the packets that VLC Media Player (which works) sends with MediaElement and Player Framework and neither of them seemed to use RTSP protocol. Instead they're sending WPAD packets to a different address, even though I've provided the IP address of the source. Why is this necessary? Is there any way of turning this behaviour off?
See the post here. You need to wrap your data in MPEG-4 Part 14 containers and then pass them into MediaElement.SetSource. It appears you can't do this just using the documented API. Here is the important information from the link:
We don't support RTP but rather the MPEG-4 Part 14 container format.
You will need to write our own source to be able to parse the data a
pass it directly to the Microsoft decoder. At this time we do not have
any samples on how to write a custom source and have it loaded from
your Metro style app. Unfortunately it is not possible to simply use
the documentation to figure out how to do this. I have been talking
with Stan and we are trying to figure out how and when we can make
this information available. As soon as this information is available
I will announce it on my blog http://blogs.msdn.com/mediasdkstuff/.
Here is a list of supported video formats.
There is also an example here of how to extend the media class which might have an example of how to do something similar to what you are asking.
There is a similar example here.
I've written a basic SL4 application to capture audio data from the microphone using CaptureSource. The trouble is, it's raw PCM output - which means huge and uncompressed.
Given that I need this application to run purely within a SL4 environment, how can I compress the PCM audio data into something that can be delivered to a remote server more easily?
Essentially I need a solution that I can also deploy/include in a Windows Phone Series 7 application as well as one that will work in the browser environment - so managed code solutions only, I think?
In conversation, people have suggested Speex and WMA for instance, but I haven't found any libraries or examples that work without requiring reference to DLL's that won't work in a SL4 project.
Just a small addition to Jason's post:
There is another port of Speex to .Net and Silverlight 4 called NSpeex.
Please see the WavFileHelper class in Silverlight 4 Rough Notes: Camera and Microphone Support on Mike Taulty's blog (a bit lower than the middle of the page, but the full article is worthwhile) in which he compresses the PCM file to WAV.
Here's another example of when writing to WAV you can change values such as Mono/Stereo, which will directly change the size of the WAV file: Audio recorder Silverlight 4 sample. And one more that gives more details about writing to WAV: Creating Sound using MediaStreamSource in Silverlight 3 Beta
Take a look at this. It looks like he has ported the Speex encoder to C# for the exact problem you are trying to solve. It is available here. Speex is designed for speech and should perform better than wma, mp3, or other audio codecs that are designed to handle music if you are just encoding speech, which I assume since you are grabbing from the mic.
This article http://alvas.net/alvas.audio,articles.aspx#how-to-save-audio-to-mp3-on-silverlight about save audio on client. To send audio data to a server you can use WebClient, for example.
You can do encoding thru the server, by send all stream to WCF service and do your encoding thru Microsoft Expression Encoding SDK API.
Please, see this url that i have asked before:
http://forums.silverlight.net/forums/t/181141.aspx
Regards
I want to provide a choice between streaming 'channels', if you will, in a web application. These are Windows Media streams of live events that are being broadcast from a Windows Media Services 9 distribution network.
I want to provide a relatively recent thumbnail image of the stream (as a user, you would expect to see this), but although I've seen this done in Flash on CNN and countless other sites, I've never seen this done with Windows Media.
I already have a C# / DirectX library that can extract a thumbnail from a WMV file, but obviously the stream doesn't come from a file if it's a live source.
My assumptions so far are:
Will need to run some kind of service application/daemon that will receive a stream into a Windows Media Player object and somehow take thumbnails if WMPlayer supports it...
-or-
Configure the streams to archive to file, and use the existing class library to take a peek at the last frame available in the archive file being written to get the thumbnail.
I would much rather do #1 because it seems like the clean solution, but don't know if/how WMPlayer supports grabbing a frame.
Are there better ways of doing this?
Not sure if using media player is a good idea in such case. I would look into this:
http://sourceforge.net/projects/windowsmedianet/