From 0559152dc712f66a1de15e016cb78060c54576b7 Mon Sep 17 00:00:00 2001 From: Calvin Walton <calvin.walton@kepstin.ca> Date: Thu, 18 Mar 2021 10:34:17 -0400 Subject: [PATCH] Improvements for audio desync issues This incorporates only the audio desync related changes from #11626 * Add the aresample filter with async option to fill in timestamp gaps * Use the libopus decoder for opus audio instead of ffmpeg's builtin decoder --- record-and-playback/core/lib/recordandplayback/edl/audio.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/record-and-playback/core/lib/recordandplayback/edl/audio.rb b/record-and-playback/core/lib/recordandplayback/edl/audio.rb index e5758a2815..e9525a8fd0 100644 --- a/record-and-playback/core/lib/recordandplayback/edl/audio.rb +++ b/record-and-playback/core/lib/recordandplayback/edl/audio.rb @@ -21,7 +21,7 @@ module BigBlueButton module EDL module Audio FFMPEG_AEVALSRC = "aevalsrc=s=48000:c=stereo:exprs=0|0" - FFMPEG_AFORMAT = "aformat=sample_fmts=s16:sample_rates=48000:channel_layouts=stereo" + FFMPEG_AFORMAT = "aresample=async=1000,aformat=sample_fmts=s16:sample_rates=48000:channel_layouts=stereo" FFMPEG_WF_CODEC = 'libvorbis' FFMPEG_WF_ARGS = ['-c:a', FFMPEG_WF_CODEC, '-q:a', '2', '-f', 'ogg'] WF_EXT = 'ogg' @@ -145,6 +145,10 @@ module BigBlueButton if audioinfo[input[:filename]][:format][:format_name] == 'wav' ffmpeg_cmd += ['-ignore_length', '1'] end + # Prefer using the libopus decoder for opus files, it handles discontinuities better + if audioinfo[input[:filename]][:audio][:codec_name] == 'opus' + ffmpeg_cmd << '-c:a' << 'libopus' + end ffmpeg_cmd += ['-i', input[:filename]] end -- GitLab