Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8620507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:35:50+00:00 2026-06-12T06:35:50+00:00

I am working on a WPF application that needs to display several video streams

  • 0

I am working on a WPF application that needs to display several video streams at a fast frame rate (we would like 30 fps). The video streams are 1920×1080 raw (RGB24) frames (they are stored in a System.Drawing.Bitmap). Does anyone have any ideas on how to achieve this?

More details:

  • Our previous attempts have used a standard WPF Image control, changing its source for each frame. This worked well for a single stream but now that we have to render multiple streams, it is slowing down.
  • We have also tried using Direct2D to handle the drawing, using a D3D9 shared surface as the source for an Image control. While this was faster, we are still not able to get a stable 30fps out of it (it jumps between 24-32 fps as things back up).
  • The video stream is coming in on a background thread, then being marshaled (using the Dispatcher of the window) to the proper UI thread for drawing. All the drawing is then done on the UI thread. We have also tried giving each window its own thread.

I can provide code samples of what we have tried if anyone wants to see.

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:35:51+00:00Added an answer on June 12, 2026 at 6:35 am

    Anyone looking for a solution, we wrote a custom winforms control using DirectX 11 with a highly optimized copy into graphics memory, then hosted the control in a WinformsHost, I can provide some code to anyone who is interested.

    Optimized copy into gpu memory

        // Using native memcpy for the fastest possible copy
        [DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
        private static extern IntPtr memcpy(IntPtr dest, IntPtr src, UIntPtr count);
    
        /// <summary>
        /// Copies a bitmap to gpu memory
        /// </summary>
        /// <param name="frame">The image to copy to the gpu</param>
        /// <returns>A texture in gpu memory for the bitmap</returns>
        public Texture2D CopyFrameToGpuMemory(Bitmap frame)
        {
            SampleDescription sampleDesc = new SampleDescription();
            sampleDesc.Count = 1;
            sampleDesc.Quality = 0;
    
            Texture2DDescription texDesc = new Texture2DDescription()
            {
                ArraySize = 1,
                MipLevels = 1,
                SampleDescription = sampleDesc,
                Format = Format.B8G8R8A8_UNorm,
                CpuAccessFlags = CpuAccessFlags.Write,
                BindFlags = BindFlags.ShaderResource,
                Usage = ResourceUsage.Dynamic,
                Height = frame.Height,
                Width = frame.Width
            };
    
            Texture2D tex = new Texture2D(Device, texDesc);
    
            Surface surface = tex.AsSurface();
            DataRectangle mappedRect = surface.Map(SlimDX.DXGI.MapFlags.Write | SlimDX.DXGI.MapFlags.Discard);
    
            BitmapData pixelData = frame.LockBits(new Rectangle(0, 0, frame.Width, frame.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
    
            unsafe //!!!
            {
                byte* pixelDataStart = (byte*)pixelData.Scan0.ToPointer();
                byte* mappedRectDataStart = (byte*)mappedRect.Data.DataPointer.ToPointer();
    
                for (int y = 0; y < texDesc.Height; y++)
                {
                    byte* lineLocationDest = mappedRectDataStart + (y * mappedRect.Pitch);
                    byte* lineLocationSrc = pixelDataStart + (y * pixelData.Stride);
    
                    // Copy line by line for best performance
                    memcpy((IntPtr)lineLocationDest, (IntPtr)lineLocationSrc, (UIntPtr)(texDesc.Width * 4));
                }
            } //!!!
    
            frame.UnlockBits(pixelData);
    
            mappedRect.Data.Dispose();
    
            surface.Unmap();
            surface.Dispose();
    
            return tex;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a WPF application that contains a wrapper UI that is actually
I'm recently working on a WPF application that uses the datagrid from the WPF
I am working on a WPF application. During tests I noticed, that the application
I'm working on a mobile application (C#/WPF on a tablet PC) that prints to
I am currently working on this application(C#,WPF,LINQ2XML,.NET 4.0) that displays details for 'Animals'. An
I'm working with a Win32 application that needs to create a variety of custom
I am working in WPF application with excel . In that application i am
I have a small WPF application that I am working on localizing. I have
I am working on a WPF application that requires .NET 4.0 to run. The
I have been working on a WPF Application that is essentially a WYSIWYG editor,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.