Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER for Video Editing/Mangling

Reply
 
Thread Tools Display Modes
Old 01-23-2021, 05:56 AM   #1
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default Recording Videos in REAPER (Through OBS)

Did you ever want to record videos in REAPER as easily as you can audio? Maybe youíre doing video tutorials, maybe youíre doing videosongsÖ

I built a bridge between REAPER and OBS to do just that:

leafac is offline   Reply With Quote
Old 01-24-2021, 12:18 PM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

Ok, I tried to get it run on Windows but there are some issues, with some that I could fix, others I couldn't.

Basically, you run the command "leafac_obs-cli.exe". On my system, it looks like this:

Code:
'C:\Ultraschall-US_API_4.1.001/Data/leafac_obs-cli.exe' --address 'localhost:4444' --password '' --field 0.rec-folder GetRecordingFolder 'SetRecordingFolder={ "rec-folder": "D:\Users\Meo-Ada Mespotine\Documents\REAPER Media/" }' StartRecording
One thing(that I can fix) is that you use / as folder-separator, where Windows uses \ on it.
So on Windows, you need to use string.gsub to replace all / with \\ on the path for leafac_obs-cli.exe

'C:\Ultraschall-US_API_4.1.001/Data/leafac_obs-cli.exe'
becomes this:
'C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe'

whereas on Linux and Mac, this isn't necessary.

Now the other problem is that, when I run the line in the command-line, just as it is(and with the separators corrected),

Code:
'C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe' --address 'localhost:4444' --password '' --field 0.rec-folder GetRecordingFolder 'SetRecordingFolder={ "rec-folder": "D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\" }' StartRecording
it will return an error-message "unexpected end of JSON input".

This I can't fix, as I have no experience with JSON, so maybe, you can check, what could be wrong in the line above.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-26-2021, 03:18 AM   #3
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Thanks for helping me out here!

Regarding slashes: Okay, that’s an easy fix. I had read online that Windows allowed backslashes and forward slashes interchangeably. As it turns out, that’s not the case.

Regarding the JSON issue: The problem here is the quotes. I Googled around to learn more about this; can you please try some of the combinations below?

Code:
SetRecordingFolder='{ "rec-folder": "D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\" }'
"SetRecordingFolder={ \"rec-folder\": \"D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\\" }"
"SetRecordingFolder={ ^"rec-folder^": ^"D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\^" }"
"SetRecordingFolder={ """rec-folder""": """D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\""" }"
With this two fixes I think we’ll get the action working on Windows.

(The error message complaining about JSON means that the leafac_obs-cli.exe itself is working. It’s even getting to the part where it tries to parse the JSON. That’s great news, since I haven’t tested the executable on Windows at all!)
leafac is offline   Reply With Quote
Old 01-27-2021, 06:25 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

They all return unexpected token in JSON.

I used variations of this line:
Code:
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" --address 'localhost:4444' --password '' --field 0.rec-folder GetRecordingFolder "SetRecordingFolder={ """rec-folder""": """D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\""" }"
1) unexpected token ' in JSON at position 0

2) unexpected token U in JSON at position 20

3) unexpected token ^ in JSON at position 2

4) unexpected token U in JSON at position 20

In regards of / being accepted for \ as well, yes this is for most Lua/ReaScript-functions, but there are some exceptions. For instance, all functions that execute commands in a commandline, need \\ instead of / on Windows, as only Lua converts / to \\. But ExecProcess basically passes over a string with the command-options you put into it. So lua doesn't know, it has filenames in it and doesn't do any conversion.
Lua wouldn't also know, how to do it, as a / can be for an option of a command or a path-separator in filenames. As you can have both in this string, Lua cannot convert it without possible edge-cases.
Long story short: when working with command-line-stuff within Lua, keep track of separators, otherwise, Lua does it for you.
(Maybe os.execute is an exception, but it pops up a shell-window on Windows, so it's probably not an option).

I've added a note to my docs for future reference. So the next update will feature a note about separators:
https://mespotin.uber.space/Ultrasch...ml#ExecProcess

Edit:
I have a strong feeling, that the JSON-problem could have something to do with " or '
Maybe I'm wrong about that, but maybe this in combination with the command-line-behavior could mess up itself somehow.

BTW: Is there an option in leafac_obs-cli.exe to just check, if the connection is successfully established or not? Maybe I can write a small configurator-script, that also includes a small button to check, whether the settings work successfully or need to be changed again.
Could be helpful for less experienced people to get, if the settings don't work at all and to report problems related to that.
But I would need to have the option to get a "success" or "failed" returnmessage by the leafac_obs-cli.exe-tool.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-28-2021, 05:06 PM   #5
Ericoid
Human being with feelings
 
Join Date: Dec 2020
Posts: 8
Default So I was thinking...

This is really cool and all but... Now maybe this is a stupid idea but, how hard would it be to wrap the source code from obs and just make it a reaper extension or plugin? I'm trying to figure out where to start with that atm...
Ericoid is offline   Reply With Quote
Old 01-31-2021, 09:33 AM   #6
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Mespotine:

Thanks for the explanation about backward vs forward slashes 😀

This will be easy to fix once we get the quotes right.

First, I learned that I should be using double quotes everywhere instead of single quotes, so things like --address 'localhost:4444' should be replaced with --address "localhost:4444".

(Aside: By coincidence, I ran into a similar problem of quotes on Windows when working on a completely unrelated project. I eventually found this: https://github.com/prettier/prettier...ment-392817015)

Now itís only a matter of figuring out how to escape those double quotes in the JSON. Thereís no other way because both Windows & JSON require double quotes.

Here are some options that may work that I ask you to please try:

Code:
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ `"rec-folder`": `"D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\`" }"
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ ^"rec-folder^": ^"D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\^" }"
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ \"rec-folder\": \"D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\\" }"
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ \\"rec-folder\\": \\"D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\\\" }"
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ ""rec-folder"": ""D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\"" }"
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ """rec-folder""": """D:\Users\Meo-Ada Mespotine\Documents\REAPER Media\""" }"
I made the commands simpler by removing extra arguments that we donít need for the test (things like --address).

Youíll know that it worked because: 1. It wonít complain about JSON parsing; and 2. Your recording folder will have changed in OBS (you can check that under Settings > Output > Recording > Recording Path).

For reference, here are some links I collected while doing research on this:

https://stackoverflow.com/questions/...meter/15262019
http://www.windowsinspired.com/under...ndows-program/
https://stackoverflow.com/questions/...cript/44169953
https://stackoverflow.com/questions/...gn-in-a-comman
https://superuser.com/questions/1824...and-as-example
https://community.idera.com/database...ershell-script
https://www.gnu.org/software/gawk/ma...S-Quoting.html

If the options I listed above donít work and youíre so inclined, you may want to try some of the suggestions on these links.

(This is a surprising and frustrating problem weíre having :/)

Thank you very much for your help! 😃

Quote:
Is there an option in leafac_obs-cli.exe to just check, if the connection is successfully established or not?
You can use something like leafac_obs-cli.exe GetStreamingStatus. If you think thereís value in having an option to simply try to connect to OBS and report on the success of that, I can add it (in case it isnít clear, I created obs-cli as well https://github.com/leafac/obs-cli).

Ericoid:

Quote:
how hard would it be to wrap the source code from obs and just make it a reaper extension or plugin?
I donít think it would be easy. Also, OBS does so much: Scene switching, different video sources, plugins, and so forth. I think itíd be complicated to navigate around all this. And then thereís the problem of familiarity: Many people are used to OBS and already have their stuff set up, so I think itís more powerful to just connect OBS & REAPER.

That said, Iím interested in whatever you end up creating! Make sure you report back here 😃
leafac is offline   Reply With Quote
Old 02-02-2021, 05:04 PM   #7
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

Ok, tried all of them, still JSON-parser issues:

1) Unexpected token ` in JSON at position 2
2) Unexpected token ^ in JSON at position 2
3) Unexpected token U in JSON at position 20
4) Unexpected token \ in JSON at position 2
5) Unexpected token U in JSON at position 20
6) Unexpected token U in JSON at position 20

Maybe we should do it in another way. Could you add a testmode, that allows parsing a minimal JSON-string to the command-line-tool? Something that must work for sure, even if it doesn't do anything useful. Something like a "Hello World"-equivalent for JSON.
Cause, if that doesn't work, then the tool doesn't accept the JSON in the first place, may it be due a faulty parser or just a problem with the command-line-option.
If it works, then it's only a JSON-syntax-problem.

Another thing would be to try to work with an external file, which holds the JSON. Command-lines on Windows are known to have issues with Unicode, when the wrong codepage is set. Maybe it's an issue with unicode, so reading the JSON directly from a temporary file(which could be deleted by the tool afterwards) could circumvent such an issue.

Edit:

The following seems to be accepted by the parser. I have no idea, whether it is correct in it's contents, but at least, no parsing problem anymore.

Code:
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ """rec-folder""": ""D:\\Users\\Meo-Ada Mespotine\\Documents\\REAPER Media"" }"
CFillion helped me with that.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish

Last edited by Meo-Ada Mespotine; 02-02-2021 at 05:32 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-03-2021, 03:41 PM   #8
Dstruct
Human being with feelings
 
Join Date: Jul 2006
Posts: 12,377
Default

Imagine we could do this in REAPE natively (since Justin also did LICEcap):

-> record-arm a track in REAPER
-> choose "Screencapture" (with suboptions like "Desktop", "active Application window", "Webcam") as input
-> record

Result: Video recorded on REAPER track


This would be dope :-)

Last edited by Dstruct; 02-03-2021 at 03:56 PM.
Dstruct is offline   Reply With Quote
Old 02-03-2021, 07:58 PM   #9
BenK-msx
Human being with feelings
 
BenK-msx's Avatar
 
Join Date: Jun 2008
Location: Whales, UK
Posts: 5,852
Default

V Long requested.. would be awesome, so many use cases..

Is this obs effort working well now? (Don't worry will check!)
Thanks for the work..
__________________
JS Super8 Looper Template & intro | BCF2000 uber info Thread | Who killed the Lounge?

Last edited by BenK-msx; 02-03-2021 at 08:04 PM.
BenK-msx is offline   Reply With Quote
Old 02-04-2021, 06:07 AM   #10
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

On Mac, yes. On Windows we're on it.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-04-2021, 11:04 AM   #11
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 859
Default

thanks for the "right" string.

i got it running with some more " and string.gsub the reaper.get
tproject to get more \

fiddling with the command string (the ' set to ")
and voila

obs records while reaper plays. on windows.

i won't show the code here but leave it to leandro, to get this into shape. i guess there is more ongoing and this is only one
construction site.

lua ain't too bad.
__________________
tedious REAPER stuff|my Chordgun Variation
rem _startup.lua listen >>>LV2 <<<
Search in Forum
bobobo is offline   Reply With Quote
Old 02-04-2021, 01:47 PM   #12
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

Can you post your modified line as well as reference for leafac to check against?
Multiple working examples are always helpful.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-04-2021, 04:27 PM   #13
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Hey everyone,

I think I figured out this Windows situation! Can you please update to 2.6.3, give it a try, and report back?

Caveat: I tested that REAPER could control OBS, but I couldn’t do an actual test recording because my computer couldn’t handle it (see below); that’s why I need your help to test

Here’s the full story:

I don’t have a PC, and I don’t have a Windows license, so the only way I can test on Windows is with one of those virtual machines that Microsoft makes available for web developers to test their stuff on Internet Explorer and Edge. I wanted to avoid this as much as possible, because working in virtual machines is always painful, and my physical machine isn’t the fastest…

Anyway, I bit the bullet, my computer fans went flying, and here’s what I learned:

1. Windows really does seem to not care about forward vs backward slashes. I tried paths like C:\Users/IEUser\Download/leafac_obs-cli.exe on cmd.exe and on reaper.ExecProcess(), and they worked. For simplicity, I’m not changing the script to convert forward slashes into backward slashes. If that really becomes a problem for you let me know.

2. There are three different ways to escape double quotes in parameters, depending on the context:

Code:
'I am a single command-line parameter including a escaped double quote " and then some more text'
This is how it works in the macOS/Linux command line, and in reaper.ExecProcess() in macOS (I bet that reaper.ExecProcess() in Linux would be the same, but I’m not pulling another virtual machine to try it out).

Code:
"I am a single command-line parameter including a escaped double quote "" and then some more text"
This is how it works in cmd.exe on Windows.

Code:
"I am a single command-line parameter including a escaped double quote \" and then some more text"
This is how it works on reaper.ExecProcess() on Windows.

Fact 1: The behavior of reaper.ExecProcess() depends on the operating system. And note how cmd.exe and reaper.ExecProcess() don’t look the same on Windows.

Fact 2: The ' ... " ... ' pattern works on the macOS/Linux command line, but not on reaper.ExecProcess() on macOS.

Conclusion: There’s no single cross-platform way that I could find to escape quotes; you must check in which operating system you are and adapt (' ... " ...' for macOS/Linux and " ... \" ..." for Windows). Oh, and of course if you have backslashes in the values (like I had, because they were Windows paths like C:\Users\...), then you have to string.gsub(value, [[\]], [[\\]]) on Windows.
leafac is offline   Reply With Quote
Old 02-04-2021, 10:02 PM   #14
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 859
Default

maybe if placeholders for all the " ' / are used and replaced and mangled os-wise before running.

testing as soon as possible

anyhow i will post my efforts here as soon as i get my windows-maschine at hands.

and without this i had been lost
Quote:
Code:
"C:\Ultraschall-US_API_4.1.001\Data\leafac_obs-cli.exe" "SetRecordingFolder={ """rec-folder""": ""D:\\Users\\Meo-Ada Mespotine\\Documents\\REAPER Media"" }"
it wasn't too difficult to get the code right at least to get the start thing running for windows.
__________________
tedious REAPER stuff|my Chordgun Variation
rem _startup.lua listen >>>LV2 <<<
Search in Forum
bobobo is offline   Reply With Quote
Old 02-05-2021, 02:12 AM   #15
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 859
Default

Ha..
leandro made a fine job.. running in windows now with the 2.6.3

going to test it in linux know.


only for comparison reason

so here is my edited for Windows Start-recording script
marked the edited lines with --here
and those pending editing with --here TODO

https://stash.reaper.fm/v/41283/obs_edt.lua
__________________
tedious REAPER stuff|my Chordgun Variation
rem _startup.lua listen >>>LV2 <<<
Search in Forum

Last edited by bobobo; 02-06-2021 at 12:08 AM.
bobobo is offline   Reply With Quote
Old 02-05-2021, 05:09 AM   #16
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 859
Thumbs up

got some difficulties running the obs-websocket in my linux (debian 10) the obs-studio is too old ..

i got an older version obs-websocket_4.5.1-1_amd64.deb

and VOILA

Linux is ok
tested in debian 10 obs 22er-Version with obs-websocket 4.5.1.1


Well Done


one thing..
obs records to an extension flv.
the script "wants" mkv

START and STOP are OK (using mov as extension in both scripts) (and set that as output in obs as well)

but loading fails when using TOGGLE

TOGGLE complains about a not running obs, though recording itself is ok

i resolved this , obs output to mov as well as in the scripts.

all three run flawless in my debian10 linux now
fantastic job.
__________________
tedious REAPER stuff|my Chordgun Variation
rem _startup.lua listen >>>LV2 <<<
Search in Forum

Last edited by bobobo; 02-06-2021 at 10:48 AM.
bobobo is offline   Reply With Quote
Old 02-05-2021, 07:41 AM   #17
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

Ok, tested latest version.
Communication between Reaper and OBS works great, but it doesn't seem to find the recordings, giving me an errormessage:

"Failed to find recording. Do you have the right EXTENSION configured for this source code for this action?

Extension: mkv

Project folder: C:\Users\Meo\Desktop\Recordings"

After some more tests, it seems like it's writing the files as .mp4 and not as .mkv.


One more note:
If somebody stops recording in OBS itself and then runs the your stop-recording-action, it throws an error-message.

Code:
...ndro Facchinetti\Utility\leafac_OBS - Stop recording.lua:19: Failed to control OBS.

1. Check that OBS and obs-websocket are running.
2. Check the configuration (for example, ADDRESS and PASSWORD) in the source code for this action.
3. Report the issue to reaper@leafac.com.


Command:
"C:\Ultraschall-US_API_4.1.001/Data/leafac_obs-cli.exe" --address "localhost:4444" --password "" StopRecording "SetRecordingFolder={ \"rec-folder\": \"C:\\Users\\Meo\\Desktop\\Tudelu\\Recordings\" }"

Output:
1
{
  "error": "recording not active",
  "message-id": "1",
  "status": "error",
  "messageId": "1"
}
I think, checking, if there's a valid video available, even if only impartial, could be a good idea. I think, when you are used to OBS-UI, you might simply click the stop-button out of force of habit, so dealing with that would smooth that stuff a little out.
When do you receive the filename for the recorded video? Already at starttime of the recording? Or just after you've stopped recording?
If the former, it could be stored during start recording in a temporary key-value-store called "ProjExtState", so you could retrieve the stored filename and check, if it's there, before throwing an error-message.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-05-2021, 07:59 AM   #18
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 7,769
Default

Quote:
Originally Posted by bobobo View Post
one thing..
obs records to an extension flv.
the script "wants" mkv
I think you can change the format in Options as I did. MKV format is much better, because if you start recording and something happens, you get no errors in the output file, unlik in FLV.
vitalker is offline   Reply With Quote
Old 02-05-2021, 09:16 AM   #19
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 859
Default

yep,
setting the output to mkv (in the scripts AND in obs) nails it.
__________________
tedious REAPER stuff|my Chordgun Variation
rem _startup.lua listen >>>LV2 <<<
Search in Forum
bobobo is offline   Reply With Quote
Old 02-05-2021, 10:14 AM   #20
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

Ah, so it's necessary to set the format on both and isn't told to OBS by the script itself.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-05-2021, 10:39 AM   #21
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 859
Default

i fear the obs websocket can't set the recording format

https://github.com/Palakis/obs-webso...ed/protocol.md

maybe you find a way
__________________
tedious REAPER stuff|my Chordgun Variation
rem _startup.lua listen >>>LV2 <<<
Search in Forum
bobobo is offline   Reply With Quote
Old 02-05-2021, 03:34 PM   #22
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

all: Thank you to everyone who helped here. It seems like weíre ready to share the Windows version with a wider audience. Iíll contact the people who asked about this in YouTube comments and emails to let them know.

Regarding issues with the file extension: In my OBS installations (macOS & Windows) the default is .mkv. Did you change this setting yourselves, or were your OBS installations recording with another extension by default?

Also, a piece of advice, if you allow me: You should record in .mkv. Reasons:

1. .mkv is supported just fine in REAPER for editing (REAPER doesnít support multiple tracks in the .mkv, but the whole point here is that youíre recoding audio in REAPER directly, so this wonít affect you).

2. If OBS crashes in the middle of the recording, a .mkv will hold your recording up to the crash, while most other formats will end up corrupted and youíll lose the whole recording. (OBS is pretty robust, but video recording is resource-intensive, so things may go bad.) (As far as I can tell REAPER also produces .wav that donít go corrupt in case of a crash.)

3. Even if you need to bring the .mkv into another editor that doesnít support it, itís easy and fast to convert .mkv into .mp4 from within OBS itself (something that OBS calls remuxing the recording).

If you still want to recording in another format, you may copy the script and tweak the advanced settings (I show how to do that in the YouTube video above).

Mespotine:

Quote:
I think, checking, if there's a valid video available, even if only impartial, could be a good idea. I think, when you are used to OBS-UI, you might simply click the stop-button out of force of habit, so dealing with that would smooth that stuff a little out.
Hmmm, I see how that could be nice, but I donít see a way for the script to tell whether the person stopped recording in OBS or if something else caused the issue (for example, did you not even start recording to begin with?). Do you have any ideas?

In any case, Iím not too worried because youíre never losing footage. Worst-case scenario youíll have to import the video the normal way and sync it by hand. Not the end of the world.

Hopefully the script is so good that people will get in the habit of recording the way I do: I open OBS, minimize it, and never look at it again. (I can tell itís recording by the menubar icon.)

Quote:
When do you receive the filename for the recorded video? Already at starttime of the recording? Or just after you've stopped recording?
Unfortunately the filename isnít available when starting the recording: https://github.com/Palakis/obs-webso...ment-735378931

Also, you canít query for the filename yet. The feature has been added to obs-websocket code base(https://github.com/Palakis/obs-websocket/pull/621), but a version with it hasnít been released yet.

The way I work around this is a hack: I know the OBS recording folder, because I set it when starting the recording (itís set to the REAPER recording folder). When stopping the recording, I list the files in that folder, filter for everything ending in .mkv (hence that configuration option), sort the names, and use the last one. This works assuming that:

1. You donít change the default OBS settings for filenames, which produces names based on the date in a way that sorts right for the script

2. You donít have other files in the folder that end in .mkv and whose name would sort after your recordings.

So far no one has complained about this, so the hack seems to hold for now.

Quote:
If the former, it could be stored during start recording in a temporary key-value-store called "ProjExtState", so you could retrieve the stored filename and check, if it's there, before throwing an error-message.
Weíll do something to that effect in the future when the next version of obs-websocket is released.

Aside: ProjExtState is how weíre storing the start time so we know where in the timeline to put the video item when the recording is over.

bobobo:

Quote:
i fear the obs websocket can't set the recording format
Yeah. Not only that, but as far as I can tell you canít query the recording format either. Thatís why we have that configuration option in the script. This is annoying, but it will all go away when the next version of obs-websocket is released (see above).
leafac is offline   Reply With Quote
Old 02-05-2021, 05:46 PM   #23
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Here’s a bonus for y’all: The tool I developed to test the command-line parameters and eventually figure out the Windows situation:

https://github.com/leafac/echo-command-line-parameters
leafac is offline   Reply With Quote
Old 02-05-2021, 06:34 PM   #24
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: Apr 2020
Location: Leipzig
Posts: 2,651
Default

Ok, it's really looking good then.

So I go into making customization easier within the next few days so people don't need to edit code anymore. This will be awesome
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper
Bugreports&Docs notes please do here:https://github.com/Ultraschall/ultra...-reaper/issues - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote
Old 02-06-2021, 08:37 AM   #25
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Mespotine:

X-Raym commented in the YouTube video with some ideas on how to make configuration easier: https://www.youtube.com/watch?v=E4R4...6assYwN4AaABAg

I was going to work on this myself, but since youíre offering, Iíll leave it to you. Iím looking forward to seeing what you come up with
leafac is offline   Reply With Quote
Old 02-09-2021, 03:54 AM   #26
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

For people interested in how this works, I just published a code review:



I hope you find this useful if youíre just getting into ReaScripts and Lua.
leafac is offline   Reply With Quote
Old 03-19-2021, 02:59 PM   #27
DrRick
Human being with feelings
 
Join Date: Aug 2019
Posts: 6
Default

I just want to thank you for this. I've done a couple of split-screen multi-instrument covers in Reaper this month, but without this. I just installed it tonight, and I think it's going to change my world. The latency offset even works consistently across both my cameras, in the early testing. Awesome.

Two things I noticed, that might be extremely hard to fix (but would be very useful to me) - it doesn't seem to play at all nicely with pre-roll or count-in, and even less nicely with loop recording, which I would often use to lay backing vocals. This is still a huge win even without those, though!
DrRick is offline   Reply With Quote
Old 04-03-2021, 02:39 PM   #28
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Hi DrRick,

Thanks for checking my work; Iím glad youíre finding it useful.

I took note of your suggestions and will work on them in the future. Iíll come back here to let you know how it goesÖ

Best.
leafac is offline   Reply With Quote
Old 04-09-2021, 03:16 PM   #29
DrRick
Human being with feelings
 
Join Date: Aug 2019
Posts: 6
Default

Thank you for even thinking about it! One thing that might be very easy - for you - that would help me is a "abort recording without adding it in" command.

At the moment I have a macro set up that does "stop recording and delete all" in Reaper then sends the stop recording command to OBS. This kind of works, in that nothing appears in the track, but doesn't in as much as the recorded video is hung up internally as a take, and so doesn't clean out of the project directory when I run a clean. It's workable around, it'd just be nice for efficiency!

It is phenomenally useful to me as it is, and I'm very grateful.
DrRick is offline   Reply With Quote
Old 05-01-2021, 12:09 AM   #30
jesus4c
Human being with feelings
 
jesus4c's Avatar
 
Join Date: Jan 2018
Location: Brisbane, Australia
Posts: 77
Default

Love your work, Leandro! This will be very useful to me! I've ALMOST got things working on my Windows 10 desktop - but not quite.

I've installed everything as instructed and when I run the Toggle Recording script (V3.0), both OBS and Reaper start recording as expected. A message from OBS pops up saying that I have a New WebSocket Connection - but then seconds later another message appears saying WebSocket Client Disconnected. The recording continues.

When I run the script again to stop the recording, exactly the same thing happens.

Any suggestions greatly appreciated. Thanks.
jesus4c is offline   Reply With Quote
Old 05-03-2021, 01:42 AM   #31
DrRick
Human being with feelings
 
Join Date: Aug 2019
Posts: 6
Default

Mine does that. It's still working. I assume it doesn't keep the connection open throughout. Is yours not working?
DrRick is offline   Reply With Quote
Old 05-03-2021, 02:13 AM   #32
drew
Mobile
 
drew's Avatar
 
Join Date: Jan 2006
Location: London & S„o Paulo. Hardcore commercial REAPERite
Posts: 1,669
Default

Thank you for your amazing work on this!
__________________
Proudly using REAPER exclusively for...
* Media and event music composition & production, sound design + auto-processing at Qsonics.com
* Broadcast branding, promos, education & training and narration voice-overs at DrewWhite.com
drew is offline   Reply With Quote
Old 05-03-2021, 05:07 AM   #33
jesus4c
Human being with feelings
 
jesus4c's Avatar
 
Join Date: Jan 2018
Location: Brisbane, Australia
Posts: 77
Default

Quote:
Originally Posted by DrRick View Post
Mine does that. It's still working. I assume it doesn't keep the connection open throughout. Is yours not working?
That makes sense - I hadn't thought that it may only need that connection briefly while starting and stopping recording.

It looks like it's working and when I stop recording, an OBS track is created in Reaper. But, my recording just has the words 'OFFLINE' printed across it. There's no video anywhere that I can see.

**EDIT** Problem all fixed! Turns out, as suggested by DrRick, the WebSocket was not the issue. Instead it was the 32bit version of VLC that my 64bit Reaper didn't like. All good now, though. Thanks again for an awesome script, Leandro!!

Last edited by jesus4c; 05-04-2021 at 07:33 PM.
jesus4c is offline   Reply With Quote
Old 05-09-2021, 01:20 AM   #34
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

@Everyone

Thank you for the nice words. Iím glad youíre finding my script useful

@DrRick

Quote:
a "abort recording without adding it in" command.
Yeah, youíre right, that should be easy to do. Do you wish for the command to just not add the video item to the REAPER timeline, do you wish for it to also remove the file produced by OBS?

@jesus4c

Quote:
when I run the Toggle Recording script (V3.0), both OBS and Reaper start recording as expected. A message from OBS pops up saying that I have a New WebSocket Connection - but then seconds later another message appears saying WebSocket Client Disconnected. The recording continues.

When I run the script again to stop the recording, exactly the same thing happens.
Then everything is working as intended: When you start or stop a recording, REAPER connects to OBS, tells it what to do, and disconnects. REAPER doesnít keep a connection to OBS open during the recording itself because it doesnít need one. I like to disable those pop ups because I find them annoying, but you may leave them on as extra assurance that OBS received the command from REAPER.

In any case, Iím glad you sorted things out and the script is working for you.
leafac is offline   Reply With Quote
Old 06-14-2021, 04:06 PM   #35
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,265
Default

leafac one question the subfolder I need to put the folder obs is writing to? the only way here I could make work is leave this option with a space.... But I am getting some bugs (windows here), every time I run the script it change the output folder in obs adding what is on the subfolder setting.

Like running one time
"C:\Users\DSL\Downloads\test\Testeee\AudioC:\Users \DSL\Downloads\test\Testeee"

Ah ok i just need to ad the name of the folder I want. Everything right now
daniellumertz is offline   Reply With Quote
Old 06-17-2021, 08:31 AM   #36
DrRick
Human being with feelings
 
Join Date: Aug 2019
Posts: 6
Default

Quote:
Originally Posted by leafac View Post
@Everyone

Thank you for the nice words. Iím glad youíre finding my script useful

@DrRick



Yeah, youíre right, that should be easy to do. Do you wish for the command to just not add the video item to the REAPER timeline, do you wish for it to also remove the file produced by OBS?
Sorry - I missed this reply! That would be ideal, yes. I have a little hack method that works, but it's inelegant and leads to tidying up the video files later.

It would be HUGELY useful to me if we could get it to work with pre-roll/count-in (ideally, to record throughout and drop it in at the start of the pre-roll). I might make trying to get it to do that a summer project, since I know it's not hugely relevant to your own use case .
DrRick is offline   Reply With Quote
Old 06-17-2021, 04:54 PM   #37
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Quote:
Originally Posted by DrRick View Post
Sorry - I missed this reply! That would be ideal, yes. I have a little hack method that works, but it's inelegant and leads to tidying up the video files later.

It would be HUGELY useful to me if we could get it to work with pre-roll/count-in (ideally, to record throughout and drop it in at the start of the pre-roll). I might make trying to get it to do that a summer project, since I know it's not hugely relevant to your own use case .
Oh, that sounds like fun. How can I help you get into it? (Make sure you check out the code review: https://www.youtube.com/watch?v=dxfM4ftB1hM)
leafac is offline   Reply With Quote
Old 07-03-2021, 11:30 PM   #38
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,265
Default

Leandro I am wondering how did u pass info through net work connections, and if it would be possible for other people use the same method.

I am looking at this video https://youtu.be/dxfM4ftB1hM; it seems you use a 3 exe app you made to pass info via web sockets {?}
daniellumertz is offline   Reply With Quote
Old 07-04-2021, 12:12 AM   #39
leafac
Human being with feelings
 
leafac's Avatar
 
Join Date: Sep 2020
Location: Portugal
Posts: 76
Default

Quote:
Originally Posted by daniellumertz View Post
Leandro I am wondering how did u pass info through net work connections, and if it would be possible for other people use the same method.

I am looking at this video https://youtu.be/dxfM4ftB1hM; it seems you use a 3 exe app you made to pass info via web sockets {?}
You got it right.

As far as I can tell the REAPER API doesn’t include functions to do networking stuff, for example, making HTTP requests and opening WebSockets.

But REAPER can call programs on the command line, so I wrote a command-line application (https://github.com/leafac/obs-cli) that does the networking stuff I needed (opening a WebSockets connection, in this case).

By the way, I used a similar trick of calling a command-line application in this other action: https://github.com/leafac/reaper/blo...ia%20files.lua

The intent in this case was totally different: To call ffmpeg to process some media.
leafac is offline   Reply With Quote
Old 07-04-2021, 08:05 AM   #40
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 1,265
Default

That is a really nice solution I wonder if we could have a exe for general purpose of network communication or that would be hard
daniellumertz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.