Skip to content

Commit

Permalink
UI: Use fragmented MOV/MP4 recording by default
Browse files Browse the repository at this point in the history
Implements RFC obsproject#51
  • Loading branch information
derrod committed Sep 3, 2022
1 parent 3332bee commit 9b93a33
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion UI/data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ SceneItemHide="Hide '%1'"

# Output warnings
OutputWarnings.NoTracksSelected="You must select at least one track"
OutputWarnings.MP4Recording="Warning: Recordings saved to MP4/MOV will be unrecoverable if the file cannot be finalized (e.g. as a result of BSODs, power losses, etc.). If you want to record multiple audio tracks consider using MKV and remux the recording to MP4/MOV after it is finished (File → Remux Recordings)"
OutputWarnings.FMP4Recording="Notice: Recordings saved to MP4/MOV will use a modern format to ensure files are usable even if they do not get finalised (e.g. as a result of BSODs, power losses, etc.). This may not be compatible with all players and editors. Use File → Remux Recordings to convert the file into a more compatible format if necessary."
OutputWarnings.CannotPause="Warning: Recordings cannot be paused if the recording encoder is set to \"(Use stream encoder)\""

# deleting final scene
Expand Down
33 changes: 31 additions & 2 deletions UI/window-basic-main-outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,21 @@ bool SimpleOutput::ConfigureRecording(bool updateReplayBuffer)
strPath.c_str());
}

obs_data_set_string(settings, "muxer_settings", mux);
// Use fragmented MOV/MP4 if user has not already specified custom movflags
if ((strcmp(format, "mp4") == 0 || strcmp(format, "mov") == 0) &&
strstr(mux, "movflags") == NULL) {
blog(LOG_INFO, "Enabling fragmented MOV/MP4 recording.");
string mux_fmp4 =
"movflags=frag_keyframe+empty_moov+delay_moov";
if (mux) {
mux_fmp4 += " ";
mux_fmp4 += mux;
}
obs_data_set_string(settings, "muxer_settings",
mux_fmp4.c_str());
} else {
obs_data_set_string(settings, "muxer_settings", mux);
}

if (updateReplayBuffer)
obs_output_update(replayBuffer, settings);
Expand Down Expand Up @@ -1523,8 +1537,23 @@ inline void AdvancedOutput::SetupRecording()
aacTrack[tracks - 1], idx);
}

// Use fragmented MOV/MP4 if user has not already specified custom movflags
if ((strcmp(recFormat, "mp4") == 0 || strcmp(recFormat, "mov") == 0) &&
strstr(mux, "movflags") == NULL) {
blog(LOG_INFO, "Enabling fragmented MOV/MP4 recording.");
string mux_fmp4 =
"movflags=frag_keyframe+empty_moov+delay_moov";
if (mux) {
mux_fmp4 += " ";
mux_fmp4 += mux;
}
obs_data_set_string(settings, "muxer_settings",
mux_fmp4.c_str());
} else {
obs_data_set_string(settings, "muxer_settings", mux);
}

obs_data_set_string(settings, "path", path);
obs_data_set_string(settings, "muxer_settings", mux);
obs_output_update(fileOutput, settings);
if (replayBuffer)
obs_output_update(replayBuffer, settings);
Expand Down
4 changes: 2 additions & 2 deletions UI/window-basic-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4635,7 +4635,7 @@ void OBSBasicSettings::AdvOutRecCheckWarnings()
ui->advOutRecFormat->currentText().compare("mov") == 0) {
if (!warningMsg.isEmpty())
warningMsg += "\n\n";
warningMsg += QTStr("OutputWarnings.MP4Recording");
warningMsg += QTStr("OutputWarnings.FMP4Recording");
ui->autoRemux->setText(
QTStr("Basic.Settings.Advanced.AutoRemux") + " " +
QTStr("Basic.Settings.Advanced.AutoRemux.MP4"));
Expand Down Expand Up @@ -5130,7 +5130,7 @@ void OBSBasicSettings::SimpleRecordingEncoderChanged()
ui->simpleOutRecFormat->currentText().compare("mov") == 0)) {
if (!warning.isEmpty())
warning += "\n\n";
warning += QTStr("OutputWarnings.MP4Recording");
warning += QTStr("OutputWarnings.FMP4Recording");
ui->autoRemux->setText(
QTStr("Basic.Settings.Advanced.AutoRemux") + " " +
QTStr("Basic.Settings.Advanced.AutoRemux.MP4"));
Expand Down

0 comments on commit 9b93a33

Please sign in to comment.