Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm playing around with the YouTube Live Stream API. That's working fine so far, but the next step is to stream the web cam data to YouTube via RTMP.
In the (excellent) documentation at Google Dev, it outlines the Life of a Broadcast. However, all steps are documented in detail, except the step I'm interested in:
Step 3.2: Start your video
Start transmitting video on your video stream.
I was able to use Open Broadcasting Software to stream to a manually created YouTube Live Event, but I have no idea how to do it from my Windows 10 App. I've looked at the MediaElement class, and was able to capture the web cam preview in my app. But I can only find methods to save as a file.
Also found information about FFMPEG, which should probably be able to do the job, but I cannot find a library / DLL to use FFMPEG in my App.
I just need some guidance where to look next, because now I'm just clueless what to do.
/edit: I came across MPlatform SDK, which sounds exactly what I want, but it costs $5000.... Not for a hobby :(
So, as you mentioned, FFmpeg does indeed support streaming (output) over RTMP. I'm not sure what you're trying to stream, since depending on that, the solution will be slightly more or less complex. Two basic cases:
if you're trying to stream an existing file or something from your screen, you can simply use ffmpeg as a command-line executable in your c# application.
if you're streaming custom bitmap data, it's a little bit more complex and you'll have to manually invoke libavformat/libavcodec.
So, first, get some Windows builds of FFmpeg, e.g. from zeranoe. If you're going to go route 1, just call ffmpeg.exe in your application and you're done. If you want to go route 2, load the relevant libraries into your project and follow tutorials about writing files using libavcodec/libavformat. I can give more details if you tell me what data you want to write. Then, just use either approach to open a rtmp:// output stream, and you should be good to go. (Use h264 as video codec and aac as audio codec, and make sure your build has x264 support, which zeranoe does.)
Just like #Ronald and #rogerdpack have stated - ffmpeg is probably your best bet.
Assuming you want to both capture and process the video before publishing it up to YouTube, take a hint from other pro software.
The live streaming application VMix which I am pretty sure is also written in .Net/WPF uses the following approach:
Captures the video stream using the windows DirectShow library Or any other method they support (They have many source types)
Processes the video internally using whatever filter they need - But basically they just manipulate frames / audio samples
Present the result A/V data stream as a virtual DirectShow capture device
Spin up ffmpeg as an child windows process with command line switches pointing it to capture from the virtual device and directing it to publish to whatever RTMP server
If you can get away with just using VMix - Go for it, It's quite cheap for it's basic edition. That's what I did anyway going the same path as you did.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need help to make my program. I have developed a form in C# that only has a textbox and a button to take a photo using the webcam and save it in the file path specified.
So I need a method to start the webcam, take a photo and save it in the file path and close the webcam immediately. No need to see what the webcam shows, just take the photo very fast and save it.
Any idea how I can do that? All comments are welcome. Thanks in advance.
Windows APIs to access a webcam are native, but you can use well known wrappers:
First, DirectShow.NET's DxSnap sample
Use DirectShow to take snapshots from the Still pin of a capture
device. Note the MS encourages you to use WIA for this, but if
you want to do in with DirectShow and C#, here's how.
Related on StackOverflow:
Photo and video with webcam using DirectShowLib-2005
Capturing frames from webcam using DirectShow.NET
DirectShowLib - Can't take more than one picture with webcam. Got "Insufficient system resources exist to complete the requested service" error
DirectShow Library-How to capture image using directshow library without showing the webcam live images on the PictureBox or Panel
Capturing a photo on x86 Atom Windows 8, DirectShow
Second, Media Foundation.NET which wraps Media Foundation API
See How to grab constant stream of bitmap images from webcam in c# for related references
Then, other libraries, that eventually wrap mentioned above APIs (including referenced by links above)
What is the best solution for building video playback with basic real-time editing features into per-existing .NET application?
I have a legacy .NET application, running on Windows 7+ systems. I need to build a video player that would be able to rearrange segments of video and seamlessly play a few video files one after another. Basically a simple video editing instrument. What is the best tool or framework available for the task at the moment?
I used to work with DirectShow in the past, thought about using that but pretty much the entire DirectShow Editing Services section is marked as not supported which is not encouraging to say the least. And I don't see any way to use MediaFoundation with a .NET based shell.
Are there any reasonable options for work with media content available for .NET based applications at all?
I need to be able to record video from an external camera in a C# application.
Unfortunately a webcam is pretty much out of the question as the application will record outside and during the evening/night. That is why I was thinking of a camcorder since it also has manual control over exposure and focus, lower noise and better sensor.
So far I would use the AV/S-Video output from the camcorder and send the signal to a USB capture card (the computer is a laptop so no PCI-E cards).
How would I be able to access the video stream from the C# application, now that it comes from the capture card ?
Does my proposed system seem feasible (achievable, good video quality, good fps)? Does anybody have another working solution?
Thanks
This Code Project Article could be of a good starting point.
The Author mentions :
The main goal of the application was to make it flexible and
extensible. The application itself can communicate with any video
source – it may be an IP video camera or a server, it may be a local
camera attached to USB, it may be an MMS stream from a remote server,
or it may be any other video source. And more of it, the application
can work with all these video sources simultaneously, displaying them
all on a single screen.
The solution I used in the end was Microsoft Expression Encoder.
I am experimenting with C#, and I wanted to create a fun/useful network program. I've programmed for most of my years using C++, C# seems a lot cleaner and easier to program in. I mostly programmed data structures and algorithms. I haven't really touched networking much.
I have video files on my computer that I would like to be able to share/stream/send to other computers on my network. I'm going to eventually expand on it and add a lot of features, but I want to conquer the hardest part first.
Is there a library out that helps with the data management for this?
I see accomplishing this three ways, Idk what's easiest and best.
Maybe using Windows File Sharing (Like how other computers on a network can open videos in a shared folder?)
Streaming the video data to the client computer? Then having their native video program open the data stream? (Buffer-like on youtube?)
Silverlight or some other Library. I can use the built in video player, etc to run it
Features:
I want to allow the client to be able to copy the video tutorial file to their own computer eventually if necessary, so idk. Maybe buffering is the best solution.
Want to allow the client to pause/download the video.
Hopefully I can learn a lot in this project.
You can use Microsoft Expression Encoder SDK to push video stream to a local port, or publish it in Windows or IIS Media Services. Windows Media Player, Silverlight or player-based application can be used for playback on another computer. Also, the are some options for playback on Apple devices. For H.264 support, you would need Pro version of the encoder.
For more information see the SDK documentation on MSDN, and articles Getting started with IIS Live Smooth Streaming and Apple HTTP Live Streaming with IIS Media Services.
You should be able to use vlc to transcode the file (or just stream it) then connect to the stream it produces. I know you're experimenting with C#, but it seems odd to re-invent the wheel, especially when it's such a good one!
I'm sure you'd have some fun automating vlc.
I have a Microsoft LifeCam HD-5000 webcams. According to AMCap, the camera outputs a MJPEG stream at 30fps at 720p. I want to capture each JPEG frame in a small application without doing any preview or decompression/transcoding to minimize CPU utilization to the minimum possible.
I'm a C# developer, but I'm new to DirectShow. Is there a simple way to capture the MJPEG stream frame by frame as its output from the camera in C#/.NET without decompressing it?
First of all, you might not need to use DirectShow to access your camera. Check out the OpenCV project, which has .net bindings available at opencvdotnet.
If you'd like to go the DirectShow route, then you'll need the .NET bindings, available at the directshownet project. I believe your best bet will be to create a filter graph that contains your webcam as a source filter, and a sample grabber as your destination filter. Documentation for the sample grabber is on MSDN. This will give you access to the raw data. You can also request a particular data format and use the DirectShow intelligent connect to fill in the filter graph with the right conversion filters.
That being said, I definitely recommend OpenCV over DirectShow. DirectShow is very general purpose, and probably does more than you need it to do. OpenCV can be used to quickly access your camera. Perhaps check out this stackoverflow question Webcam Usage in C# for some more information and answers.
With DirectShowNet, I could never access to a single frame and show it as Bitmap anywhere. In every project I just see converters, direct show to screen or streaming. How to capture the stream as single bitmap frames?
in the Directshow.net Download package, they have sample code and inside Capture there is a project DxSnap which connects to a webcam through directshow.net and snaps a picture from the stream. You can view it and use that as a starting place.