Skip to content

Commit

Permalink
libobs/media-io: Fix media-remux channel layout for 5 channels
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pkviet committed May 6, 2024
1 parent 6f053b2 commit 30a2477
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libobs/media-io/media-remux.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,19 @@ static inline bool init_output(media_remux_job_t job, const char *out_filename)
out_stream->codecpar->channel_layout =
av_get_default_channel_layout(
in_stream->codecpar->channels);
//avutil default channel layout for 5 channels is 5.0 ; fix for 4.1
if (in_stream->codecpar->channels == 5)
out_stream->codecpar->channel_layout =
av_get_channel_layout("4.1");
#else
av_channel_layout_default(
&out_stream->codecpar->ch_layout,
in_stream->codecpar->ch_layout.nb_channels);
//avutil default channel layout for 5 channels is 5.0 ; fix for 4.1
if (in_stream->codecpar->ch_layout.nb_channels == 5)
out_stream->codecpar->ch_layout =
(AVChannelLayout)
AV_CHANNEL_LAYOUT_4POINT1;
#endif
}
}
Expand Down

0 comments on commit 30a2477

Please sign in to comment.