diff --git a/xLights/AudioManager.cpp b/xLights/AudioManager.cpp index 08a6b214f..11e1a1ad1 100644 --- a/xLights/AudioManager.cpp +++ b/xLights/AudioManager.cpp @@ -3511,6 +3511,10 @@ bool AudioManager::EncodeAudio(const std::vector& left_channel, #endif return false; } + if (sample_index >= left_channel.size()) { + // at the end, flush everything + avcodec_send_frame(codec_context, nullptr); + } // Receive the encoded packets while (ret >= 0) {