Skip to content

Commit 5b2e2a9

Browse files
pkvietRytoEX
authored andcommitted
libobs/media-io: Fix media-remux channel layout for 5 channels
FFmpeg has 5.0 as default layout for 5 channels. But obs-studio uses 4.1. This is a fix when remuxing. Signed-off-by: pkv <[email protected]>
1 parent 06e2b31 commit 5b2e2a9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

libobs/media-io/media-remux.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,23 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
158158
out_stream->codecpar->channel_layout =
159159
av_get_default_channel_layout(
160160
in_stream->codecpar->channels);
161+
/* The avutil default channel layout for 5 channels is
162+
* 5.0, which OBS does not support. Manually set 5
163+
* channels to 4.1. */
164+
if (in_stream->codecpar->channels == 5)
165+
out_stream->codecpar->channel_layout =
166+
av_get_channel_layout("4.1");
161167
#else
162168
av_channel_layout_default(
163169
&out_stream->codecpar->ch_layout,
164170
in_stream->codecpar->ch_layout.nb_channels);
171+
/* The avutil default channel layout for 5 channels is
172+
* 5.0, which OBS does not support. Manually set 5
173+
* channels to 4.1. */
174+
if (in_stream->codecpar->ch_layout.nb_channels == 5)
175+
out_stream->codecpar->ch_layout =
176+
(AVChannelLayout)
177+
AV_CHANNEL_LAYOUT_4POINT1;
165178
#endif
166179
}
167180
}

0 commit comments

Comments
 (0)