Announcement

Collapse
No announcement yet.

Automatic swing recording with OBS Studio

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic swing recording with OBS Studio

    This is a tutorial on how to setup OBS studio for live streaming/instant replay. You do not need to live stream for this to work.

    Step 1

    Download OBS Studio, Voice attack, and Audio zone trigger.

    Step 2 Setting up OBS Studio:

    1. Open the OBS Studio settings, go to output, and check the box "Enable Replay Buffer"
    Set the length to your desired time. Note: Longer replay buffers require more memory. For this guide we'll use 5 seconds.

    2. In the general settings, check the box to Automatically start replay buffer when streaming.

    3. In the Hotkey settings, set a hotkey for saving the replay buffer. For this guide, we'll use Ctrl+Shift+S.
    Using this hotkey you can still save replays normally, even with Instant Replays setup.

    4. Now, close the settings page and start the replay buffer by clicking on "Start Replay Buffer" towards the bottom right of OBS Studio.

    5. Add a new media source to the current scene, we'll call it "Instant Replay" for this guide, and select the Replay buffer file.
    By default it will be located in the “Videos” folder and the file name will start with Replay.

    6. At the top of OBS Studio, click on tools, then scripts and select “instant-replay.lua”

    7. From the Media Source drop down menu, select the media source you just added to the scene. Then hit close.
    If the media source is not appearing, click on the refresh icon to the left.

    8.Open up the OBS Studio settings again and go to the Hotkeys section. There will be a new hotkey, called "Instant Replay".
    For this guide, we'll set the hotkey to Ctrl+Shift+R.

    9. Now your Instant Replay feature is ready. Simply press the hotkey combination you just chose, and the last 5 seconds will play in the media source. You can now resize the source and move it around.

    10. Add your camera inputs.

    Step 3 Setting up Voice Attack

    1. Open voice attack

    2. Select the option to edit profile

    3. Delete all actions.

    4. Select new command

    5. Setup the command to correspond to the provided screen shot

    6. Hit ok then apply.

    Step 4 Setup Audio Zone Trigger.

    1. Setup According to screen shot, Activate a Key which is f12

    Step 5 Arranging the windows

    1. I can't really walk you though this part but here you will arrange all the windows to fit on your OBS layout. the boxes are all drag and drop.

    2. Change the speed of the "Instant Replay" box to what ever you like. I have mine set at 35.

    3. Once you have everything arranged select lock preview.


    Now you should be all set to go. Here is my setup. Im using 3 cameras.

    Any questions or suggestions I would be glad to help.



    Advanced Version using OBS Plugin plugin Replay Source:

    Ok I'm going to assume you are somewhat comfortable with Obs, you can add camera inputs, and install plugins.

    Step 1 Installing Replay Source OBS

    1. Download from https://github.com/exeldro/obs-replay-source/releases

    2. Unzip the download in the 64 bit plugins folder for example: C:\Program Files (x86)\obs-studio\obs-plugins\64bit

    Step 2 OBS

    1. Create a new scene

    Step 3 OBS

    1. Add one video capture source name it DTL, make sure to adjust the camera and set it to highest fps

    2. Add "ReplayInput" source, name it DTL slow, then select your camera and change the following values:
    Duration 4
    Maximum replays 1

    3. Go to the hot keys section. Find the "DTL slow" source, add shift+S as the hotkey to "Load Replay"

    Step 4 Audio zone trigger

    1. Use the same settings as the previous guide, on trigger press f12

    Step 5 Voice attack

    1. disable / delete the previous command.

    2. Create a command that triggers on f12, pauses for 2 seconds, then presses Shift+S

    Step 5

    1. Hope it works


    Here is a live example if I'm online:
    Twitch is the world's leading video platform and community for gamers.



    Last edited by htdumps; 01-27-2019, 07:24 PM.

  • #2
    Verion 2 of this tutorial coming soon. Using different OBS plugins for higher fps

    Comment


    • #3
      I guess i need a microphone to make this work. Any considerations choosing one?

      Comment


      • #4
        Originally posted by Snaphook View Post
        I guess i need a microphone to make this work. Any considerations choosing one?
        Im using an old webcam as a mic, if you want to be fancy logitech 920c and add it as another source of video.

        Comment


        • #5
          Updated the better way to do the slowmo

          Comment


          • sherrow70
            sherrow70 commented
            Editing a comment
            I can’t find this folder . Add a new media source to the current scene, we'll call it "Instant Replay" for this guide, and select the Replay buffer file.
            By default it will be located in the “Videos” folder and the file name will start with Replay.

            I looked everywhere

          • htdumps
            htdumps commented
            Editing a comment
            You have to start the replay buffer.

        • #6
          Originally posted by htdumps View Post

          2. Unzip the download in the 64 bit plugins folder for example: C:\Program Files (x86)\obs-studio\obs-plugins\64bit



          Step 3 OBS

          1. Add one video capture source name it DTL, make sure to adjust the camera and set it to highest fps

          2. Add "ReplayInput" source, name it DTL slow, then select your camera and change the following values:
          Duration 4
          Maximum replays 1
          Thanks for posting this.
          Here are some noob questions i hope you can help with.

          1. Add one video capture source name it DTL, make sure to adjust the camera and set it to highest fps. Only one camera? Do i make another one and name it FO?

          Last edited by Snaphook; 01-27-2019, 11:07 AM.

          Comment


          • htdumps
            htdumps commented
            Editing a comment
            Yes. This was just kinda a basic setup

        • #7
          Htdumps when explaining the advanced option what does the exactly do.

          Comment


          • htdumps
            htdumps commented
            Editing a comment
            Its another way to get slow motion replay. It's more sensitive to timing but if set right you can capture the swing perfectly timed. The first method is limited to 5 seconds of replay time when I really only needed 4 for my swing.

        • #8
          Thanks for the tutorial!

          I just started digging through the other posts using Kinovea to see if I could incorporate video capture into my setup so good timing!

          1. In your experience, are there pros/cons to using this OBS setup instead of Kinovea setup?

          2. Do you have any recommendations on which cameras to use? The older posts suggest a few options but I suspect there might be better tech available now (with fps being a priority).

          Appreciate the help!

          Comment


          • htdumps
            htdumps commented
            Editing a comment
            1. I still use Kinovea because it can do frame by frame. The issue with Kinovea is that my cameras are to high of frame-rate for the older software to completely buffer. Using the scripts provided here I couldn't get it working just how I wanted it.

            2. Depends on how much light you have in your space. Im using these cameras but they need a lot of light for 330 fps. https://www.amazon.com/dp/B0742BMJXX..._GiZsCbGX2NJ0B

        • #9
          Another photo I setup for user Catdaddy.

          Comment


          • #10
            Can not edit original post but should change the hotkey to F5, not f12. It breaks TGC sometimes on the screen shot screen.

            Comment


            • #11
              Testing out new cameras soon if your interested Non Distortion Global Shutter High Speed 120fps Webcam UVC Plug Play Driverle... https://www.amazon.com/dp/B07H92YD3S..._GzvuCb12JS0BD via @amazon

              Comment


              • gkkling
                gkkling commented
                Editing a comment
                Cool! I saw those Kayeton cameras on Amazon but there wasn't much info. Global Shutter and 120fps seems to be a sweet spot. Out of curiosity will you test with both Kinovea and OBS? I may be off the mark but compatibility seems to be a factor for some of these cameras. Good luck and have fun!

                Just noticed that it is USB 2.0. Do you think that will be an issue?
                Last edited by gkkling; 01-30-2019, 03:02 PM.

              • htdumps
                htdumps commented
                Editing a comment
                I will let you know they should be here in a week. I will do a definitive breakdown of the cameras since I have 3 different ones now.

              • FaultyClubs
                FaultyClubs commented
                Editing a comment
                You should get the one in a case.

                It's UVC compliant and works perfectly with every software I've tried.

                Nice, simple camera. Does what they claim and nothing more.

            • #12
              Was able to get iPhone working as 240 fps input into OBS. Much better than any webcam so far. Still need a lot of light.
              Last edited by htdumps; 01-31-2019, 07:18 AM.

              Comment


              • Anansi
                Anansi commented
                Editing a comment
                Howdy! How did you get iPhone to work at 240 FPS? I've managed to get it working at 120, but the phone app crashes when I try to further increase the FPS.

              • scoobanny
                scoobanny commented
                Editing a comment
                How did you guys manage to have it output 120 or 240 fps? I can only get 60…

            • #13
              Can obs replace kinovea? If so what makes it better?

              For me the simplest useful functionality would be:

              - automatically trigger recording based on impact sound and capture few seconds before sound and few after (settable)
              - automatically playback the captured video first at 1/4 speed, next at 1/10 speed (twice) and final at full speed
              - manually do frame by frame if I wish
              - automatically repeat for every shot
              - resizable windows
              ​​​​​
              Can it do that?

              Comment


              • htdumps
                htdumps commented
                Editing a comment
                All but - manually do frame by frame if I wish. It still requites using audio zone trigger and voice attack until someone can help me out with an auto it script to make it work with just a key press activated by a sound.

                I like it because I can rotate my cameras through OBS, the advanced version of the tutorial should have been the only was to suggest it but I can't edit the post. I also stream my games for lesson purposes, getting kinovea to stream replays was a pain. The capture is done in a memory buffer and is very professional with OBS. Overall the kinovea solution is great with one camera but I have 3 going now and plan to add another, this is not possible with kinovea. I just like tinkering so its more fun in general to use OBS.

                If you want I could teamviwer in and set it all up so you could test. The setup literally takes minutes.

            • #14
              OK, I think I've got it up and running but it's not preserving the frame rate properly.

              I'm recording with 120 fps camera so 12.5% replay speed should be 15 frames per second and smooth but instead it is jerky.

              The actual time is 8x realtime as expected but the frames per second is half what it should be!

              I must be missing a setting somewhere. Either that or my laptop can't keep up (but OBS isn't complaining).

              What settings are required to have the slow motion utilize the full 120 fps input? What settings you use when doing 240fps of the iphone or the 330fps camera?

              Thanks.

              Comment


              • FaultyClubs
                FaultyClubs commented
                Editing a comment
                Sorry I didn't see you comment about the stop watch before posting my test. A stop watch can be a good test if done properly. What did you do exactly? It is easy to do the stop watch test wrong.

                How about doing my test also and reporting back.

              • htdumps
                htdumps commented
                Editing a comment
                Its my fault for jumping the gun on the tutorial. If I could edit it I would. I just worked with the developer of replay source he was able to a a local buffer so now all we need is audio zone trigger. Ill post an updated tutorial tomorrow when I get the mods to let me edit the thread. But here is the short version.

                1.create new scene
                2.add your two cameras
                3.add two replay source's from your cameras
                4.adjust the timing offsets
                5 look for the new option of local delay set it to 3 or however long you want.
                6, set the trigger for audio son to F5
                7.set the replay source triggers

              • FaultyClubs
                FaultyClubs commented
                Editing a comment
                Reducing the number of required external programs is definitely a plus. Nice the Replay Source guy is responsive. Not sure why you posted in this comment section though since it has nothing to do with OBS properly recording high speed cameras.

                Still waiting for your results to the test I requested. And exactly how you did your stop watch test.

            • #15
              My previous post showed OBS reducing my 120 fps camera down to 60 fps for recording and slow motion playback. I explained in the comments to that post what appeared to be happening.

              I had some time today to perform more tests as described below.

              I tested with my 120 fps global shutter camera. I picked this because it has only one video mode which is 1280x720 at 120 fps. It has no other modes or speeds which can be mistakenly used to confuse the test results. I then set OBS internal frame rate to 30 fps (Settings/Video/FPS) so the speed difference would be obvious (120 vs 30) if OBS re-encodes the camera down to that rate at any point.

              1) First test was the one I asked HT to do above (although I wanted him to use his 330 fps camera). Run OBS at 30 fps (Settings/Video/FPS=30) and my camera at 120 fps. Then dump the replay's memory buffer. It will be at 120 fps if OBS is capturing at the full rate. Otherwise it'll be 30 fps.

              Result: Rate is 30 fps.

              2) Second test was the stop watch test. I recorded my phones digital stop watch. At 120 frames per second there will be 12 frames for every 0.1 second tick over. 30 fps will have 3 frames every 1/10 of a second. I then dumped the replay memory buffer and stepped through it frame by frame counting how many frames per 1/10 of a second tick mark.

              Result: 3 frames every 1/10 of a second tick mark = 30 fps

              3) Third test was only looking at the slow motion replay. I set the playback speed to 1%. At 120 frames per second this means there will be 1.2 frames per second (or 2.5 seconds for three frames). At 30 fps there will be 0.3 frame per second (or 10 seconds for three frames). I then captured a moving object (big arm wave) to make it easy to see when a new frame occurs and measured the time for three frames.

              Result: 10 seconds for three frames = 30 fps

              4) I redid test #1 and #3 with OBS set at 60 fps (you have to exit and restart OBS for the new setting to take effect). Results were 60 fps.


              CONCLUSION:

              My 120 fps camera has been re-encoded to run at the OBS rate. There is no setting to turn this off.

              As I said in earlier post, OBS can run at a maximum of 120 fps (EDIT: Correction - if you use the fractional fps setting it can go higher). So those of us with 120 fps cameras should be OK, just be sure to set OBS to 120 fps. Leaving OBS at the default 30 or 60 fps will result in your 120 fps camera being dumbed down to the lower rate.

              This data suggests there is no point running cameras faster than 120 fps...they will be dumbed down to at least 120 fps or lower depending on the OBS frame rate setting. (EDIT: Correction - the fractional fps setting will allow higher settings. How well it works remains to be seen since OBS screens will be running at that rate as well).

              Anyway, that consumed an hour of my life, I'm not sure it was worth it. Definitely exceeds my interest level but I had started it so thought I should try to finish. I'll leave it to others to confirm or deny these results (or figure out what any of it means if HT's results are correct where he says OBS is working at the faster rates above 120 fps).
              Last edited by FaultyClubs; 02-03-2019, 04:19 AM.

              Comment

              Working...
              X