diff --git a/ffmpeg.c b/ffmpeg.c
index 62e7d8222d..3322e15928 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2508,7 +2508,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
                              1000, AV_TIME_BASE);
             if (end < ist->prev_sub.subtitle.end_display_time) {
                 av_log(ist->dec_ctx, AV_LOG_DEBUG,
-                       "Subtitle duration reduced from %d to %d%s\n",
+                       "Subtitle duration reduced from %"PRId32" to %d%s\n",
                        ist->prev_sub.subtitle.end_display_time, end,
                        end <= 0 ? ", dropping it" : "");
                 ist->prev_sub.subtitle.end_display_time = end;
diff --git a/ffprobe.c b/ffprobe.c
index 17888c7063..37dc0d02dd 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2243,7 +2243,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
 
     /* print AVI/FourCC tag */
     print_str("codec_tag_string",    av_4cc2str(par->codec_tag));
-    print_fmt("codec_tag", "0x%04x", par->codec_tag);
+    print_fmt("codec_tag", "0x%04"PRIx32, par->codec_tag);
 
     switch (par->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 3986347ee2..d95e30d10d 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1500,7 +1500,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
 
                 tmp_32 = ff_mlz_decompression(ctx->mlz, gb, nchars, larray);
                 if(tmp_32 != nchars) {
-                    av_log(ctx->avctx, AV_LOG_ERROR, "Error in MLZ decompression (%d, %d).\n", tmp_32, nchars);
+                    av_log(ctx->avctx, AV_LOG_ERROR, "Error in MLZ decompression (%"PRId32", %d).\n", tmp_32, nchars);
                     return AVERROR_INVALIDDATA;
                 }
 
@@ -1543,7 +1543,7 @@ static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) {
 
                 tmp_32 = ff_mlz_decompression(ctx->mlz, gb, nchars, larray);
                 if(tmp_32 != nchars) {
-                    av_log(ctx->avctx, AV_LOG_ERROR, "Error in MLZ decompression (%d, %d).\n", tmp_32, nchars);
+                    av_log(ctx->avctx, AV_LOG_ERROR, "Error in MLZ decompression (%"PRId32", %d).\n", tmp_32, nchars);
                     return AVERROR_INVALIDDATA;
                 }
 
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index b99598b4ee..a6b14b8e24 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -495,7 +495,7 @@ static inline int ape_decode_value_3860(APEContext *ctx, GetBitContext *gb,
     else if(rice->k <= MIN_CACHE_BITS) {
         x = (overflow << rice->k) + get_bits(gb, rice->k);
     } else {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", rice->k);
+        av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %"PRIu32"\n", rice->k);
         return AVERROR_INVALIDDATA;
     }
     rice->ksum += x - (rice->ksum + 8 >> 4);
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 69deabe770..ed528fe4af 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -176,7 +176,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
         n      = codes[i].bits;
         code   = codes[i].code;
         symbol = codes[i].symbol;
-        ff_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
+        ff_dlog(NULL, "i=%d n=%d code=0x%"PRIx32"\n", i, n, code);
         if (n <= table_nb_bits) {
             /* no need to add another table */
             j = code >> (32 - table_nb_bits);
@@ -310,7 +310,8 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes,
         }                                                                   \
         GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);            \
         if (buf[j].code >= (1LL<<buf[j].bits)) {                            \
-            av_log(NULL, AV_LOG_ERROR, "Invalid code %x for %d in init_vlc\n", buf[j].code, i);\
+            av_log(NULL, AV_LOG_ERROR, "Invalid code %"PRIx32" for %d in "  \
+                   "init_vlc\n", buf[j].code, i);                           \
             if (!(flags & INIT_VLC_USE_NEW_STATIC))                         \
                 av_free(buf);                                               \
             return -1;                                                      \
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
index d462385ca8..1308ec005f 100644
--- a/libavcodec/bmp.c
+++ b/libavcodec/bmp.c
@@ -149,7 +149,8 @@ static int bmp_decode_frame(AVCodecContext *avctx,
             else if (rgb[0] == 0x000000FF && rgb[1] == 0x0000FF00 && rgb[2] == 0x00FF0000)
                 avctx->pix_fmt = alpha ? AV_PIX_FMT_RGBA : AV_PIX_FMT_RGB0;
             else {
-                av_log(avctx, AV_LOG_ERROR, "Unknown bitfields %0X %0X %0X\n", rgb[0], rgb[1], rgb[2]);
+                av_log(avctx, AV_LOG_ERROR, "Unknown bitfields "
+                       "%0"PRIX32" %0"PRIX32" %0"PRIX32"\n", rgb[0], rgb[1], rgb[2]);
                 return AVERROR(EINVAL);
             }
         } else {
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 305fd52daa..f67763ef47 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -111,7 +111,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
         int index;
 
         if ((index = ff_dnxhd_get_cid_table(cid)) < 0) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %d\n", cid);
+            av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %"PRIu32"\n", cid);
             return AVERROR(ENOSYS);
         }
         if (ff_dnxhd_cid_table[index].bit_depth != bitdepth &&
@@ -120,7 +120,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
             return AVERROR_INVALIDDATA;
         }
         ctx->cid_table = &ff_dnxhd_cid_table[index];
-        av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %d.\n", cid);
+        av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %"PRIu32".\n", cid);
 
         ff_free_vlc(&ctx->ac_vlc);
         ff_free_vlc(&ctx->dc_vlc);
@@ -316,10 +316,11 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
 
     for (i = 0; i < ctx->mb_height; i++) {
         ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));
-        ff_dlog(ctx->avctx, "mb scan index %d, pos %d: %u\n", i, 0x170 + (i << 2), ctx->mb_scan_index[i]);
+        ff_dlog(ctx->avctx, "mb scan index %d, pos %d: %"PRIu32"\n",
+                i, 0x170 + (i << 2), ctx->mb_scan_index[i]);
         if (buf_size - ctx->data_offset < ctx->mb_scan_index[i]) {
             av_log(ctx->avctx, AV_LOG_ERROR,
-                   "invalid mb scan index (%u vs %u).\n",
+                   "invalid mb scan index (%"PRIu32" vs %u).\n",
                    ctx->mb_scan_index[i], buf_size - ctx->data_offset);
             return AVERROR_INVALIDDATA;
         }
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index a8d7a07ae4..7b16787e27 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -222,8 +222,8 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, int16_t *block)
 
     /* get the AC coefficients until last_index is reached */
     for (;;) {
-        ff_dlog(NULL, "%2d: bits=%04x index=%u\n", pos, SHOW_UBITS(re, gb, 16),
-                re_index);
+        ff_dlog(NULL, "%2d: bits=%04"PRIx32" index=%u\n",
+                pos, SHOW_UBITS(re, gb, 16), re_index);
         /* our own optimized GET_RL_VLC */
         index   = NEG_USR32(re_cache, TEX_VLC_BITS);
         vlc_len = ff_dv_rl_vlc[index].len;
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index e91d63ea29..22ce728ea6 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -747,7 +747,7 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
         int i;
         av_log(avctx, AV_LOG_DEBUG, "palette:");
         for(i=0;i<16;i++)
-            av_log(avctx, AV_LOG_DEBUG, " 0x%06x", ctx->palette[i]);
+            av_log(avctx, AV_LOG_DEBUG, " 0x%06"PRIx32, ctx->palette[i]);
         av_log(avctx, AV_LOG_DEBUG, "\n");
     }
 
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index 29e0322daa..26afdc666b 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -343,7 +343,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
     av_log(avctx, AV_LOG_DEBUG, "Selected palette:");
     for (i = 0; i < 4; i++)
-        av_log(avctx, AV_LOG_DEBUG, " 0x%06x@@%02x (0x%x,0x%x)",
+        av_log(avctx, AV_LOG_DEBUG, " 0x%06"PRIx32"@@%02x (0x%x,0x%x)",
                dvdc->global_palette[out_palette[i]], out_alpha[i],
                out_palette[i], out_alpha[i] >> 4);
     av_log(avctx, AV_LOG_DEBUG, "\n");
diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c
index ea5da610da..6f8652ad49 100644
--- a/libavcodec/dxtory.c
+++ b/libavcodec/dxtory.c
@@ -201,12 +201,12 @@ static int check_slice_size(AVCodecContext *avctx,
 
     if (slice_size > src_size - off) {
         av_log(avctx, AV_LOG_ERROR,
-               "invalid slice size %"PRIu32" (only %"PRIu32" bytes left)\n",
+               "invalid slice size %d (only %d bytes left)\n",
                slice_size, src_size - off);
         return AVERROR_INVALIDDATA;
     }
     if (slice_size <= 16) {
-        av_log(avctx, AV_LOG_ERROR, "invalid slice size %"PRIu32"\n",
+        av_log(avctx, AV_LOG_ERROR, "invalid slice size %d\n",
                slice_size);
         return AVERROR_INVALIDDATA;
     }
@@ -214,7 +214,7 @@ static int check_slice_size(AVCodecContext *avctx,
     cur_slice_size = AV_RL32(src + off);
     if (cur_slice_size != slice_size - 16) {
         av_log(avctx, AV_LOG_ERROR,
-               "Slice sizes mismatch: got %"PRIu32" instead of %"PRIu32"\n",
+               "Slice sizes mismatch: got %d instead of %d\n",
                cur_slice_size, slice_size - 16);
     }
 
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index b1f826ac41..4b1c2d25cc 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -374,7 +374,7 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
         break;
     case MKBETAG('Y', 'C', 'G', '6'):
     case MKBETAG('Y', 'G', '1', '0'):
-        avpriv_report_missing_feature(avctx, "Tag 0x%08X", tag);
+        avpriv_report_missing_feature(avctx, "Tag 0x%08"PRIX32, tag);
         return AVERROR_PATCHWELCOME;
     default:
         /* Old version does not have a real header, just size and type. */
@@ -401,7 +401,7 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
             ctx->tex_funct = ctx->texdsp.dxt1_block;
             ctx->tex_step  = 8;
         } else {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported header (0x%08X)\n.", tag);
+            av_log(avctx, AV_LOG_ERROR, "Unsupported header (0x%08"PRIX32")\n.", tag);
             return AVERROR_INVALIDDATA;
         }
         ctx->tex_rat = 1;
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 7f1bc4fcf4..1a50767171 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -870,7 +870,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
                 fs->slice_damaged = 1;
             }
             if (avctx->debug & FF_DEBUG_PICT_INFO) {
-                av_log(avctx, AV_LOG_DEBUG, "slice %d, CRC: 0x%08X\n", i, AV_RB32(buf_p + v - 4));
+                av_log(avctx, AV_LOG_DEBUG, "slice %d, CRC: 0x%08"PRIX32"\n", i, AV_RB32(buf_p + v - 4));
             }
         }
 
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 287b24e832..acd55cc513 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -649,7 +649,7 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx,
         vui->vui_num_units_in_tick               = get_bits_long(gb, 32);
         vui->vui_time_scale                      = get_bits_long(gb, 32);
         if (alt) {
-            av_log(avctx, AV_LOG_INFO, "Retry got %i/%i fps\n",
+            av_log(avctx, AV_LOG_INFO, "Retry got %"PRIu32"/%"PRIu32" fps\n",
                    vui->vui_time_scale, vui->vui_num_units_in_tick);
         }
         vui->vui_poc_proportional_to_timing_flag = get_bits1(gb);
diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c
index 138d960411..1bc123e659 100644
--- a/libavcodec/hqx.c
+++ b/libavcodec/hqx.c
@@ -417,7 +417,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, void *data,
 
     info_tag    = AV_RL32(src);
     if (info_tag == MKTAG('I', 'N', 'F', 'O')) {
-        unsigned info_offset = AV_RL32(src + 4);
+        uint32_t info_offset = AV_RL32(src + 4);
         if (info_offset > INT_MAX || info_offset + 8 > avpkt->size) {
             av_log(avctx, AV_LOG_ERROR,
                    "Invalid INFO header offset: 0x%08"PRIX32" is too large.\n",
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 995e908791..075ada6ddd 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -934,7 +934,7 @@ static void decode_delta_j(uint8_t *dst,
                 offset = bytestream2_get_be16(&gb);
 
                 if (cols * bpp == 0 || bytestream2_get_bytes_left(&gb) < cols * bpp) {
-                    av_log(NULL, AV_LOG_ERROR, "cols*bpp is invalid (%d*%d)", cols, bpp);
+                    av_log(NULL, AV_LOG_ERROR, "cols*bpp is invalid (%"PRId32"*%d)", cols, bpp);
                     return;
                 }
 
@@ -982,7 +982,7 @@ static void decode_delta_j(uint8_t *dst,
                         unsigned noffset = offset + (r * pitch) + d * planepitch;
 
                         if (!bytes || bytestream2_get_bytes_left(&gb) < bytes) {
-                            av_log(NULL, AV_LOG_ERROR, "bytes %d is invalid", bytes);
+                            av_log(NULL, AV_LOG_ERROR, "bytes %"PRId32" is invalid", bytes);
                             return;
                         }
 
diff --git a/libavcodec/microdvddec.c b/libavcodec/microdvddec.c
index e8d271931f..4a34267793 100644
--- a/libavcodec/microdvddec.c
+++ b/libavcodec/microdvddec.c
@@ -214,7 +214,7 @@ static void microdvd_open_tags(AVBPrint *new_line, struct microdvd_tag *tags)
             break;
 
         case 'c':
-            av_bprintf(new_line, "{\\c&H%06X&}", tags[i].data1);
+            av_bprintf(new_line, "{\\c&H%06"PRIX32"&}", tags[i].data1);
             break;
 
         case 'f':
@@ -223,7 +223,7 @@ static void microdvd_open_tags(AVBPrint *new_line, struct microdvd_tag *tags)
             break;
 
         case 's':
-            av_bprintf(new_line, "{\\fs%d}", tags[i].data1);
+            av_bprintf(new_line, "{\\fs%"PRId32"}", tags[i].data1);
             break;
 
         case 'p':
@@ -232,7 +232,7 @@ static void microdvd_open_tags(AVBPrint *new_line, struct microdvd_tag *tags)
             break;
 
         case 'o':
-            av_bprintf(new_line, "{\\pos(%d,%d)}",
+            av_bprintf(new_line, "{\\pos(%"PRId32",%"PRId32")}",
                        tags[i].data1, tags[i].data2);
             break;
         }
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index ec109b3d45..9cce88e263 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -280,7 +280,8 @@ static av_cold void decode_init_static(void)
         scale_factor_mult[i][0] = MULLx(norm, FIXR(1.0          * 2.0), FRAC_BITS);
         scale_factor_mult[i][1] = MULLx(norm, FIXR(0.7937005259 * 2.0), FRAC_BITS);
         scale_factor_mult[i][2] = MULLx(norm, FIXR(0.6299605249 * 2.0), FRAC_BITS);
-        ff_dlog(NULL, "%d: norm=%x s=%x %x %x\n", i, norm,
+        ff_dlog(NULL, "%d: norm=%x s=%"PRIx32" %"PRIx32" %"PRIx32"\n", i,
+                (unsigned)norm,
                 scale_factor_mult[i][0],
                 scale_factor_mult[i][1],
                 scale_factor_mult[i][2]);
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 30cfc55cbc..f87e8631b1 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -251,7 +251,7 @@ int ff_combine_frame(ParseContext *pc, int next,
                      const uint8_t **buf, int *buf_size)
 {
     if (pc->overread) {
-        ff_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n",
+        ff_dlog(NULL, "overread %d, state:%"PRIX32" next:%d index:%d o_index:%d\n",
                 pc->overread, pc->state, next, pc->index, pc->overread_index);
         ff_dlog(NULL, "%X %X %X %X\n",
                 (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
@@ -314,7 +314,7 @@ int ff_combine_frame(ParseContext *pc, int next,
     }
 
     if (pc->overread) {
-        ff_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n",
+        ff_dlog(NULL, "overread %d, state:%"PRIX32" next:%d index:%d o_index:%d\n",
                 pc->overread, pc->state, next, pc->index, pc->overread_index);
         ff_dlog(NULL, "%X %X %X %X\n",
                 (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 1d4734d397..4aa59f8f33 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -324,7 +324,8 @@ static int read_highpass(AVCodecContext *avctx, uint8_t *ptr, int plane, AVFrame
 
         magic = bytestream2_get_be32(&ctx->gb);
         if (magic != 0xDEADBEEF) {
-            av_log(avctx, AV_LOG_ERROR, "wrong magic number: 0x%08X for plane %d, band %d\n", magic, plane, i);
+            av_log(avctx, AV_LOG_ERROR, "wrong magic number: 0x%08"PRIX32
+                   " for plane %d, band %d\n", magic, plane, i);
             return AVERROR_INVALIDDATA;
         }
 
@@ -575,7 +576,7 @@ static int pixlet_decode_frame(AVCodecContext *avctx, void *data,
 
     pktsize = bytestream2_get_be32(&ctx->gb);
     if (pktsize <= 44 || pktsize - 4 > bytestream2_get_bytes_left(&ctx->gb)) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid packet size %u.\n", pktsize);
+        av_log(avctx, AV_LOG_ERROR, "Invalid packet size %"PRIu32"\n", pktsize);
         return AVERROR_INVALIDDATA;
     }
 
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index ff90d12c5c..3157c11da1 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -491,7 +491,8 @@ static int read_header(ShortenContext *s)
         if ((ret = decode_aiff_header(s->avctx, s->header, s->header_size)) < 0)
             return ret;
     } else {
-        avpriv_report_missing_feature(s->avctx, "unsupported bit packing %X", AV_RL32(s->header));
+        avpriv_report_missing_feature(s->avctx, "unsupported bit packing %"
+                                      PRIX32, AV_RL32(s->header));
         return AVERROR_PATCHWELCOME;
     }
 
diff --git a/libavcodec/tiff_common.c b/libavcodec/tiff_common.c
index 35119af558..0af62ee962 100644
--- a/libavcodec/tiff_common.c
+++ b/libavcodec/tiff_common.c
@@ -97,7 +97,7 @@ int ff_tadd_rational_metadata(int count, const char *name, const char *sep,
     for (i = 0; i < count; i++) {
         nom   = ff_tget_long(gb, le);
         denom = ff_tget_long(gb, le);
-        av_bprintf(&bp, "%s%7i:%-7i", auto_sep(count, sep, i, 4), nom, denom);
+        av_bprintf(&bp, "%s%7"PRId32":%-7"PRId32, auto_sep(count, sep, i, 4), nom, denom);
     }
 
     if ((i = av_bprint_finalize(&bp, &ap))) {
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 0a5eaa6879..bc6c5875c2 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -731,7 +731,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
         if (!res_setup->classifs)
             return AVERROR(ENOMEM);
 
-        ff_dlog(NULL, "    begin %d end %d part.size %d classif.s %d classbook %d \n",
+        ff_dlog(NULL, "    begin %"PRIu32" end %"PRIu32" part.size %d classif.s %d classbook %d \n",
                 res_setup->begin, res_setup->end, res_setup->partition_size,
                 res_setup->classifications, res_setup->classbook);
 
@@ -876,7 +876,7 @@ static int create_map(vorbis_context *vc, unsigned floor_number)
     }
 
     for (idx = 0; idx <= n; ++idx) {
-        ff_dlog(NULL, "floor0 map: map at pos %d is %d\n", idx, map[idx]);
+        ff_dlog(NULL, "floor0 map: map at pos %d is %"PRId32"\n", idx, map[idx]);
     }
 
     return 0;
@@ -1012,7 +1012,7 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
     if (!vc->fdsp)
         return AVERROR(ENOMEM);
 
-    ff_dlog(NULL, " vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ",
+    ff_dlog(NULL, " vorbis version %"PRIu32" \n audio_channels %"PRIu8" \n audio_samplerate %"PRIu32" \n bitrate_max %"PRIu32" \n bitrate_nom %"PRIu32" \n bitrate_min %"PRIu32" \n blk_0 %"PRIu32" blk_1 %"PRIu32" \n ",
             vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]);
 
 /*
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 5b1fe40a42..5c99628c52 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -701,7 +701,7 @@ static int decode_tilehdr(WMAProDecodeCtx *s)
         int i;
         int offset = 0;
         for (i = 0; i < s->channel[c].num_subframes; i++) {
-            ff_dlog(s->avctx, "frame[%i] channel[%i] subframe[%i]"
+            ff_dlog(s->avctx, "frame[%"PRIu32"] channel[%i] subframe[%i]"
                     " len %i\n", s->frame_num, c, i,
                     s->channel[c].subframe_len[i]);
             s->channel[c].subframe_offset[i] = offset;
diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
index 1248fd9b75..2800ed9d80 100644
--- a/libavfilter/af_hdcd.c
+++ b/libavfilter/af_hdcd.c
@@ -1077,7 +1077,8 @@ static int hdcd_integrate(HDCDContext *ctx, hdcd_state *states, int channels, in
                         /* one of bits 3, 6, or 7 was not 0 */
                         states[i].code_counterA_almost++;
                         av_log(ctx->fctx, AV_LOG_VERBOSE,
-                            "hdcd error: Control A almost: 0x%02x near %d\n", wbits & 0xff, ctx->sample_count);
+                               "hdcd error: Control A almost: 0x%02"PRIx32" near %d\n",
+                               wbits & 0xff, ctx->sample_count);
                     }
                 } else if ((wbits & 0xa0060000) == 0xa0060000) {
                     /* B: 8-bit code, 8-bit XOR check, 0x7e0fa006[....] */
@@ -1091,7 +1092,9 @@ static int hdcd_integrate(HDCDContext *ctx, hdcd_state *states, int channels, in
                         /* XOR check failed */
                         states[i].code_counterB_checkfails++;
                         av_log(ctx->fctx, AV_LOG_VERBOSE,
-                            "hdcd error: Control B check failed: 0x%04x (0x%02x vs 0x%02x) near %d\n", wbits & 0xffff, (wbits & 0xff00) >> 8, ~wbits & 0xff, ctx->sample_count);
+                               "hdcd error: Control B check failed: 0x%04"PRIx32
+                               " (0x%02"PRIx32" vs 0x%02"PRIx32") near %d\n",
+                               wbits & 0xffff, (wbits & 0xff00) >> 8, ~wbits & 0xff, ctx->sample_count);
                     }
                 }
                 if (f) {
diff --git a/libavfilter/f_perms.c b/libavfilter/f_perms.c
index 40b8811149..da11d506a7 100644
--- a/libavfilter/f_perms.c
+++ b/libavfilter/f_perms.c
@@ -64,7 +64,7 @@ static av_cold int init(AVFilterContext *ctx)
         if (s->random_seed == -1)
             s->random_seed = av_get_random_seed();
         seed = s->random_seed;
-        av_log(ctx, AV_LOG_INFO, "random seed: 0x%08x\n", seed);
+        av_log(ctx, AV_LOG_INFO, "random seed: 0x%08"PRIx32"\n", seed);
         av_lfg_init(&s->lfg, seed);
     }
 
diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c
index 5e69873b4c..b470079ccc 100644
--- a/libavfilter/vf_palettegen.c
+++ b/libavfilter/vf_palettegen.c
@@ -239,7 +239,7 @@ static void write_palette(AVFilterContext *ctx, AVFrame *out)
             if (box_id < s->nb_boxes) {
                 pal[x] = s->boxes[box_id++].color;
                 if ((x || y) && pal[x] == last_color)
-                    av_log(ctx, AV_LOG_WARNING, "Dupped color: %08X\n", pal[x]);
+                    av_log(ctx, AV_LOG_WARNING, "Dupped color: %08"PRIX32"\n", pal[x]);
                 last_color = pal[x];
             } else {
                 pal[x] = 0xff000000; // pad with black
diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 69d3be92da..e8dde572cd 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -491,7 +491,7 @@ static void disp_node(AVBPrint *buf,
     av_bprintf(buf, "%*cnode%d ["
                "label=\"%c%02X%c%02X%c%02X%c\" "
                "fillcolor=\"#%02x%02x%02x\" "
-               "fontcolor=\"#%06X\"]\n",
+               "fontcolor=\"#%06"PRIX32"\"]\n",
                depth*INDENT, ' ', node->palette_id,
                "[  "[node->split], node->val[0],
                "][ "[node->split], node->val[1],
@@ -552,7 +552,7 @@ static int debug_accuracy(const struct color_node *node, const uint32_t *palette
                     const int d2 = diff(palrgb2, rgb);
                     if (d1 != d2) {
                         av_log(NULL, AV_LOG_ERROR,
-                               "/!\\ %02X%02X%02X: %d ! %d (%06X ! %06X) / dist: %d ! %d\n",
+                               "/!\\ %02X%02X%02X: %d ! %d (%06"PRIX32" ! %06"PRIX32") / dist: %d ! %d\n",
                                r, g, b, r1, r2, c1 & 0xffffff, c2 & 0xffffff, d1, d2);
                         ret = 1;
                     }
diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c
index 4961f762f4..afdceff7f1 100644
--- a/libavfilter/vsrc_cellauto.c
+++ b/libavfilter/vsrc_cellauto.c
@@ -199,7 +199,7 @@ static av_cold int init(AVFilterContext *ctx)
     }
 
     av_log(ctx, AV_LOG_VERBOSE,
-           "s:%dx%d r:%d/%d rule:%d stitch:%d scroll:%d full:%d seed:%u\n",
+           "s:%dx%d r:%d/%d rule:%d stitch:%d scroll:%d full:%d seed:%"PRIu32"\n",
            s->w, s->h, s->frame_rate.num, s->frame_rate.den,
            s->rule, s->stitch, s->scroll, s->start_full,
            s->random_seed);
diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c
index 8d51051487..afe805a675 100644
--- a/libavfilter/vsrc_life.c
+++ b/libavfilter/vsrc_life.c
@@ -260,7 +260,7 @@ static av_cold int init(AVFilterContext *ctx)
     }
 
     av_log(ctx, AV_LOG_VERBOSE,
-           "s:%dx%d r:%d/%d rule:%s stay_rule:%d born_rule:%d stitch:%d seed:%u\n",
+           "s:%dx%d r:%d/%d rule:%s stay_rule:%d born_rule:%d stitch:%d seed:%"PRIu32"\n",
            life->w, life->h, life->frame_rate.num, life->frame_rate.den,
            life->rule_str, life->stay_rule, life->born_rule, life->stitch,
            life->random_seed);
diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 39dea40b80..8d39b1d9ba 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -112,7 +112,8 @@ static int aa_read_header(AVFormatContext *s)
             header_seed = atoi(val);
         } else if (!strcmp(key, "HeaderKey")) { // this looks like "1234567890 1234567890 1234567890 1234567890"
             av_log(s, AV_LOG_DEBUG, "HeaderKey is <%s>\n", val);
-            sscanf(val, "%u%u%u%u", &header_key_part[0], &header_key_part[1], &header_key_part[2], &header_key_part[3]);
+            sscanf(val, "%"SCNu32"%"SCNu32"%"SCNu32"%"SCNu32,
+                   &header_key_part[0], &header_key_part[1], &header_key_part[2], &header_key_part[3]);
             for (idx = 0; idx < 4; idx++) {
                 AV_WB32(&header_key[idx * 4], header_key_part[idx]); // convert each part to BE!
             }
diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
index 2acdac1d25..4dd50f316d 100644
--- a/libavformat/apngdec.c
+++ b/libavformat/apngdec.c
@@ -404,7 +404,7 @@ static int apng_read_packet(AVFormatContext *s, AVPacket *pkt)
             return ret;
         return 0;
     default:
-        avpriv_request_sample(s, "In-stream tag=%s (0x%08X) len=%"PRIu32,
+        avpriv_request_sample(s, "In-stream tag=%s (0x%08"PRIX32") len=%"PRIu32,
                               av_4cc2str(tag), tag, len);
         avio_skip(pb, len + 4);
     }
diff --git a/libavformat/astdec.c b/libavformat/astdec.c
index 7a53d0bb70..4ba08c2180 100644
--- a/libavformat/astdec.c
+++ b/libavformat/astdec.c
@@ -102,7 +102,7 @@ static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)
         pkt->stream_index = 0;
         pkt->pos = pos;
     } else {
-        av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type);
+        av_log(s, AV_LOG_ERROR, "unknown chunk %"PRIx32"\n", type);
         avio_skip(s->pb, size);
         ret = AVERROR_INVALIDDATA;
     }
diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index 2e1cada158..87690e3f73 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -230,7 +230,7 @@ static int read_header(AVFormatContext *s)
     b->current_block = 0;
     b->block_count = read32(s);
     if (b->block_count > UINT16_MAX) {
-        av_log(s, AV_LOG_WARNING, "too many blocks: %u\n", b->block_count);
+        av_log(s, AV_LOG_WARNING, "too many blocks: %"PRIu32"\n", b->block_count);
         return AVERROR_INVALIDDATA;
     }
 
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 1f31968ab9..6232c70da2 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -134,7 +134,7 @@ static void set_codec_str(AVFormatContext *s, AVCodecParameters *par,
         tags[0] = ff_mp4_obj_type;
         oti = av_codec_get_tag(tags, par->codec_id);
         if (oti)
-            av_strlcatf(str, size, ".%02x", oti);
+            av_strlcatf(str, size, ".%02"PRIx32, oti);
         else
             return;
 
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 3e6218303d..7c811ce5d2 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -421,7 +421,8 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
             dump_audioservicetype(ctx, &sd);
             break;
         case AV_PKT_DATA_QUALITY_STATS:
-            av_log(ctx, AV_LOG_INFO, "quality factor: %d, pict_type: %c", AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
+            av_log(ctx, AV_LOG_INFO, "quality factor: %"PRId32", pict_type: %c",
+                   AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
             break;
         case AV_PKT_DATA_CPB_PROPERTIES:
             av_log(ctx, AV_LOG_INFO, "cpb: ");
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index 91bcdcd99e..a567b5299c 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -68,7 +68,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
                                                   pkt->side_data[i].data,
                                                   pkt->side_data[i].size);
             }
-            av_strlcatf(buf, sizeof(buf), ", %8d, 0x%08x", pkt->side_data[i].size, side_data_crc);
+            av_strlcatf(buf, sizeof(buf), ", %8d, 0x%08"PRIx32, pkt->side_data[i].size, side_data_crc);
         }
     }
     av_strlcatf(buf, sizeof(buf), "\n");
diff --git a/libavformat/ircamdec.c b/libavformat/ircamdec.c
index a6b7a280f3..d376ffef63 100644
--- a/libavformat/ircamdec.c
+++ b/libavformat/ircamdec.c
@@ -94,7 +94,7 @@ static int ircam_read_header(AVFormatContext *s)
 
     st->codecpar->codec_id = ff_codec_get_id(tags, tag);
     if (st->codecpar->codec_id == AV_CODEC_ID_NONE) {
-        av_log(s, AV_LOG_ERROR, "unknown tag %X\n", tag);
+        av_log(s, AV_LOG_ERROR, "unknown tag %"PRIx32"\n", tag);
         return AVERROR_INVALIDDATA;
     }
 
diff --git a/libavformat/mov.c b/libavformat/mov.c
index e2474a10da..f130488718 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -412,7 +412,7 @@ retry:
                     key = c->meta_keys[index];
                 } else {
                     av_log(c->fc, AV_LOG_WARNING,
-                           "The index of 'data' is out of range: %d < 1 or >= %d.\n",
+                           "The index of 'data' is out of range: %"PRId32" < 1 or >= %d.\n",
                            index, c->meta_keys_count);
                 }
             }
@@ -686,7 +686,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                     avio_skip(pb, len);
             }
         } else {
-            av_log(c->fc, AV_LOG_DEBUG, "Unknown dref type 0x%08x size %d\n",
+            av_log(c->fc, AV_LOG_DEBUG, "Unknown dref type 0x%08"PRIx32" size %"PRIu32"\n",
                    dref->type, size);
             entries--;
             i--;
@@ -700,7 +700,7 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     uint32_t type;
-    uint32_t av_unused ctype;
+    uint32_t ctype;
     int64_t title_size;
     char *title_str;
     int ret;
@@ -712,8 +712,8 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     ctype = avio_rl32(pb);
     type = avio_rl32(pb); /* component subtype */
 
-    av_log(c->fc, AV_LOG_TRACE, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
-    av_log(c->fc, AV_LOG_TRACE, "stype= %.4s\n", (char*)&type);
+    av_log(c->fc, AV_LOG_TRACE, "ctype=%s\n", av_4cc2str(ctype));
+    av_log(c->fc, AV_LOG_TRACE, "stype=%s\n", av_4cc2str(type));
 
     if (c->trak_index < 0) {  // meta not inside a trak
         if (type == MKTAG('m','d','t','a')) {
@@ -2284,8 +2284,8 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
         id = mov_codec_id(st, format);
 
         av_log(c->fc, AV_LOG_TRACE,
-               "size=%"PRId64" 4CC=%s/0x%08x codec_type=%d\n", size,
-               av_4cc2str(format), format, st->codecpar->codec_type);
+               "size=%"PRId64" 4CC=%s codec_type=%d\n", size,
+               av_4cc2str(format), st->codecpar->codec_type);
 
         if (st->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) {
             st->codecpar->codec_id = id;
@@ -3816,7 +3816,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     count = avio_rb32(pb);
     if (count > UINT_MAX / sizeof(*c->meta_keys) - 1) {
         av_log(c->fc, AV_LOG_ERROR,
-               "The 'keys' atom with the invalid key count: %d\n", count);
+               "The 'keys' atom with the invalid key count: %"PRIu32"\n", count);
         return AVERROR_INVALIDDATA;
     }
 
@@ -3830,7 +3830,8 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         uint32_t type = avio_rl32(pb);
         if (key_size < 8) {
             av_log(c->fc, AV_LOG_ERROR,
-                   "The key# %d in meta has invalid size: %d\n", i, key_size);
+                   "The key# %"PRIu32" in meta has invalid size:"
+                   "%"PRIu32"\n", i, key_size);
             return AVERROR_INVALIDDATA;
         }
         key_size -= 8;
@@ -5377,8 +5378,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                 total_size += 8;
             }
         }
-        av_log(c->fc, AV_LOG_TRACE, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
-                a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
+        av_log(c->fc, AV_LOG_TRACE, "type:'%s' parent:'%s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
+               av_4cc2str(a.type), av_4cc2str(atom.type), a.size, total_size, atom.size);
         if (a.size == 0) {
             a.size = atom.size - total_size + 8;
         }
diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c
index dc8bf8dccc..324dd5f913 100644
--- a/libavformat/mov_chan.c
+++ b/libavformat/mov_chan.c
@@ -557,8 +557,9 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
     bitmap     = avio_rb32(pb);
     num_descr  = avio_rb32(pb);
 
-    av_log(s, AV_LOG_TRACE, "chan: layout=%u bitmap=%u num_descr=%u\n",
-            layout_tag, bitmap, num_descr);
+    av_log(s, AV_LOG_TRACE, "chan: layout=%"PRIu32" "
+           "bitmap=%"PRIu32" num_descr=%"PRIu32"\n",
+           layout_tag, bitmap, num_descr);
 
     if (size < 12ULL + num_descr * 20ULL)
         return 0;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 62b9dce678..caec843ece 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1627,7 +1627,7 @@ static int mov_write_gama_tag(AVIOContext *pb, MOVTrack *track, double gamma)
 
     if (gamma > 1e-6) {
         gama = (uint32_t)lrint((double)(1<<16) * gamma);
-        av_log(pb, AV_LOG_DEBUG, "writing gama value %d\n", gama);
+        av_log(pb, AV_LOG_DEBUG, "writing gama value %"PRId32"\n", gama);
 
         av_assert0(track->mode == MODE_MOV);
         avio_wb32(pb, 12);
@@ -2279,8 +2279,8 @@ static int mov_write_hdlr_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
             descr = "TimeCodeHandler";
         } else {
             av_log(s, AV_LOG_WARNING,
-                   "Unknown hldr_type for %s / 0x%04X, writing dummy values\n",
-                   av_4cc2str(track->par->codec_tag), track->par->codec_tag);
+                   "Unknown hldr_type for %s, writing dummy values\n",
+                   av_4cc2str(track->par->codec_tag));
         }
         if (track->st) {
             // hdlr.name is used by some players to identify the content title
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 034862261a..3cbf7bd137 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -319,7 +319,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
             if ((mpah.bit_rate == 0) || (mp3->initial_bitrate != mpah.bit_rate))
                 mp3->has_variable_bitrate = 1;
         } else {
-            av_log(s, AV_LOG_WARNING, "Audio packet of size %d (starting with %08X...) "
+            av_log(s, AV_LOG_WARNING, "Audio packet of size %d (starting with %08"PRIX32"...) "
                    "is invalid, writing it anyway.\n", pkt->size, h);
         }
 
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 3250dde311..acea2e93a6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1433,7 +1433,8 @@ int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPack
             return AVERROR_INVALIDDATA;
         }
         av_log(s, AV_LOG_WARNING, "H.264 bitstream error, startcode missing, size %d", pkt->size);
-        if (pkt->size) av_log(s, AV_LOG_WARNING, " data %08X", AV_RB32(pkt->data));
+        if (pkt->size)
+            av_log(s, AV_LOG_WARNING, " data %08"PRIX32, AV_RB32(pkt->data));
         av_log(s, AV_LOG_WARNING, "\n");
     }
     return 0;
@@ -1447,7 +1448,8 @@ static int check_hevc_startcode(AVFormatContext *s, const AVStream *st, const AV
             return AVERROR_PATCHWELCOME;
         }
         av_log(s, AV_LOG_WARNING, "HEVC bitstream error, startcode missing, size %d", pkt->size);
-        if (pkt->size) av_log(s, AV_LOG_WARNING, " data %08X", AV_RB32(pkt->data));
+        if (pkt->size)
+            av_log(s, AV_LOG_WARNING, " data %08"PRIX32, AV_RB32(pkt->data));
         av_log(s, AV_LOG_WARNING, "\n");
     }
     return 0;
@@ -1565,7 +1567,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
 
         do {
             p = avpriv_find_start_code(p, buf_end, &state);
-            av_log(s, AV_LOG_TRACE, "nal %d\n", state & 0x1f);
+            av_log(s, AV_LOG_TRACE, "nal %"PRId32"\n", state & 0x1f);
             if ((state & 0x1f) == 7)
                 extradd = 0;
         } while (p < buf_end && (state & 0x1f) != 9 &&
@@ -1631,7 +1633,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
 
         do {
             p = avpriv_find_start_code(p, buf_end, &state);
-            av_log(s, AV_LOG_TRACE, "nal %d\n", (state & 0x7e)>>1);
+            av_log(s, AV_LOG_TRACE, "nal %"PRId32"\n", (state & 0x7e)>>1);
             if ((state & 0x7e) == 2*32)
                 extradd = 0;
         } while (p < buf_end && (state & 0x7e) != 2*35 &&
diff --git a/libavformat/mux.c b/libavformat/mux.c
index de70902ef1..b0130141c2 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -372,9 +372,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 if (!validate_codec_tag(s, st)) {
                     const uint32_t otag = av_codec_get_tag(s->oformat->codec_tag, par->codec_id);
                     av_log(s, AV_LOG_ERROR,
-                           "Tag %s/0x%08x incompatible with output codec id '%d' (%s)\n",
-                           av_4cc2str(par->codec_tag), par->codec_tag,
-                           par->codec_id, av_4cc2str(otag));
+                           "Tag %s incompatible with output codec id '%d' (%s)\n",
+                           av_4cc2str(par->codec_tag), par->codec_id, av_4cc2str(otag));
                     ret = AVERROR_INVALIDDATA;
                     goto fail;
                 }
diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
index 782d1dfbfb..55f22ebcf4 100644
--- a/libavformat/nistspheredec.c
+++ b/libavformat/nistspheredec.c
@@ -89,7 +89,7 @@ static int nist_read_header(AVFormatContext *s)
 
             return 0;
         } else if (!memcmp(buffer, "channel_count", 13)) {
-            sscanf(buffer, "%*s %*s %"SCNd32, &st->codecpar->channels);
+            sscanf(buffer, "%*s %*s %u", &st->codecpar->channels);
         } else if (!memcmp(buffer, "sample_byte_format", 18)) {
             sscanf(buffer, "%*s %*s %31s", format);
 
@@ -108,11 +108,11 @@ static int nist_read_header(AVFormatContext *s)
         } else if (!memcmp(buffer, "sample_count", 12)) {
             sscanf(buffer, "%*s %*s %"SCNd64, &st->duration);
         } else if (!memcmp(buffer, "sample_n_bytes", 14)) {
-            sscanf(buffer, "%*s %*s %"SCNd32, &bps);
+            sscanf(buffer, "%*s %*s %d", &bps);
         } else if (!memcmp(buffer, "sample_rate", 11)) {
-            sscanf(buffer, "%*s %*s %"SCNd32, &st->codecpar->sample_rate);
+            sscanf(buffer, "%*s %*s %d", &st->codecpar->sample_rate);
         } else if (!memcmp(buffer, "sample_sig_bits", 15)) {
-            sscanf(buffer, "%*s %*s %"SCNd32, &st->codecpar->bits_per_coded_sample);
+            sscanf(buffer, "%*s %*s %d", &st->codecpar->bits_per_coded_sample);
         } else {
             char key[32], value[32];
             if (sscanf(buffer, "%31s %*s %31s", key, value) == 2) {
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index ae179991ce..c6ddb67bbd 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -228,7 +228,7 @@ static int nsv_resync(AVFormatContext *s)
         v <<= 8;
         v |= avio_r8(pb);
         if (i < 8) {
-            av_log(s, AV_LOG_TRACE, "NSV resync: [%d] = %02x\n", i, v & 0x0FF);
+            av_log(s, AV_LOG_TRACE, "NSV resync: [%d] = %02"PRIx32"\n", i, v & 0x0FF);
         }
 
         if ((v & 0x0000ffff) == 0xefbe) { /* BEEF */
@@ -543,7 +543,7 @@ null_chunk_retry:
     asize = avio_rl16(pb);
     vsize = (vsize << 4) | (auxcount >> 4);
     auxcount &= 0x0f;
-    av_log(s, AV_LOG_TRACE, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize);
+    av_log(s, AV_LOG_TRACE, "NSV CHUNK %d aux, %"PRIu32" bytes video, %d bytes audio\n", auxcount, vsize, asize);
     /* skip aux stuff */
     for (i = 0; i < auxcount; i++) {
         uint32_t av_unused auxtag;
diff --git a/libavformat/omaenc.c b/libavformat/omaenc.c
index d89cc37ee0..d2f8075fde 100644
--- a/libavformat/omaenc.c
+++ b/libavformat/omaenc.c
@@ -84,8 +84,8 @@ static av_cold int oma_write_header(AVFormatContext *s)
                          (par->block_align/8 - 1));
         break;
     default:
-        av_log(s, AV_LOG_ERROR, "unsupported codec tag %d for write\n",
-               par->codec_tag);
+        av_log(s, AV_LOG_ERROR, "unsupported codec tag %s for write\n",
+               av_4cc2str(par->codec_tag));
         return AVERROR(EINVAL);
     }
     for (i = 0; i < (EA3_HEADER_SIZE - 36)/4; i++)
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 56f2f63752..1a5ff76292 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -380,7 +380,8 @@ int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb,
         st->codecpar->codec_tag = avio_rl32(pb);
         st->codecpar->codec_id  = ff_codec_get_id(ff_rm_codec_tags,
                                                   st->codecpar->codec_tag);
-        av_log(s, AV_LOG_TRACE, "%X %X\n", st->codecpar->codec_tag, MKTAG('R', 'V', '2', '0'));
+        av_log(s, AV_LOG_TRACE, "%"PRIX32" %X\n",
+               st->codecpar->codec_tag, MKTAG('R', 'V', '2', '0'));
         if (st->codecpar->codec_id == AV_CODEC_ID_NONE)
             goto fail1;
         st->codecpar->width  = avio_rb16(pb);
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index a794d3b485..9f56009776 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -170,8 +170,8 @@ static int rpl_read_header(AVFormatContext *s)
             vst->codecpar->codec_id = AV_CODEC_ID_ESCAPE130;
             break;
         default:
-            avpriv_report_missing_feature(s, "Video format %i",
-                                          vst->codecpar->codec_tag);
+            avpriv_report_missing_feature(s, "Video format %s",
+                                          av_4cc2str(vst->codecpar->codec_tag));
             vst->codecpar->codec_id = AV_CODEC_ID_NONE;
     }
 
@@ -233,8 +233,8 @@ static int rpl_read_header(AVFormatContext *s)
     rpl->frames_per_chunk = read_line_and_int(pb, &error);  // video frames per chunk
     if (rpl->frames_per_chunk > 1 && vst->codecpar->codec_tag != 124)
         av_log(s, AV_LOG_WARNING,
-               "Don't know how to split frames for video format %i. "
-               "Video stream will be broken!\n", vst->codecpar->codec_tag);
+               "Don't know how to split frames for video format %s. "
+               "Video stream will be broken!\n", av_4cc2str(vst->codecpar->codec_tag));
 
     number_of_chunks = read_line_and_int(pb, &error);  // number of chunks in the file
     // The number in the header is actually the index of the last chunk.
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index eee17d07a6..af631a883a 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -285,7 +285,7 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time, int bye)
     RTPMuxContext *s = s1->priv_data;
     uint32_t rtp_ts;
 
-    av_log(s1, AV_LOG_TRACE, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp);
+    av_log(s1, AV_LOG_TRACE, "RTCP: %02x %"PRIx64" %"PRIx32"\n", s->payload_type, ntp_time, s->timestamp);
 
     s->last_rtcp_ntp_time = ntp_time;
     rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000},
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 067db63f21..56bd0c43f6 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -78,7 +78,7 @@ static int get_event_info(const char *line, struct event_info *ei)
     ei->pts = AV_NOPTS_VALUE;
     ei->pos = -1;
     if (sscanf(line, "%d:%d:%d%*1[,.]%d --> %d:%d:%d%*1[,.]%d"
-               "%*[ ]X1:%u X2:%u Y1:%u Y2:%u",
+               "%*[ ]X1:%"PRId32" X2:%"PRId32" Y1:%"PRId32" Y2:%"PRId32,
                &hh1, &mm1, &ss1, &ms1,
                &hh2, &mm2, &ss2, &ms2,
                &ei->x1, &ei->x2, &ei->y1, &ei->y2) >= 8) {
diff --git a/libavformat/uncodedframecrcenc.c b/libavformat/uncodedframecrcenc.c
index 5e1a445f4f..ecc42d2869 100644
--- a/libavformat/uncodedframecrcenc.c
+++ b/libavformat/uncodedframecrcenc.c
@@ -115,7 +115,7 @@ static void audio_frame_cksum(AVBPrint *bp, AVFrame *frame)
         default:
             av_assert0(!"reached");
         }
-        av_bprintf(bp, ", 0x%08x", cksum);
+        av_bprintf(bp, ", 0x%08"PRIx32, cksum);
     }
 }
 
diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index b1ff65c0d5..cccdd4959b 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -250,7 +250,8 @@ static int wsvqa_read_packet(AVFormatContext *s,
             case CMDS_TAG:
                 break;
             default:
-                av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type);
+                av_log(s, AV_LOG_INFO, "Skipping unknown chunk %s\n",
+                       av_4cc2str(av_bswap32(chunk_type)));
             }
             avio_skip(pb, chunk_size + skip_byte);
         }
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index 9235157a77..0fbb028f2a 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -87,8 +87,9 @@ static int xwma_read_header(AVFormatContext *s)
      */
     if (st->codecpar->codec_id != AV_CODEC_ID_WMAV2 &&
         st->codecpar->codec_id != AV_CODEC_ID_WMAPRO) {
-        avpriv_request_sample(s, "Unexpected codec (tag 0x%04x; id %d)",
-                              st->codecpar->codec_tag, st->codecpar->codec_id);
+        avpriv_request_sample(s, "Unexpected codec (tag %s; id %d)",
+                              av_4cc2str(st->codecpar->codec_tag),
+                              st->codecpar->codec_id);
     } else {
         /* In all xWMA files I have seen, there is no extradata. But the WMA
          * codecs require extradata, so we provide our own fake extradata.
diff --git a/libavutil/log.c b/libavutil/log.c
index 44c11cb091..be806202ff 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -168,19 +168,19 @@ static void colored_fputs(int level, int tint, const char *str)
 #else
     if (local_use_color == 1) {
         fprintf(stderr,
-                "\033[%d;3%dm%s\033[0m",
+                "\033[%"PRIu32";3%"PRIu32"m%s\033[0m",
                 (color[level] >> 4) & 15,
                 color[level] & 15,
                 str);
     } else if (tint && use_color == 256) {
         fprintf(stderr,
-                "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
+                "\033[48;5;%"PRIu32"m\033[38;5;%dm%s\033[0m",
                 (color[level] >> 16) & 0xff,
                 tint,
                 str);
     } else if (local_use_color == 256) {
         fprintf(stderr,
-                "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
+                "\033[48;5;%"PRIu32"m\033[38;5;%"PRIu32"m%s\033[0m",
                 (color[level] >> 16) & 0xff,
                 (color[level] >> 8) & 0xff,
                 str);
diff --git a/libavutil/timecode.c b/libavutil/timecode.c
index fa92df1ef9..c0c67c8478 100644
--- a/libavutil/timecode.c
+++ b/libavutil/timecode.c
@@ -129,7 +129,8 @@ char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_
 
 char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit)
 {
-    snprintf(buf, AV_TIMECODE_STR_SIZE, "%02u:%02u:%02u%c%02u",
+    snprintf(buf, AV_TIMECODE_STR_SIZE,
+             "%02"PRIu32":%02"PRIu32":%02"PRIu32"%c%02"PRIu32,
              tc25bit>>19 & 0x1f,              // 5-bit hours
              tc25bit>>13 & 0x3f,              // 6-bit minutes
              tc25bit>>6  & 0x3f,              // 6-bit seconds
diff --git a/libavutil/utils.c b/libavutil/utils.c
index ba557b9252..846d16f075 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -134,7 +134,8 @@ char *av_fourcc_make_string(char *buf, uint32_t fourcc)
 
     for (i = 0; i < 4; i++) {
         len = snprintf(buf, buf_size,
-                       TAG_PRINT(fourcc & 0xFF) ? "%c" : "[%d]", fourcc & 0xFF);
+                       TAG_PRINT(fourcc & 0xFF) ? "%c" : "[%d]",
+                       (int)(fourcc & 0xFF));
         buf       += len;
         buf_size   = buf_size > len ? buf_size - len : 0;
         fourcc   >>= 8;
