mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-29 02:03:03 +08:00
obs-ffmpeg: Fix 7.1 ALAC encoding
Commit [1] added ALAC & PCM support. But 7.1 ALAC encoding fails. This fixes the issue by assigning the correct 7.1 layout supported by FFmpeg ALAC encoder (7.1(wide)). [1] https://github.com/obsproject/obs-studio/commit/3ae98511d09f1ebaf5c9cc005a285efd1a26aeff Signed-off-by: pkv <pkv@obsproject.com>
This commit is contained in:
@@ -271,12 +271,21 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder,
|
||||
#else
|
||||
av_channel_layout_default(&enc->context->ch_layout,
|
||||
(int)audio_output_get_channels(audio));
|
||||
/* The avutil default channel layout for 5 channels is 5.0, which OBS
|
||||
* does not support. Manually set 5 channels to 4.1. */
|
||||
if (aoi->speakers == SPEAKERS_4POINT1)
|
||||
enc->context->ch_layout =
|
||||
(AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT1;
|
||||
/* AAC, ALAC, & FLAC default to 3.0 for 3 channels instead of 2.1.
|
||||
* Tell the encoder to deal with 2.1 as if it were 3.0. */
|
||||
if (aoi->speakers == SPEAKERS_2POINT1)
|
||||
enc->context->ch_layout =
|
||||
(AVChannelLayout)AV_CHANNEL_LAYOUT_SURROUND;
|
||||
// ALAC supports 7.1 wide instead of regular 7.1.
|
||||
if (aoi->speakers == SPEAKERS_7POINT1 &&
|
||||
astrcmpi(enc->type, "alac") == 0)
|
||||
enc->context->ch_layout =
|
||||
(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK;
|
||||
#endif
|
||||
|
||||
enc->context->sample_rate = audio_output_get_sample_rate(audio);
|
||||
|
||||
Reference in New Issue
Block a user