https://github.com/OpenMW/openmw/commit/61cb5b4da638d520c41a9d99b5850384b2e22679

Index: apps/openmw/mwsound/ffmpeg_decoder.hpp
--- apps/openmw/mwsound/ffmpeg_decoder.hpp.orig
+++ apps/openmw/mwsound/ffmpeg_decoder.hpp
@@ -31,6 +31,9 @@ extern "C"
 #include "sound_decoder.hpp"
 
 
+#define FFMPEG_5_OR_GREATER (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100))
+#define FFMPEG_CONST_WRITEPACKET (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(60, 12, 100) && !defined(FF_API_AVIO_WRITE_NONCONST))
+
 namespace MWSound
 {
     class FFmpeg_Decoder final : public Sound_Decoder
@@ -49,7 +52,11 @@ namespace MWSound
 
         SwrContext *mSwr;
         enum AVSampleFormat mOutputSampleFormat;
+#if FFMPEG_5_OR_GREATER
+        AVChannelLayout mOutputChannelLayout;
+#else
         int64_t mOutputChannelLayout;
+#endif
         uint8_t *mDataBuf;
         uint8_t **mFrameData;
         int mDataBufLen;
@@ -59,7 +66,11 @@ namespace MWSound
         Files::IStreamPtr mDataStream;
 
         static int readPacket(void *user_data, uint8_t *buf, int buf_size);
+#if FFMPEG_CONST_WRITEPACKET
+        static int writePacket(void* user_data, const uint8_t* buf, int buf_size);
+#else
         static int writePacket(void *user_data, uint8_t *buf, int buf_size);
+#endif
         static int64_t seek(void *user_data, int64_t offset, int whence);
 
         bool getAVAudioData();
