Skip to content

Commit

Permalink
UI: Add Hybrid MP4 to format selection
Browse files Browse the repository at this point in the history
  • Loading branch information
derrod committed Apr 28, 2024
1 parent 3ec133a commit d976d99
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions UI/data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ Basic.Settings.Output.Format.MOV="QuickTime (.mov)"
Basic.Settings.Output.Format.TS="MPEG-TS (.ts)"
Basic.Settings.Output.Format.HLS="HLS (.m3u8 + .ts)"
Basic.Settings.Output.Format.fMP4="Fragmented MP4 (.mp4)"
Basic.Settings.Output.Format.hMP4="Hybrid MP4 (.mp4) [experimental]"
Basic.Settings.Output.Format.fMOV="Fragmented MOV (.mov)"
Basic.Settings.Output.Format.TT.fragmented_mov="Fragmented MOV writes the recording in chunks and does not require the same finalization as traditional MOV files.\nThis ensures the file remains playable even if writing to disk is interrupted, for example, as a result of a BSOD or power loss.\n\nThis may not be compatible with all players and editors. Use File → Remux Recordings to convert the file into a more compatible format if necessary."
Basic.Settings.Output.Format.TT.fragmented_mp4="Fragmented MP4 writes the recording in chunks and does not require the same finalization as traditional MP4 files.\nThis ensures the file remains playable even if writing to disk is interrupted, for example, as a result of a BSOD or power loss.\n\nThis may not be compatible with all players and editors. Use File → Remux Recordings to convert the file into a more compatible format if necessary."
Expand Down
8 changes: 8 additions & 0 deletions UI/ffmpeg-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ static const unordered_map<string, unordered_set<string>> codec_compat = {
"pcm_f32le",
#endif
}},
// Not part of FFmpeg, see obs-outputs module
{"hybrid_mp4",
{
"h264",
"hevc",
"av1",
"aac",
}},
{"mov",
{
"h264",
Expand Down
2 changes: 2 additions & 0 deletions UI/obs-app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1783,6 +1783,8 @@ string GetFormatExt(const char *container)
string ext = container;
if (ext == "fragmented_mp4")
ext = "mp4";
if (ext == "hybrid_mp4")
ext = "mp4";
else if (ext == "fragmented_mov")
ext = "mov";
else if (ext == "hls")
Expand Down
7 changes: 6 additions & 1 deletion UI/window-basic-main-outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,8 @@ AdvancedOutput::AdvancedOutput(OBSBasic *main_) : BasicOutputHandler(main_)
config_get_string(main->Config(), "AdvOut", "RecEncoder");
const char *recAudioEncoder =
config_get_string(main->Config(), "AdvOut", "RecAudioEncoder");
const char *recFormat =
config_get_string(main->Config(), "AdvOut", "RecFormat2");
#ifdef __APPLE__
translate_macvth264_encoder(streamEncoder);
translate_macvth264_encoder(recordEncoder);
Expand Down Expand Up @@ -1623,8 +1625,11 @@ AdvancedOutput::AdvancedOutput(OBSBasic *main_) : BasicOutputHandler(main_)
OBSReplayBufferSaved, this);
}

bool native_muxer = strcmp(recFormat, "hybrid_mp4") == 0;

fileOutput = obs_output_create(
"ffmpeg_muxer", "adv_file_output", nullptr, nullptr);
native_muxer ? "mp4_output" : "ffmpeg_muxer",
"adv_file_output", nullptr, nullptr);
if (!fileOutput)
throw "Failed to create recording output "
"(advanced output)";
Expand Down
1 change: 1 addition & 0 deletions UI/window-basic-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,7 @@ void OBSBasicSettings::LoadFormats()
ui->advOutRecFormat->addItem(FORMAT_STR("MOV"), "mov");
ui->advOutRecFormat->addItem(FORMAT_STR("fMP4"), "fragmented_mp4");
ui->advOutRecFormat->addItem(FORMAT_STR("fMOV"), "fragmented_mov");
ui->advOutRecFormat->addItem(FORMAT_STR("hMP4"), "hybrid_mp4");
ui->advOutRecFormat->addItem(FORMAT_STR("TS"), "mpegts");
ui->advOutRecFormat->addItem(FORMAT_STR("HLS"), "hls");

Expand Down

0 comments on commit d976d99

Please sign in to comment.