Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why isn't the first timecode of the textfile 0 ? #12

Open
nicolasdupouymanescau opened this issue Feb 14, 2024 · 13 comments · May be fixed by #17
Open

why isn't the first timecode of the textfile 0 ? #12

nicolasdupouymanescau opened this issue Feb 14, 2024 · 13 comments · May be fixed by #17
Labels
bug Something isn't working

Comments

@nicolasdupouymanescau
Copy link

nicolasdupouymanescau commented Feb 14, 2024

problem : the first line in the text file gives a timecode that seems pretty arbitrary such as
23.33333194255829 1182 -428

@nicolasdupouymanescau nicolasdupouymanescau changed the title make the first position keyframe be the layer inPoint why isn't the first timecode of the textfile 0 ? Feb 14, 2024
@nicolasdupouymanescau
Copy link
Author

nicolasdupouymanescau commented Feb 14, 2024

I think I figured out but I am not able to fix it.
To me it seems that the timecode of the saved text file is the elapsed time in OBS instead of being the elapsed time of the recording.

@nicolasdupouymanescau
Copy link
Author

nicolasdupouymanescau commented Feb 14, 2024

This issue occurs when the checkbox "Use's video FPS to capture cursor" is ticked in cursor-recorder UI in OBS. If the checkbox in not ticked, the first timecode will be 0.

@JakubKoralewski
Copy link
Owner

Thanks for providing when the issue appears, that helps.

The issue needs to lie in cursor_recorder since that function is called instead of script_tick when use video fps is unchecked:

def cursor_recorder():

The code waits for 1/custom_fps value before taking first cursor measurement:

time.sleep(refresh_rate)

But given that the time provided by you (23seconds) then it's impossible to set a custom_fps value necessary for this to happen (~0.04fps):

custom_fps = obs.obs_properties_add_int_slider(props, "custom_fps", "Custom FPS", 1, 200, 1)

What is the value of "Custom FPS" you have set?

It's also possible that starting a separate thread for saving the cursor positions when in custom fps mode is causing a lag but it shouldn't be 23 seconds:

threading.Thread(target=cursor_recorder).start()

Let me know if you can share any more information that could help debug this. Did you try restarting OBS? 😅

@JakubKoralewski
Copy link
Owner

I can see also a possibility where:

  1. you start a recording
  2. prev_x and prev_y are no longer -1, but some real values
    prev_x = -1
    prev_y = -1
  3. the recording is stopped without moving the mouse (keyboard shortcuts?)
  4. new recording is started without moving the mouse
  5. x == prev_x and y == prev_y so the cursor position is not saved
    if prev_x == x and prev_y == y:
    skipping = True
    if should_exit():
    break
    continue
  6. you move the cursor after 23s in the recording

but that would be highly unusual 😅

@nicolasdupouymanescau
Copy link
Author

nicolasdupouymanescau commented Feb 14, 2024 via email

@nicolasdupouymanescau
Copy link
Author

nicolasdupouymanescau commented Feb 14, 2024

But given that the time provided by you (23seconds) then it's impossible to set a custom_fps value necessary for this to happen (~0.04fps):

custom_fps = obs.obs_properties_add_int_slider(props, "custom_fps", "Custom FPS", 1, 200, 1)

I don't understand what you are telling me here.

What is the value of "Custom FPS" you have set?

30 FPS, also tried with 25 FPS but results in same problem;

It's also possible that starting a separate thread for saving the cursor positions when in custom fps mode is causing a lag but it shouldn't be 23 seconds:

threading.Thread(target=cursor_recorder).start()

I ran different tests without closing OBS, the timecodes were increasing from the first text file to the last one. At the end It showed a timecode of 421 in the first line, that's how I deduced that the script writes logs of the tim elapsed in OBS

Let me know if you can share any more information that could help debug this. Did you try restarting OBS? 😅

seriously ? yes

@JakubKoralewski
Copy link
Owner

thank you for your patience, I was wrong about the possible cause, your intuition was correct. I think I have found the problem. It's as you said, the starting time was never reset. Please try this script: (haven't tested)

https://github.com/JakubKoralewski/cursor-recorder/blob/%2312/scripts/cursor_recorder_for_obs.py

Let me know if works / any problems

@nicolasdupouymanescau
Copy link
Author

nicolasdupouymanescau commented Feb 14, 2024

I will try that. I also suggest that when the "use video fps to capture cursor" is ticked, the "custom FPS" slider gets greyed out to make the difference between the 2 options clear for the user.

Also in your installation tutorial, recommend the windows users to start OBS with administrator privileges by default by creating a shortcut of OBS then and ticking "always launch as administrator" in the shortcut settings.

@nicolasdupouymanescau
Copy link
Author

Let me know if works / any problems

that update you did broke it, i no more see generated text files

@JakubKoralewski
Copy link
Owner

works for me, it may only get saved after recording is stopped now, made some changes but probably just some stuff was broken on mac

@nicolasdupouymanescau
Copy link
Author

ok I see these text files again and works fine with the first recording but from the second recording the first lines are

16.233332365751266 1667 798
16.26666569709778 1664 798
16.29999902844429 1633 798
16.333332359790802 1577 798
16.366665691137314 1475 800
16.399999022483826 1410 808
16.433332353830338 1341 823
16.46666568517685 1283 835
16.49999901652336 1221 837
16.533332347869873 1180 837
16.566665679216385 1145 837
16.599999010562897 1079 832
16.63333234190941 1036 817
16.66666567325592 1025 809

@JakubKoralewski
Copy link
Owner

I tried the latest version of the script (see link above)

  1. Use video FPS checked: 0.033 first and then when starting next recording also 0.033
  2. Use video FPS unchecked (30fps): 0.034 first, 0.038 second

Can you try again? Maybe you forgot to reload the script?

@JakubKoralewski JakubKoralewski added the bug Something isn't working label Feb 16, 2024
@JakubKoralewski JakubKoralewski linked a pull request Feb 16, 2024 that will close this issue
@nicolasdupouymanescau
Copy link
Author

nicolasdupouymanescau commented Feb 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants