--- a/modules/codec/avcodec/avcommon_compat.h
+++ b/modules/codec/avcodec/avcommon_compat.h
@@ -76,7 +76,10 @@
 # define AV_CODEC_CAP_SMALL_LAST_FRAME CODEC_CAP_SMALL_LAST_FRAME
 #endif
 #ifndef AV_INPUT_BUFFER_MIN_SIZE
-# define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE
+# ifdef FF_API_BUFFER_MIN_SIZE
+#  define AV_INPUT_BUFFER_MIN_SIZE AV_MIN_BUFFER_SIZE
+# endif
+# define AV_INPUT_BUFFER_MIN_SIZE 16384 // removed with ffmpeg 8
 #endif
 #ifndef  FF_MAX_B_FRAMES
 # define  FF_MAX_B_FRAMES 16 // FIXME: remove this
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -69,6 +69,17 @@
 # define AVC_MAYBE_CONST
 #endif
 
+#if ! LIBAVCODEC_VERSION_CHECK(61, 33, 102) // Compatibility for profiles <= FFMPEG 8
+# define AV_PROFILE_AAC_MAIN    FF_PROFILE_AAC_MAIN
+# define AV_PROFILE_AAC_LOW     FF_PROFILE_AAC_LOW
+# define AV_PROFILE_AAC_SSR     FF_PROFILE_AAC_SSR
+# define AV_PROFILE_AAC_LTP     FF_PROFILE_AAC_LTP
+# define AV_PROFILE_AAC_HE_V2   FF_PROFILE_AAC_HE_V2
+# define AV_PROFILE_AAC_HE      FF_PROFILE_AAC_HE
+# define AV_PROFILE_AAC_LD      FF_PROFILE_AAC_LD
+# define AV_PROFILE_AAC_ELD     FF_PROFILE_AAC_ELD
+#endif
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -484,30 +5495,30 @@ int InitVideoEnc( vlc_object_t *p_this )
     psz_val = var_GetString( p_enc, ENC_CFG_PREFIX "aac-profile" );
     /* libavcodec uses faac encoder atm, and it has issues with
      * other than low-complexity profile, so default to that */
-    p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
+    p_sys->i_aac_profile = AV_PROFILE_AAC_LOW;
     if( psz_val && *psz_val )
     {
         if( !strncmp( psz_val, "main", 4 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_MAIN;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_MAIN;
         else if( !strncmp( psz_val, "low", 3 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_LOW;
         else if( !strncmp( psz_val, "ssr", 3 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_SSR;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_SSR;
         else if( !strncmp( psz_val, "ltp", 3 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_LTP;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_LTP;
 /* These require libavcodec with libfdk-aac */
         else if( !strncmp( psz_val, "hev2", 4 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_HE_V2;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_HE_V2;
         else if( !strncmp( psz_val, "hev1", 4 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_HE;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_HE;
         else if( !strncmp( psz_val, "ld", 2 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_LD;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_LD;
         else if( !strncmp( psz_val, "eld", 3 ) )
-            p_sys->i_aac_profile = FF_PROFILE_AAC_ELD;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_ELD;
         else
         {
             msg_Warn( p_enc, "unknown AAC profile requested, setting it to low" );
-            p_sys->i_aac_profile = FF_PROFILE_AAC_LOW;
+            p_sys->i_aac_profile = AV_PROFILE_AAC_LOW;
         }
     }
     free( psz_val );
