Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output to URL #28

Open
julienjura opened this issue Nov 19, 2020 · 5 comments
Open

Output to URL #28

julienjura opened this issue Nov 19, 2020 · 5 comments

Comments

@julienjura
Copy link

Hello there !

I'm trying to capture & stream audio to an URL as provided in OBS-Studio. I've just cloned this minimal sample repo, rebuilt obs-studio-node from source, properly updated package.json and ran yarn install/start.

Electron is launching but won't send data to my URL (Icecast server) as set in basic.ini. I end up with the same situation when trying to set settings by myself in function configureOBS() (file obsRecorder.js)

I'm running this sample on a fresh Windows 10 install

Here's my basic.ini :
`[Video]
BaseCX=200
BaseCY=113
OutputCX=200
OutputCY=113
ScaleType=bicubic
FPSCommon=60

[Audio]
SampleRate=44100

[SimpleOutput]
Mode=Simple
VBitrate=2500
StreamEncoder=obs_x264
ABitrate=160
UseAdvanced=false
FilePath=C:\Users\julien\Videos
FileNameWithoutSpace=false
RecQuality=Stream
RecFormat=mp4
MuxerCustom=
RecRB=true
RecRBTime=20

[Output]
Mode=Advanced

[AdvOut]
TrackIndex=1
RecType=FFmpeg
RecTracks=1
FLVTrack=1
FFOutputToFile=false
FFURL=icecast://source:password@url:port/endpoint.ts
FFFormat=mpegts
FFFormatMimeType=video/MP2T
FFExtension=ts
FFVEncoderId=27
FFVEncoder=libx264
FFAEncoderId=86018
FFAEncoder=aac
FFAudioMixes=1
FFVBitrate=25
FFVGOPSize=2
FFIgnoreCompat=true
RescaleRes=1920x1080
RecRescaleRes=1920x1080
FFRescaleRes=140x80
FFABitrate=128
FFMCustom=
FFRescale=true
Encoder=obs_x264
ApplyServiceSettings=true
Rescale=false
RecFilePath=C:\Users\juju\Videos
RecFileNameWithoutSpace=false
RecFormat=flv
RecEncoder=none
RecRescale=false`

Here's my configureOBS() function
`
function configureOBS() {
console.debug('Configuring OBS');
setSetting('Output', 'Mode', 'Advanced');

setSetting('Output', 'TrackIndex', 1);
setSetting('Output', 'RecType', 'FFmpeg');
setSetting('Output', 'RecTracks', 1);
setSetting('Output', 'FLVTrack', 1);
setSetting('Output', 'FFOutputToFile', 0);
setSetting('Output', 'FFURL', 'icecast://source:password@url:port/endpoint.ts');
setSetting('Output', 'FFFormat', 'mpegts');
setSetting('Output', 'FFFormatMimeType', 'video/MP2T');
setSetting('Output', 'FFExtension', 'ts');
setSetting('Output', 'FFVEncoderId', 27);
setSetting('Output', 'FFVEncoder', 'libx264');
setSetting('Output', 'FFAEncoderId', 86018);
setSetting('Output', 'FFAEncoder', 'aac');
setSetting('Output', 'FFAudioMixes', 1);
setSetting('Output', 'FFVBitrate', 25);
setSetting('Output', 'FFVGOPSize', 2);
setSetting('Output', 'FFIgnoreCompat', 1);
setSetting('Output', 'RescaleRes', '1920x1080');
setSetting('Output', 'FFRescaleRes', '140x80');
setSetting('Output', 'FFABitrate', '140x80');
setSetting('Output', 'FFRescale', 1);

setSetting('Video', 'FPSCommon', 60);

console.debug('OBS Configured');
}
`

Congrats for all this wonderfull piece of software !
Best regards

@julienjura
Copy link
Author

Everything is working on OBS-Studio, i just want to replicate the correct settings in an test electron app through obs-studio-node

@Envek
Copy link
Owner

Envek commented Nov 19, 2020

Don't change ini files directly, instead change configuration programmatically, as shown here:

function configureOBS() {
console.debug('Configuring OBS');
setSetting('Output', 'Mode', 'Advanced');
const availableEncoders = getAvailableValues('Output', 'Recording', 'RecEncoder');
setSetting('Output', 'RecEncoder', availableEncoders.slice(-1)[0] || 'x264');
setSetting('Output', 'RecFilePath', path.join(__dirname, 'videos'));
setSetting('Output', 'RecFormat', 'mkv');
setSetting('Output', 'VBitrate', 10000); // 10 Mbps
setSetting('Video', 'FPSCommon', 60);

Beware though, that API doesn't match configuration files format 1-to-1 and I believe that there is probably no docs for that. So, only trial and error and many experiments in debugger console.

Sorry, I can't help much there, I hadn't explored streaming.

@julienjura
Copy link
Author

julienjura commented Nov 19, 2020

Hi Envek !

I tried this way yet but unsuccessfully. I'va posted my configureOBS() function

I'm using FFmpeg in OBS-Studio, so I tried :
setSetting('Output', 'RecType', 'FFmpeg');

Maybe FFmpeg is a plugin or something else i need to place in specific location ?

I traced encoders returned by
Only these are provided :
const availableEncoders = getAvailableValues('Output', 'Recording', 'RecEncoder');

ENCODERS :
none
obs_x264
obs_qsv11
ffmpeg_nvenc
jim_nvenc

@xiaoyao316
Copy link

@julienjura Any progress? I was also plagued by the problem of pushing streams to the server, and I didn't know how to set it up because there was no docs.

@hrueger
Copy link
Contributor

hrueger commented Apr 19, 2021

@julienjura @xiaoyao316 Did you call osn.NodeObs.OBS_service_startStreaming()?

If you get it working, it would be great if you could create a PR to https://github.com/hrueger/obs-studio-node-docs with instructions on how to setup streaming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants