diff --git a/doc/examples/decoding_encoding.c b/doc/examples/decoding_encoding.c
index 976b611cc128ccd9930b31620c405e8930c47b7e..99aeb1c8ace600ccf081c3235b6fd5edfd5de891 100644
--- a/doc/examples/decoding_encoding.c
+++ b/doc/examples/decoding_encoding.c
@@ -156,7 +156,7 @@ static void audio_encode_example(const char *filename)
     }
 
     /* frame containing input raw audio */
-    frame = avcodec_alloc_frame();
+    frame = av_frame_alloc();
     if (!frame) {
         fprintf(stderr, "Could not allocate audio frame\n");
         exit(1);
@@ -287,7 +287,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
         int got_frame = 0;
 
         if (!decoded_frame) {
-            if (!(decoded_frame = avcodec_alloc_frame())) {
+            if (!(decoded_frame = av_frame_alloc())) {
                 fprintf(stderr, "Could not allocate audio frame\n");
                 exit(1);
             }
@@ -386,7 +386,7 @@ static void video_encode_example(const char *filename, int codec_id)
         exit(1);
     }
 
-    frame = avcodec_alloc_frame();
+    frame = av_frame_alloc();
     if (!frame) {
         fprintf(stderr, "Could not allocate video frame\n");
         exit(1);
@@ -565,7 +565,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
         exit(1);
     }
 
-    frame = avcodec_alloc_frame();
+    frame = av_frame_alloc();
     if (!frame) {
         fprintf(stderr, "Could not allocate video frame\n");
         exit(1);
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index a8f979f4bee949ab24134236d2546e3354d0748d..4276114306e741f1ea4483109d7ad5fe72a081ba 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -221,7 +221,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
 {
     AVCodecContext *c;
     AVPacket pkt = { 0 }; // data and size must be 0;
-    AVFrame *frame = avcodec_alloc_frame();
+    AVFrame *frame = av_frame_alloc();
     int got_packet, ret, dst_nb_samples;
 
     av_init_packet(&pkt);
@@ -310,7 +310,7 @@ static void open_video(AVFormatContext *oc, AVCodec *codec, AVStream *st)
     }
 
     /* allocate and init a re-usable frame */
-    frame = avcodec_alloc_frame();
+    frame = av_frame_alloc();
     if (!frame) {
         fprintf(stderr, "Could not allocate video frame\n");
         exit(1);
diff --git a/ffmpeg.c b/ffmpeg.c
index 732fac0cda273ee8925f8b1d16baa84180a921cc..b2cebb8da537b2610c36b7c3138f70df588075a3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1071,7 +1071,7 @@ static int reap_filters(void)
         if (!ost->filter)
             continue;
 
-        if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
+        if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) {
             return AVERROR(ENOMEM);
         } else
             avcodec_get_frame_defaults(ost->filtered_frame);
@@ -1536,7 +1536,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
     int i, ret, err = 0, resample_changed;
     AVRational decoded_frame_tb;
 
-    if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame()))
+    if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))
         return AVERROR(ENOMEM);
     if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))
         return AVERROR(ENOMEM);
diff --git a/ffplay.c b/ffplay.c
index bf317039991e4cc85bb5fe802df34cb9c30bd194..137837c76a300b1e59ef8219ef03aa0968fffffa 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2163,7 +2163,7 @@ static int audio_decode_frame(VideoState *is)
         /* NOTE: the audio packet can contain several frames */
         while (pkt_temp->stream_index != -1 || is->audio_buf_frames_pending) {
             if (!is->frame) {
-                if (!(is->frame = avcodec_alloc_frame()))
+                if (!(is->frame = av_frame_alloc()))
                     return AVERROR(ENOMEM);
             } else {
                 av_frame_unref(is->frame);
diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c
index 9276935649c0f6d6c594a9137b54b4d53722c9ca..eb0046cf5c8c8b36ed0df237541a2151d2e1be16 100644
--- a/libavcodec/avuienc.c
+++ b/libavcodec/avuienc.c
@@ -25,7 +25,7 @@
 
 static av_cold int avui_encode_init(AVCodecContext *avctx)
 {
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     if (avctx->width != 720 || avctx->height != 486 && avctx->height != 576) {
         av_log(avctx, AV_LOG_ERROR, "Only 720x486 and 720x576 are supported.\n");
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 9f3206f92c96fb8cfb3af453b57f8b8c1efa69f4..aefb70d602404feeb096763b920ec825a3c48f28 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -49,7 +49,7 @@ av_cold int ffv1_common_init(AVCodecContext *avctx)
     s->avctx = avctx;
     s->flags = avctx->flags;
 
-    s->picture.f = avcodec_alloc_frame();
+    s->picture.f = av_frame_alloc();
     s->last_picture.f = av_frame_alloc();
     if (!s->picture.f || !s->last_picture.f)
         return AVERROR(ENOMEM);
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index c7769f7a02b3fd470177612ae98da8ce4bcff881..14579b68f31e8a5f186b71f4cb625adeda72f9af 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -242,7 +242,7 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
         goto fail;
     }
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
     if (!avctx->coded_frame) {
         av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
         goto fail;
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
index 9fa096fca755c4bc6db0db4ad552ee2bd35c4860..5d27c6364f9db519f6259fb6aa8f634168ae535a 100644
--- a/libavcodec/libtheoraenc.c
+++ b/libavcodec/libtheoraenc.c
@@ -264,7 +264,7 @@ static av_cold int encode_init(AVCodecContext* avc_context)
     th_comment_clear(&t_comment);
 
     /* Set up the output AVFrame */
-    avc_context->coded_frame= avcodec_alloc_frame();
+    avc_context->coded_frame = av_frame_alloc();
 
     return 0;
 }
diff --git a/libavcodec/libutvideodec.cpp b/libavcodec/libutvideodec.cpp
index 0fae9f78f4b67b30a78bc3ac2ebd24067fd4e2b6..0d8fa1a7f6e2b9f256bd4708bbe77bc988267075 100644
--- a/libavcodec/libutvideodec.cpp
+++ b/libavcodec/libutvideodec.cpp
@@ -96,7 +96,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx)
     }
 
     /* Allocate the output frame */
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     /* Ut Video only supports 8-bit */
     avctx->bits_per_raw_sample = 8;
diff --git a/libavcodec/libutvideoenc.cpp b/libavcodec/libutvideoenc.cpp
index 44cd42f02bf33a89f11cea28dfdb0b769a184479..ad70669a6b867667c28fa70cc0d77cfea08c88a8 100644
--- a/libavcodec/libutvideoenc.cpp
+++ b/libavcodec/libutvideoenc.cpp
@@ -74,7 +74,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
     flags = ((avctx->prediction_method + 1) << 8) | (avctx->thread_count - 1);
 
     avctx->priv_data = utv;
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     /* Alloc extradata buffer */
     info = (UtVideoExtra *)av_malloc(sizeof(*info));
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 0c112e8da27c221079da99b3d60d45ba70ad2f38..aa7f89e3ccebd1689d861179b2b4b203b8e38176 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -456,7 +456,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
         vpx_img_wrap(&ctx->rawimg_alpha, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1,
                      (unsigned char*)1);
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
     if (!avctx->coded_frame) {
         av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
         vp8_free(avctx);
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index e124b41bdd74afa58f65ff175da604298cf12cbd..80ce1359c5a602401be62d93a5505df54bdf3ca3 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -581,7 +581,7 @@ static av_cold int prores_encode_init(AVCodecContext *avctx)
         scale_mat(QMAT_CHROMA[avctx->profile], ctx->qmat_chroma[i - 1], i);
     }
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
     avctx->coded_frame->key_frame = 1;
     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
 
diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c
index 510b4084e202a9457e12bbde5347d2bc922bf879..71c2cb49f2a12c41cda57ebbc9b8349a8b2815fb 100644
--- a/libavcodec/proresenc_kostya.c
+++ b/libavcodec/proresenc_kostya.c
@@ -1073,7 +1073,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
     int interlaced = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
 
     avctx->bits_per_raw_sample = 10;
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
     if (!avctx->coded_frame)
         return AVERROR(ENOMEM);
 
diff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c
index 80230f5a5f4138fc4bac20377d38bce483433a4b..d61cd757e8948558cb5ddb56420101737a055d9e 100644
--- a/libavcodec/r210enc.c
+++ b/libavcodec/r210enc.c
@@ -26,7 +26,7 @@
 
 static av_cold int encode_init(AVCodecContext *avctx)
 {
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     if (!avctx->coded_frame)
         return AVERROR(ENOMEM);
diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index d62524dcaec8fb1c34cb26ddf43d02ad0cb362c6..1e7ab494a8415f50d462274d6c436a718d169998 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -742,7 +742,7 @@ static av_cold int svq1_decode_init(AVCodecContext *avctx)
     int i;
     int offset = 0;
 
-    s->prev = avcodec_alloc_frame();
+    s->prev = av_frame_alloc();
     if (!s->prev)
         return AVERROR(ENOMEM);
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d52c96cb32678cb8f542806b7dc4db18ec3d57b1..cf45607cc7c5f4224eece48c5c5c0f207f780776 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1559,7 +1559,7 @@ static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
     AVFrame *frame = NULL;
     int ret;
 
-    if (!(frame = avcodec_alloc_frame()))
+    if (!(frame = av_frame_alloc()))
         return AVERROR(ENOMEM);
 
     frame->format         = src->format;
diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index c47ccd06feb2b52f89c50d74c889871b378a6043..e5a858d5ae1a595168e95562a1f3b53fcdef1e83 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -126,7 +126,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
         return AVERROR_OPTION_NOT_FOUND;
     }
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     if (!avctx->coded_frame) {
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
index 51ec6ef57e8ae6e3d4bdff9a68556aba88541c59..1e53bdbdda4bef63a83d073f7dc75b2c85378716 100644
--- a/libavcodec/v210enc.c
+++ b/libavcodec/v210enc.c
@@ -36,7 +36,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_WARNING, "bits per raw sample: %d != 10-bit\n",
                avctx->bits_per_raw_sample);
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
     if (!avctx->coded_frame)
         return AVERROR(ENOMEM);
 
diff --git a/libavcodec/v308enc.c b/libavcodec/v308enc.c
index 7a97d5ad3aeca3ece24ad709f958c8260bb12737..c6c5ac5015ab16f56ac51161a12b35a756a916c4 100644
--- a/libavcodec/v308enc.c
+++ b/libavcodec/v308enc.c
@@ -31,7 +31,7 @@ static av_cold int v308_encode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     if (!avctx->coded_frame) {
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
diff --git a/libavcodec/v408enc.c b/libavcodec/v408enc.c
index 85cf7c84eb5ea86d6a453d60cadb65cf20aa9564..20f08c74edb58e01e39b96bd11e329eac0b04bcb 100644
--- a/libavcodec/v408enc.c
+++ b/libavcodec/v408enc.c
@@ -26,7 +26,7 @@
 
 static av_cold int v408_encode_init(AVCodecContext *avctx)
 {
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     if (!avctx->coded_frame) {
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
diff --git a/libavcodec/v410enc.c b/libavcodec/v410enc.c
index c4ce3dfd049813e27c5933b8d2a4e10f86ad6ad2..0e2e82a7f9da4d35bdde90d81458d983e67aabd6 100644
--- a/libavcodec/v410enc.c
+++ b/libavcodec/v410enc.c
@@ -32,7 +32,7 @@ static av_cold int v410_encode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     if (!avctx->coded_frame) {
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
diff --git a/libavcodec/xfaceenc.c b/libavcodec/xfaceenc.c
index e737f6d9d5e0b8458a16b36b12681e2979f1a05b..e213c9d70a942f2817e2e11301dc0f52b9c900a7 100644
--- a/libavcodec/xfaceenc.c
+++ b/libavcodec/xfaceenc.c
@@ -125,7 +125,7 @@ static void encode_block(char *bitmap, int w, int h, int level, ProbRangesQueue
 
 static av_cold int xface_encode_init(AVCodecContext *avctx)
 {
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
     if (!avctx->coded_frame)
         return AVERROR(ENOMEM);
     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
diff --git a/libavcodec/y41penc.c b/libavcodec/y41penc.c
index 41666ccf33b48daedc2e95260a5a40f7a93a964e..8f67944adff8c39ca4f5e81471290c717eb124d5 100644
--- a/libavcodec/y41penc.c
+++ b/libavcodec/y41penc.c
@@ -30,7 +30,7 @@ static av_cold int y41p_encode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
     avctx->bits_per_coded_sample = 12;
 
     if (!avctx->coded_frame) {
diff --git a/libavcodec/yuv4enc.c b/libavcodec/yuv4enc.c
index 8d3907bc7affd0a637b8b259d0ae12e2125e226c..ed0fc776db1074728ca4436c5f7da2485f0c325b 100644
--- a/libavcodec/yuv4enc.c
+++ b/libavcodec/yuv4enc.c
@@ -25,7 +25,7 @@
 
 static av_cold int yuv4_encode_init(AVCodecContext *avctx)
 {
-    avctx->coded_frame = avcodec_alloc_frame();
+    avctx->coded_frame = av_frame_alloc();
 
     if (!avctx->coded_frame) {
         av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c
index b7a103b66ceec87431512d9a6c344d3987c12b48..58d98cfdb688d7b3d25976f2e0f9daf2318c3384 100644
--- a/libavfilter/lavfutils.c
+++ b/libavfilter/lavfutils.c
@@ -57,7 +57,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
         goto end;
     }
 
-    if (!(frame = avcodec_alloc_frame()) ) {
+    if (!(frame = av_frame_alloc()) ) {
         av_log(log_ctx, AV_LOG_ERROR, "Failed to alloc frame\n");
         ret = AVERROR(ENOMEM);
         goto end;
diff --git a/libavfilter/libmpcodecs/vf_uspp.c b/libavfilter/libmpcodecs/vf_uspp.c
index 54cc0f9e115475e4256cd7e0e7435fa2fb45a130..1fb252386cecc00be34974053af1900d518d85c4 100644
--- a/libavfilter/libmpcodecs/vf_uspp.c
+++ b/libavfilter/libmpcodecs/vf_uspp.c
@@ -245,8 +245,8 @@ static int config(struct vf_instance *vf,
             av_dict_free(&opts);
             assert(avctx_enc->codec);
         }
-        vf->priv->frame= avcodec_alloc_frame();
-        vf->priv->frame_dec= avcodec_alloc_frame();
+        vf->priv->frame= av_frame_alloc();
+        vf->priv->frame_dec= av_frame_alloc();
 
         vf->priv->outbuf_size= (width + BLOCK)*(height + BLOCK)*10;
         vf->priv->outbuf= malloc(vf->priv->outbuf_size);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4b5c014b9f4e882b38317cd11bfa5dd5c807fdfe..8c497d62da8a20431ea6c8ba4feaee0a5a54726e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2448,7 +2448,7 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, A
 {
     const AVCodec *codec;
     int got_picture = 1, ret = 0;
-    AVFrame *frame = avcodec_alloc_frame();
+    AVFrame *frame = av_frame_alloc();
     AVSubtitle subtitle;
     AVPacket pkt = *avpkt;