Penwy / adv-ff

Advanced Filename Formatter script for OBS Studio
GNU General Public License v2.0
18 stars 2 forks source link

Crashing OBS when recording Call of Duty: MW 3 #5

Closed zhbanok closed 2 months ago

zhbanok commented 2 months ago

I have been using the script for months and this is the first time I have encountered this problem.

When I try to record Call of Duty MW3 from game pass (OBS with Windows Capture) my OBS (custom build based on 30.2.3) crashed.

Formatting for records: Replay%CCYY-%MM-%DD %hh-%mm-%ss [v$1[title]$] Windows Capture name: [cod.exe]: [C​a​l​l​ ​o​f​ ​D​u​t​y​®​ ​H​Q] Name of record after crash looks like: Replay2024-08-26 03-13-29 [C​a​l​l​ ​o​f​ ​D​u​t​y​®​ ​H​Q​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​�

When I open script and click test i see that in console (only with that game):

[adv-ff.py] Found pyparsing 3.1.2
[adv-ff.py] Traceback (most recent call last):
[adv-ff.py]   File "C:\Program Files/obs-studio/data/obs-plugins/frontend-tools/scripts\adv-ff.py", line 764, in rec_tester
[adv-ff.py]     result = os_generate_formatted_filename("", get_space(), interpreter(rec_parser.tree, data, error_counter, increase_counters=False, sanitize=(platform.system()=="Windows")))
[adv-ff.py]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[adv-ff.py]   File "C:\Program Files/obs-studio/data/obs-plugins/frontend-tools/scripts\adv-ff.py", line 297, in os_generate_formatted_filename
[adv-ff.py]     return value.decode("utf-8")
[adv-ff.py]            ^^^^^^^^^^^^^^^^^^^^^
[adv-ff.py] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 254: unexpected end of data

It seems that some titles of games dont get proper sanitize and some special characters that returned in filename from script crash OBS in some way. What interesting after crash recording still works until click ok or stop recording by hotkey. Video file playable after adding extension.

I changed some code and after that recording works fine. This is not a solution, just a confirmation of problem with a script?

return_string = re.sub('[^0-9a-zA-Zа-яА-Я\[\]_ -.=]+', '', return_string)

instead of

return_string = re.sub(r"[\*\"<>:\|\?]", "_", return_string)
Penwy commented 2 months ago

Ok yeah I think I see the issue (call of duty is a bitch and inserts something like 70 zero-width spaces for zero reason), ty for reporting I'll try to address it as fast as I can

Penwy commented 2 months ago

You can grab the adv-ff.py from master, the two most recent commits should have fixed it. I'll do a release with it once I fixed a few others issues I have on the backlog.