https://github.com/libretro/RetroArch/commit/21776a2e59f5f5899ff2198c0df25a95b5020012

Index: record/drivers/record_ffmpeg.c
--- record/drivers/record_ffmpeg.c.orig
+++ record/drivers/record_ffmpeg.c
@@ -72,6 +72,15 @@ extern "C" {
 #ifndef FFMPEG3
 #define FFMPEG3 (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100))
 #endif
+
+#ifndef FFMPEG8
+#define FFMPEG8 (LIBAVCODEC_VERSION_MAJOR >= 62)
+#endif
+
+#ifndef AV_INPUT_BUFFER_MIN_SIZE
+#define AV_INPUT_BUFFER_MIN_SIZE 16384
+#endif
+
 #define HAVE_CH_LAYOUT (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100))
 
 struct ff_video_info
@@ -951,7 +960,11 @@ static void ffmpeg_free(void *data)
 
    if (handle->audio.codec)
    {
+#if FFMPEG8
+      avcodec_free_context(&handle->audio.codec);
+#else
       avcodec_close(handle->audio.codec);
+#endif
       av_free(handle->audio.codec);
    }
 
@@ -959,7 +972,11 @@ static void ffmpeg_free(void *data)
 
    if (handle->video.codec)
    {
+#if FFMPEG8
+      avcodec_free_context(&handle->video.codec);
+#else
       avcodec_close(handle->video.codec);
+#endif
       av_free(handle->video.codec);
    }
 
