JakubKoralewski / cursor-recorder

Records mouse movement to a file. Use with OBS Studio as an external Python script or using the standalone Python script. Use the After Effects script to import the generated cursor movement data.
https://obsproject.com/forum/resources/obs-cursor-recorder.789/
Mozilla Public License 2.0
16 stars 0 forks source link

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

Open nicolasdupouymanescau opened 7 months ago

nicolasdupouymanescau commented 7 months ago

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

nicolasdupouymanescau commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

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:

https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L169

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

https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L181

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):

https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L285

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:

https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L254

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

JakubKoralewski commented 7 months ago

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 https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L174-L175
  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 https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L189-L194
  6. you move the cursor after 23s in the recording

but that would be highly unusual 😅

nicolasdupouymanescau commented 7 months ago

I hope you are reading my comments In GitHub's thread and not in your mailbox because I edited them several times.


From: Jakub Koralewski @.> Sent: Wednesday, February 14, 2024 7:12:09 PM To: JakubKoralewski/cursor-recorder @.> Cc: Nicolas Dupouy-Manescau @.>; Author @.> Subject: Re: [JakubKoralewski/cursor-recorder] why isn't the first timecode of the textfile 0 ? (Issue #12)

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 https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L174-L175
  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 https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L189-L194
  6. you move the cursor after 23s in the recording

but that would be highly unusual 😅

— Reply to this email directly, view it on GitHubhttps://github.com/JakubKoralewski/cursor-recorder/issues/12#issuecomment-1944348861, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A7SG5YVUFTBOFLVKRNKTMSLYTT47TAVCNFSM6AAAAABDHQMT6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBUGM2DQOBWGE. You are receiving this because you authored the thread.Message ID: @.***>

nicolasdupouymanescau commented 7 months ago

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):

https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L285

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:

https://github.com/JakubKoralewski/cursor-recorder/blob/2be6781c7a25c564295fae4206e87e7f469623cc/scripts/cursor_recorder_for_obs.py#L254

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 commented 7 months ago

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 commented 7 months ago

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 commented 7 months ago

Let me know if works / any problems

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

JakubKoralewski commented 7 months ago

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 commented 7 months ago

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 commented 6 months ago

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?

nicolasdupouymanescau commented 6 months ago

Same error Le 16 févr. 2024 18:22, Jakub Koralewski @.***> a écrit : I tried the latest version of the script (see link above) Use video FPS checked: 0.033 first and then when starting next recording also 0.033Use video FPS unchecked (30fps): 0.034 first, 0.038 second Can you try again? Maybe you forgot to reload the script?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>