Records mouse movement to a file and opens it in After Effects. Use with OBS Studio as an external Python script or if you prefer a more manual approach, using the standalone Python script. Then use the After Effects script to import the generated cursor movement data.
-
Download the files:
- cursor_recorder_for_obs.py
- from obsproject.com
- or this repository.
- Cursor Recorder for After Effects.jsx
- from this repository
- cursor_recorder_for_obs.py
-
Import the cursor_recorder_for_obs.py in OBS. (You need to do this just once).
- Go to
Tools -> Scripts
. - Make sure you have a Python (3.6.x) interpreter installed and its path set in OBS' settings (
Scripts -> Python Settings
). - Click the ➕ icon (Add Scripts) and select the cursor_recorder_for_obs.py.
- Make sure the script is enabled. (It is by default).
- Click
Install Python modules
if you don't havepyautogui
and/orkeyboard
packages installed.
- Go to
-
You're ready to start recording. The *.txt will be saved in the same place as your video with the same name.
-
Stop the recording.
-
Import the Cursor Recorder for After Effects.jsx in After Effects. (You need to do this just once).
- Go to the folder you installed After Effects.
- To be exact, go here (e.g.:
Adobe After Effects CC 2019
)\Support Files\Scripts\ScriptUI Panels
. - Place the Cursor Recorder for After Effects.jsx file in the
ScriptUI Panels
folder.
-
Run the Cursor Recorder for After Effects.jsx script.
- Open After Effects.
- Go to
Window ->
scroll down to theCursor Recorder for After Effects.jsx
script and click it. - Click the help buttons for more info.
-
Checkout the
Add Expressions
section in theCursor Recorder for After Effects
script to quickly add predefined effects. -
Do whatever you want with it from here. Check out the Examples section below!
- Use the cursor_recorder_standalone.py.
- Specify
refresh_rate
variable inside the code for your needs. - File with the cursor movement should get saved to the same directory as your script.
- Import to After Effects.
thisLayerScale = transform.scale;
cursorX = thisComp.layer("cursor-recorder-movement").transform.position[0];
cursorY = thisComp.layer("cursor-recorder-movement").transform.position[1];
xvalue = linear(thisLayerScale[0], 100, 200, cursorX + 960, 1920);
yvalue = linear(thisLayerScale[0], 100, 200, cursorY + 540, 1080);
[xvalue - cursorX, yvalue - cursorY];
// Expression set on video's anchor point
thisComp.layer("cursor-recorder-movement").transform.position;
The images are links to streamable.com
You can do this:
This can give you some ideas:
This may seem like an overkill but I'm supposed to advertise a product so here you go:
BTW this is from this browser extension of mine (I'm really selling out right now)
I encourage you to fork, open issues and pull requests! ❤️
The script is developed using TypeScript. There are following commands available:
"scripts": {
"watch": "tsc -w",
"build": "tsc && cd .. && sed -i '/\\$/d' 'Cursor Recorder for After Effects.jsx' && cat afterfx/license.txt > temp.jsx && cat 'Cursor Recorder for After Effects.jsx' >> temp.jsx && mv temp.jsx 'Cursor Recorder for After Effects.jsx'"
},
Your current directory being scripts\afterfx
:
Run npm run watch
for auto-reload.
The file will get saved to scripts\Cursor Recorder for After Effects.jsx
.
Copy it to the ExtendScript Toolkit and run it or copy the whole file to the ScriptUI Panels
in your After Effects installation.
Run npm run build
to have a production friendly version.
The "build"
script compiles the TypeScript file, removes comments and adds a copyright notice.
Currently OBS supports only 3.6.x Python interpreters!
You can debug the Python script inside PyCharm following the instructions for "Python Remote Debug" as shown below:
The script requires: pyautogui
and keyboard
. Install them yourself or using this command:
$ pip install -r requirements.txt