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

Custom FFmpeg encoder file location bug #8

Closed falko76 closed 4 years ago

falko76 commented 4 years ago

There is a bug when you set the OBS Studio to encode via custom FFmpeg (OBS Studio -> Settings ->Output -> Recording->Type ). If you choose "standard" the script writes cursor file at the same location and name as video file (+ ".txt"). But when you choose "Custom output (FFmpeg)" the cursor file gets stored somewhere in default folders, probably your obs studio folder, and always with the same name "cursor-recorder.txt". This means that when you do multiple videos, all cursor data gets stored into one file which is cumbersome as you need to manually separate each section for each video later on. This section of code gets the video name and path:

            video_path_tuple = os.path.split(obs.obs_data_get_string(output_settings, "path"))
            video_name = video_path_tuple[-1]
            path = video_path_tuple[0]
            # Convert extension to txt from .flv
            name = os.path.splitext(video_name)[0] + '.txt'

but when "custom output FFMpeg" option is selected , the path and name values are empty.

JakubKoralewski commented 4 years ago

Settings when ffmpeg is used:

[cursor_recorder_for_obs.py] [2019-12-09 18:48:51,060] {cursor_recorder_for_obs.py:241} DEBUG - {
[cursor_recorder_for_obs.py]     "audio_bitrate": 160,
[cursor_recorder_for_obs.py]     "audio_encoder": "",
[cursor_recorder_for_obs.py]     "audio_encoder_id": 0,
[cursor_recorder_for_obs.py]     "audio_settings": "",
[cursor_recorder_for_obs.py]     "format_mime_type": "",
[cursor_recorder_for_obs.py]     "format_name": "",
[cursor_recorder_for_obs.py]     "gop_size": 250,
[cursor_recorder_for_obs.py]     "muxer_settings": "",
[cursor_recorder_for_obs.py]     "url": "C:/Users/Admin/Videos/2019-12-09 18-48-51.mp4",
[cursor_recorder_for_obs.py]     "video_bitrate": 2500,
[cursor_recorder_for_obs.py]     "video_encoder": "",
[cursor_recorder_for_obs.py]     "video_encoder_id": 0,
[cursor_recorder_for_obs.py]     "video_settings": ""
[cursor_recorder_for_obs.py] }

Settings when standard is used:

[cursor_recorder_for_obs.py] [2019-12-09 18:55:10,136] {cursor_recorder_for_obs.py:232} DEBUG - {
[cursor_recorder_for_obs.py]     "muxer_settings": "",
[cursor_recorder_for_obs.py]     "path": "C:/Users/Admin/Videos/2019-12-09 18-55-09.mkv"
[cursor_recorder_for_obs.py] }

Seems like all I need to do is check if "path" is empty and then use "url". On it.

falko76 commented 4 years ago

Excellent, that works like a charm now :-) Thanks a lot for your effort.