From ef52ac608e069f76af5e56de585833e8efa93168 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 16 Apr 2023 01:49:51 +0200 Subject: [PATCH] Add a warning when trying to hardware-decode H.264 Baseline streams. --- nageru/ffmpeg_capture.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nageru/ffmpeg_capture.cpp b/nageru/ffmpeg_capture.cpp index 863f4fb..e099d18 100644 --- a/nageru/ffmpeg_capture.cpp +++ b/nageru/ffmpeg_capture.cpp @@ -479,6 +479,11 @@ AVPixelFormat get_hw_format(AVCodecContext *ctx, const AVPixelFormat *fmt) if (config->pix_fmt == *fmt_ptr) { fprintf(stderr, "Initialized '%s' hardware decoding for codec '%s'.\n", av_hwdevice_get_type_name(type), ctx->codec->name); + if (ctx->profile == FF_PROFILE_H264_BASELINE) { + fprintf(stderr, "WARNING: Stream claims to be H.264 Baseline, which is generally poorly supported in hardware decoders.\n"); + fprintf(stderr, " Consider encoding it as Constrained Baseline, Main or High instead.\n"); + fprintf(stderr, " Decoding might fail and fall back to software.\n"); + } return config->pix_fmt; } } -- 2.39.2