diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index dee852ca33a..e521fda2a8b 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -960,9 +960,14 @@ static int start_ffmpeg_impl(FFMpegContext *context,
break;
}
- /* Returns after this must 'goto fail;' */
+ /* Returns after this must 'goto fail;' */
+# if LIBAVFORMAT_VERSION_MAJOR >= 59
of->oformat = fmt;
+# else
+ /* *DEPRECATED* 2022/08/01 For older FFMPEG, remove `ifdef` above. */
+ of->oformat = (AVOutputFormat *)fmt;
+# endif
if (video_codec == AV_CODEC_ID_DVVIDEO) {
if (rectx != 720) {