Skip to content

Commit 7369e1f

Browse files
authored
Use Rec709 color space in cap_enc_avfoundation (#1177)
* use rec709 color space in cap_enc_avfoundation * cleanup
1 parent 880d584 commit 7369e1f

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

apps/desktop/src-tauri/src/recording.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ pub async fn start_recording(
485485
)
486486
.await
487487
.map_err(|e| {
488-
error!("Failed to spawn studio recording actor: {e}");
489-
e.to_string()
488+
error!("Failed to spawn studio recording actor: {e:#}");
489+
format!("{e:#}")
490490
})?;
491491

492492
InProgressRecording::Studio { handle, common }

crates/enc-avfoundation/src/mp4.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,23 @@ impl MP4Encoder {
125125
.as_id_ref(),
126126
);
127127

128+
output_settings.insert(
129+
av::video_settings_keys::color_props(),
130+
ns::Dictionary::with_keys_values(
131+
&[
132+
unsafe { AVVideoTransferFunctionKey },
133+
unsafe { AVVideoColorPrimariesKey },
134+
unsafe { AVVideoYCbCrMatrixKey },
135+
],
136+
&[
137+
unsafe { AVVideoTransferFunction_ITU_R_709_2 },
138+
unsafe { AVVideoColorPrimaries_ITU_R_709_2 },
139+
unsafe { AVVideoYCbCrMatrix_ITU_R_709_2 },
140+
],
141+
)
142+
.as_id_ref(),
143+
);
144+
128145
let mut video_input = av::AssetWriterInput::with_media_type_and_output_settings(
129146
av::MediaType::video(),
130147
Some(output_settings.as_ref()),
@@ -370,7 +387,14 @@ impl Drop for MP4Encoder {
370387

371388
#[link(name = "AVFoundation", kind = "framework")]
372389
unsafe extern "C" {
373-
static AVVideoAverageBitRateKey: &'static cidre::ns::String;
390+
static AVVideoAverageBitRateKey: &'static ns::String;
391+
static AVVideoTransferFunctionKey: &'static ns::String;
392+
static AVVideoColorPrimariesKey: &'static ns::String;
393+
static AVVideoYCbCrMatrixKey: &'static ns::String;
394+
395+
static AVVideoTransferFunction_ITU_R_709_2: &'static cidre::ns::String;
396+
static AVVideoColorPrimaries_ITU_R_709_2: &'static cidre::ns::String;
397+
static AVVideoYCbCrMatrix_ITU_R_709_2: &'static cidre::ns::String;
374398
}
375399

376400
unsafe fn result_unchecked<T, R>(op: impl FnOnce(&mut Option<T>) -> R) -> cidre::os::Result<T>

0 commit comments

Comments
 (0)