diff '--color=auto' -ur blender-4.5.6.orig/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp blender-4.5.6/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
--- blender-4.5.6.orig/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp	2025-07-10 11:43:06.000000000 +0200
+++ blender-4.5.6/extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp	2026-01-20 14:33:17.000339128 +0100
@@ -255,13 +255,7 @@
 	m_specs.rate = (SampleRate) m_codecCtx->sample_rate;
 }
 
-FFMPEGReader::FFMPEGReader(const std::string &filename, int stream) :
-	m_pkgbuf(),
-	m_formatCtx(nullptr),
-	m_codecCtx(nullptr),
-	m_frame(nullptr),
-	m_aviocontext(nullptr),
-	m_membuf(nullptr)
+FFMPEGReader::FFMPEGReader(const std::string& filename, int stream) : m_pkgbuf(), m_formatCtx(nullptr), m_codecCtx(nullptr), m_frame(nullptr), m_aviocontext(nullptr)
 {
 	// open file
 	if(avformat_open_input(&m_formatCtx, filename.c_str(), nullptr, nullptr)!=0)
@@ -285,13 +279,15 @@
 		m_membuffer(buffer),
 		m_membufferpos(0)
 {
-	m_membuf = reinterpret_cast<data_t*>(av_malloc(AV_INPUT_BUFFER_MIN_SIZE + AV_INPUT_BUFFER_PADDING_SIZE));
+	constexpr int BUFFER_SIZE{4096};
 
-	m_aviocontext = avio_alloc_context(m_membuf, AV_INPUT_BUFFER_MIN_SIZE, 0, this, read_packet, nullptr, seek_packet);
+	auto membuf = reinterpret_cast<data_t*>(av_malloc(BUFFER_SIZE));
+
+	m_aviocontext = avio_alloc_context(membuf, BUFFER_SIZE, 0, this, read_packet, nullptr, seek_packet);
 
 	if(!m_aviocontext)
 	{
-		av_free(m_aviocontext);
+		av_free(membuf);
 		AUD_THROW(FileException, "Buffer reading context couldn't be created with ffmpeg.");
 	}
 
@@ -299,6 +295,8 @@
 	m_formatCtx->pb = m_aviocontext;
 	if(avformat_open_input(&m_formatCtx, "", nullptr, nullptr)!=0)
 	{
+		if(m_aviocontext->buffer)
+			av_free(m_aviocontext->buffer);
 		av_free(m_aviocontext);
 		AUD_THROW(FileException, "Buffer couldn't be read with ffmpeg.");
 	}
@@ -310,6 +308,8 @@
 	catch(Exception&)
 	{
 		avformat_close_input(&m_formatCtx);
+		if(m_aviocontext->buffer)
+			av_free(m_aviocontext->buffer);
 		av_free(m_aviocontext);
 		throw;
 	}
@@ -325,6 +325,13 @@
 	if(m_codecCtx)
 		avcodec_free_context(&m_codecCtx);
 #endif
+	if(m_aviocontext)
+	{
+		if(m_aviocontext->buffer)
+			av_free(m_aviocontext->buffer);
+		av_free(m_aviocontext);
+	}
+
 	avformat_close_input(&m_formatCtx);
 }
 
diff '--color=auto' -ur blender-4.5.6.orig/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h blender-4.5.6/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h
--- blender-4.5.6.orig/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h	2025-07-10 11:43:06.000000000 +0200
+++ blender-4.5.6/extern/audaspace/plugins/ffmpeg/FFMPEGReader.h	2026-01-20 14:33:17.000406568 +0100
@@ -107,11 +107,6 @@
 	std::shared_ptr<Buffer> m_membuffer;
 
 	/**
-	 * The buffer to read with.
-	 */
-	data_t* m_membuf;
-
-	/**
 	 * Reading position of the buffer.
 	 */
 	long long m_membufferpos;
diff '--color=auto' -ur blender-4.5.6.orig/source/blender/imbuf/movie/intern/movie_write_audio.cc blender-4.5.6/source/blender/imbuf/movie/intern/movie_write_audio.cc
--- blender-4.5.6.orig/source/blender/imbuf/movie/intern/movie_write_audio.cc	2025-07-10 11:43:07.000000000 +0200
+++ blender-4.5.6/source/blender/imbuf/movie/intern/movie_write_audio.cc	2026-01-20 14:31:59.240249736 +0100
@@ -323,12 +323,12 @@
   c->time_base.num = 1;
   c->time_base.den = c->sample_rate;
 
-  if (c->frame_size == 0) {
-    /* Used to be if ((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
-     * not sure if that is needed anymore, so let's try out if there are any
-     * complaints regarding some FFMPEG versions users might have. */
-    context->audio_input_samples = AV_INPUT_BUFFER_MIN_SIZE * 8 / c->bits_per_coded_sample /
-                                   audio_channels;
+  if (c->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) {
+    /* If the audio format has a variable frame size, default to 1024.
+     * This is because we won't try to encode any variable frame size.
+     * 1024 seems to be a good compromize between size and speed.
+     */
+    context->audio_input_samples = 1024;
   }
   else {
     context->audio_input_samples = c->frame_size;
Only in blender-4.5.6/source/blender/imbuf/movie/intern: movie_write_audio.cc.orig
