How to do multi-threaded video rendering with C#/VB.NET ?
I'm working on an app (staxrip) that uses a video library (avisynth/vapoursynth) and GDI for video rendering.
In its current state it's inefficient because it's not multi-threaded and not hardware accelerated, in particular 4K/UHD is painful slow.
Before trying to render it with opengl or directx I want to try to multi-thread it and see if it's good enough.
Playback is not required, only showing frames when a trackbar/slider is moved.
Currently, it works like so:
1. track bar is moved by user
2. native video library is queried for a frame, can be slow for large videos
3. native frame is converted to a WinForms bitmap
4. Bitmap is rendered with GDI (System.Drawing)
All this happens in the same thread and I believe it would be much faster with multi-threading.
I think my threading knowledge is not good enough for this task, which .NET threading techniques can I try? Or should I maybe forget about GDI and try opengl or directx, I don't know much about that either but I can learn it.
|