What is it?VideoStreamer is a simple video player I wrote in C++ with a C binding to .NET to provide a way for me to render video in C# with SFML 2.x. Internally it uses FFMPEG for reading/decoding the video clips.
Where is it used?I use VideoStreamer in my own project that I hope to be releasing soon
tm. (I use videos as backgrounds)
Special ThanksI also want to give thanks for inspiration from
Ceylo's
sfeMovie Project that helped me write VideoStreamer. And of course big thanks to Laurent for SFML.
LicensingVideoStreamer is licensed with the ZLIP/PNG, the license same as SFML. That way you can do whatever you want with it. Feel free to write patches and make pull requests on bitbucket. If you look at the code you will see that it is a bit ugly and that I am not a C++ developer. Personally I am happy with the performance, but if anyone wants to post improvements I am wide open to suggestions.
Features- Complete video/audio playback
- Basic control with play/pause/stop
- Supports any codec/format FFMPEG supports
- Seek anywhere during video/audio playback
- Supports video/audio syncing to elapsed time
- Supports audio resampling in case the input format is not signed 16 bit integers
- Should be cross platform with the current design (see "Modules" below)
Modules- VideoStreamer (static compile) - Written in C++ and wraps the FFMPEG functionality
- CVideoStreamer (dynamic/shared compile) - Written in C++ with a C interface to expose ViceoStreamer to .NET
- VideoStreamerNET - Written in C#/.NET that controls the decoding and playback of video/audio frames
Where do I get it?Get if from here and remember you will have to provide the paths to FFMPEG libs in order to compile it. There is also a sample project that shows how to use VideoStreamer and this following example is a snippet of the sample project.
How do I use VideoStreamer?Here is a snippet from the sample program (see "Screenshots" below) on how to use VideoStreamer in your .NET application.
RenderWindow window
= new RenderWindow
(new VideoMode
(640,
480),
"VideoStreamer Example"); window
.SetFramerateLimit(60); //Create our video stream stream
= new VideoStreamerNET
.VideoStream(@"VIDEO FILE PATH"); //Create a clock to track elapsed time Clock frameclock
= new Clock
(); //Create a specialized sprite renderer to draw our video frame VideoStreamerNET
.VideoDrawer framesprite
= new VideoStreamerNET
.VideoDrawer(stream
); //Start playing stream
.Play(); //Keep looping while our window is open while (window
.IsOpen()) { //Handle current events window
.DispatchEvents(); //Clear current window window
.Clear(); //Get our current frame time and restart the frame clock Time frametime
= frameclock
.Restart(); //Update the current frame inside our video streamer stream
.Update(frametime
); //Draw the current video frame window
.Draw(framesprite
); //Now display everything on the screen window
.Display(); } ScreenshotsHere is the sample application playing back a test video.
Also here is the breakdown of what is called when and where and as you can see SFML uses most of the processing time for drawing. Meaning vertical sync is working hard to slow down the application.
Toshiba Satellite - Intel i7 2.40ghz 8gb Intel HD Graphics 4000