|
|
@ -181,11 +181,8 @@ void OBSManager::StartRecording() |
|
|
|
|
|
|
|
auto s = new SettingsManager(); |
|
|
|
|
|
|
|
obs_encoder_t *venc = obs_video_encoder_create("obs_x264", "x264", nullptr, nullptr); |
|
|
|
obs_encoder_t *aenc = obs_audio_encoder_create("ffmpeg_aac", "aac", nullptr, 0, nullptr); |
|
|
|
|
|
|
|
obs_encoder_set_video(venc, obs_get_video()); |
|
|
|
obs_encoder_set_audio(aenc, obs_get_audio()); |
|
|
|
OBSEncoder venc = obs_video_encoder_create("obs_x264", "x264_enc", nullptr, nullptr); |
|
|
|
OBSEncoder aenc = obs_audio_encoder_create("ffmpeg_aac", "aac_enc", nullptr, 0, nullptr); |
|
|
|
|
|
|
|
string path = s->GetWithDefault(SETTINGS_KEY_OUTPUT_DIR, filesystem::current_path()); |
|
|
|
if (path.back() != '/') |
|
|
@ -196,13 +193,17 @@ void OBSManager::StartRecording() |
|
|
|
obs_data_t *settings = obs_data_create(); |
|
|
|
obs_data_set_string(settings, "directory", path.c_str()); |
|
|
|
obs_data_set_string(settings, "url", fileName.c_str()); |
|
|
|
obs_data_set_string(settings, "path", fileName.c_str()); |
|
|
|
|
|
|
|
mOutput = obs_output_create("ffmpeg_output", "output", nullptr, nullptr); |
|
|
|
mOutput = obs_output_create("ffmpeg_muxer", "output", nullptr, nullptr); |
|
|
|
obs_output_set_video_encoder(mOutput, venc); |
|
|
|
obs_output_set_audio_encoder(mOutput, aenc, 0); |
|
|
|
obs_output_update(mOutput, settings); |
|
|
|
obs_output_set_media(mOutput, obs_get_video(), obs_get_audio()); |
|
|
|
|
|
|
|
obs_encoder_set_video(venc, obs_get_video()); |
|
|
|
obs_encoder_set_audio(aenc, obs_get_audio()); |
|
|
|
|
|
|
|
obs_data_release(settings); |
|
|
|
if (!obs_output_start(mOutput)) |
|
|
|
throw runtime_error("Failed to start recording"); |
|
|
@ -280,7 +281,7 @@ OBSSource OBSManager::CreateAudioSource() |
|
|
|
|
|
|
|
OBSSource source = obs_source_create("pulse_input_capture", "Audio Source", settings, NULL); |
|
|
|
if (source == NULL) |
|
|
|
throw runtime_error("Couldn't create screen source"); |
|
|
|
throw runtime_error("Couldn't create audio source"); |
|
|
|
|
|
|
|
obs_data_release(settings); |
|
|
|
return source; |
|
|
|