Message ID | 20201022015239.1675600-1-haihao.xiang@intel.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] ffmpeg_qsv: respect hwaccel_output_format setting | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On 22/10/2020 02:52, Haihao Xiang wrote: > Without this change, the output pixel format from qsv decoder is always > 'qsv' ... No it isn't. > ffmpeg -loglevel verbose -hwaccel qsv -c:v h264_qsv > -hwaccel_output_format yuv420p -i input.h264 > -pix_fmt rgb24 -f null - The legacy decoders still use the -hwaccel option to indicate a desire for hardware-surface output, so don't set that. (Updating them to use the hw_device_ctx API like everything else would be more useful than adding workarounds in the generic code.) - Mark
> On 22/10/2020 02:52, Haihao Xiang wrote: > > Without this change, the output pixel format from qsv decoder is always > > 'qsv' ... > > No it isn't. My thought was for '-hwaccel qsv' part. > > > ffmpeg -loglevel verbose -hwaccel qsv -c:v h264_qsv > > -hwaccel_output_format yuv420p -i input.h264 > > -pix_fmt rgb24 -f null - > > The legacy decoders still use the -hwaccel option to indicate a desire for > hardware-surface output, so don't set that. > > (Updating them to use the hw_device_ctx API like everything else would be more > useful than adding workarounds in the generic code.) Did you mean to take hwaccel_qsv as a generic hwaccel method and make hw_device_setup_for_decode() works for qsv too? Thanks Haihao > > - Mark > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 19f719e3ff..6835affa3c 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -884,6 +884,12 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) "with old commandlines. This behaviour is DEPRECATED and will be removed " "in the future. Please explicitly set \"-hwaccel_output_format cuda\".\n"); ist->hwaccel_output_format = AV_PIX_FMT_CUDA; + } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "qsv")) { + av_log(NULL, AV_LOG_WARNING, + "WARNING: defaulting hwaccel_output_format to qsv for compatibility " + "with old commandlines. This behaviour is DEPRECATED and will be removed " + "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n"); + ist->hwaccel_output_format = AV_PIX_FMT_QSV; } else if (hwaccel_output_format) { ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format); if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) { diff --git a/fftools/ffmpeg_qsv.c b/fftools/ffmpeg_qsv.c index 960c88b69d..7f01370ada 100644 --- a/fftools/ffmpeg_qsv.c +++ b/fftools/ffmpeg_qsv.c @@ -82,6 +82,8 @@ int qsv_init(AVCodecContext *s) return ret; } + hwaccel_decode_init(s); + av_buffer_unref(&ist->hw_frames_ctx); ist->hw_frames_ctx = av_hwframe_ctx_alloc(hw_device_ctx); if (!ist->hw_frames_ctx)