jakehedlund / yasc

Yet Another Streaming Control
MIT License
9 stars 2 forks source link
gstreamer rtsp video-streaming winforms

yasc (beta)

paypal

Yet Another Streaming Control

About

yasc is a high-level, fully-featured, low-latency, fast, lightweight, adjective-laden, streaming (and recording) .NET UserControl based around GStreamer. It is written for .NET and WinForms in C#. Support for WPF is planned. It is intended as an easy-to-use, drop-in video streaming control for programmers who just want to program and not deal with video rendering/display or learning GStreamer.

Demo app screenshot

demo_app

Features

Initial release supports h.264 and MJPG via RTSP (anything decodebin can handle) and built-in/USB webcam streaming, text overlays, realtime preview, recording, and more. It is designed to be as simple and easy to use as possible with drop-and-go functionality.

As this is a relatively simple wrapper around the great GStreamer, many more features are possible and easily implementable. Behind the scenes, a gst Pipeline is created and manipulated to render the preview source and all the other operations. Therefore, this can be used as an comprehensive advanced C# example program for GStreamer.

Installation

  1. Install GStreamer (use the MinGW version here: https://gstreamer.freedesktop.org/download/ either 32 or 64 should work, 1.14.0 or higher. Note your gst-sharp version should match the downloaded version).
  2. Start a new .NET WinForms project.
  3. Install GstSharp (gstreamer wrapper for C#) from Nuget.
  4. Copy the yasc dll into your directory of choosing.
  5. "Add Reference..." to yasc.dll.

Usage

  1. Add the yasc DLL to your toolbox (right-click -> Choose Items...)
  2. Drag a YascControl onto your form.
  3. Add buttons and event handlers as necessary.
  4. Set YascControl.CamType to the correct camera type.
  5. Set streaming source index or URI.
  6. Call StartPreview().
  7. The included example app (YascTestApp.sln) demonstrates nearly all the features and can function as a basic streaming/recording app.

Motivation

I could not for the life of me find a low-latency, self-contained, low-cost plugin/UserControl/ActiveX control that met all of my criteria. Every control I came across either was not low enough latency, couldn't handle h.264 via RTSP easily, or was out of budget. My criteria were:

Not being able to find something that met all these criteria (yes I tried ffmpeg and VLC libs - latency and flexibility were the main sticking points), I finally bit the bullet and learned GStreamer. After I learned enough to implement the desired functionality, I wrote the control which became yasc.

Furthermore, I found the existing landscape around video previewing and rendering to be quite confusing and not at all well documented for newcomers like me. DirectShow is cumbersome (and not supported anymore, depending who you ask), ffmpeg is...interesting..., libvlc is slow and inflexible.... The primary goal of this project is to lower the barrier of entry for creative programmers looking for a simple streaming solution.

Windows 10 and WPF seems to be making moves in this domain, but most options I found didn't meet one or more of my critera above. In addition they were mostly black boxes without much room for extensibility. Hence, yet another streaming control enters the arena.

Contributing

I'm sure there are many better ways to do things; please shoot me a message and/or a pull request. Always open to suggestions and improvements. Also, if anyone is aware of an existing program/control that meets all of my critera, let me know.

paypal