No announcement yet.

Video Capture Redux

  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    Tidbit ... On my PC, the video window pops up first, by itself, then the Dialog appears and the two combine - a little bit of flicker.

    If you comment out the line pWindow.Visible = %OATrue, the little flicker goes away and the video is still shown.

    It seems that once hDlg is visible the pWindow becomes visible too, even without explicitly calling that line of code.


    • #22
      Another glitch in the posted code ... as I resize the Dialog, the video flickers quite a bit! Not sure exactly why. From what I've seen in other DirectShow apps, that should be fixable.

      Would someone confirm that they see it on their PC?


      • #23
        Try adding the %WS_ClipSiblings Or %WS_ClipChildren styles to the dialog.


        • #24
          Howdy, Jose!
          Yep, %WS_ClipChildren did the trick. Thanks! Just got back from tennis and had not had a chance to look at it.But that part is good now!


          • #25
            Here are some basic video tasks and what seems to be the supporting DirectShow interfaces.

            1. Enumerate/Get/Set resolution/frame rates - IAMStreamConfig - output formats
            2. Get/Set camera image properties - IAMVideoProcAmp - image quality (brightness, contrast, ...)
            3. Transform video frame by frame - ISampleGrabber - retrieve and modify frames, insert back into stream

            The ISampleGrabber is deprecated, but still available. I've read from various posts that should it disappear in future Windows versions, that a replacement is not too hard to write.

            I've also read that ISampleGrabber introduces a performance issue and that writing your own transform filter can give significantly better performance. That's well above my pay grade for the moment but I'll keep the idea in mind.

            My favorite quote of the day ...
            DirectShow is just not that complicated.
            At the bottom of the learning curve (where I am), that seems to be very funny statement, written by someone who is at the top of the learning curve!

            If you need me, I'll be out climbing the learning curve!


            • #26
              Side note ... here's an interesting site - it claims it can test the supported resolutions of your webcam as well as display your webcam on the page.


              • #27

                It's great you've gotten this far. I was hoping to hop in and help, but time hasn't been on my side. I'll grab your code and look at it when I get a chance. If you're getting somewhere with getting the video, maybe I can help with modifying it. The nice thing is you can do that in assembler in PB. Recently I did some using mmx and that worked really well.

                Sorry to be so absent,
                "There are two novels that can change a bookish fourteen-year old's life: The Lord of the Rings and Atlas Shrugged. One is a childish fantasy that often engenders a lifelong obsession with its unbelievable heroes, leading to an emotionally stunted, socially crippled adulthood, unable to deal with the real world. The other, of course, involves orcs." - John Rogers


                • #28
                  Howdy, Russ!
                  Welcome back. I've got a fair amount of code more than what I've posted so far. I was holding off posting anything else until I resolved a few issues. But if you find time to look at it, I'd like you to have the latest source code.

                  At the moment the biggest issue is that I'm not able to access IAMStreamConfig - where I can read resolutions and frame rates of all cameras, plus query the current camera. I've not started addressing the frame transformations. Just haven't gotten that far.

                  Give me a bit and I'll post a zip here with the as-is version of the gbVideo app I'm working on. That would be best for you to start with.


                  • #29
                    I've made an in-work copy of gbVideo available here. Plus, I've also put up a first version of the online Help page.

                    The download file includes source code and the images needed for compilation.

                    gbVideo uses DirectShow to access all the video devices on a PC.

                    This early release is for the convenience of folks helping me complete the DirectShow code in the app. Feel free to take a look at it - suggestions always welcomed - but just remember that there are 4 particular pieces of the code that are not working at this time:
                    1. Access resolution/framerates supported by each camera as well as info on the current camera.
                    2. SampleGrabber (filter to allow editing of each frame inline with the video stream)
                    3. Caption overlay
                    4. Set camera properties (brightness, contrast, saturation, etc.)
                    Here's a picture of the app. Camera list and settings are shown in the ListView on the left. The ListView can be hidden to give all room to the video preview.

                    Click image for larger version  Name:	gbvideo_main.jpg Views:	1 Size:	72.1 KB ID:	776625


                    • #30
                      Good grief! My last post was in Nov 2018.

                      I'm sorry for the big silence since last year. I'm still keenly interested in using DirectShow, as you've summarized here. And yes, it's similar to the C# work you helped me with back in 2017. I attribute my "Look, squirrel!" performance to the demands of family, business and tennis.

                      ...but it will allow you to capture the video, run it through a filter called a "samplegrabber", modify the video as you did in the c# app we played with, and then display it.
                      Here are the capabilities I've yet to demonstrate. Before I went silent on this topic I started up a demo app, gbVideo (post #29), to house ongoing code in these areas. I'll review what I've done there and begin anew on addressing these capabilities

                      1. Detect supported resolutions of a camera
                      2. Determine which resolution a camera is sending
                      3. Set a camera to a specific resolution
                      4. Reduce the frame rate being displayed (to reduce the demands of real-time frame modification)
                      5. Grab/modify video frames real-time

                      I need to spend a little more time on gbThreads but tomorrow will redirect my efforts to Direct Show. Sometimes, setting a problem aside helps a solution come to mind, but I'm not sure that setting something aside for almost a year falls in the same category!

                      If you have dabbled with the code in any of these areas, I'm all ears! More tomorrow once I've revisited my previous code ...

                      Chris(H), by my decade-long SQLite inactivity standards, this thread happened just yesterday!