MediaSDK icon indicating copy to clipboard operation
MediaSDK copied to clipboard

ffmpeg QSV internal resolution and colorspace problems

Open thx4ever opened this issue 5 years ago • 6 comments

Hi, i tryed many times encode with Intel QSV in ffmpeg, this vídeo resolutions 1920x1080 > 1920x1088, 1440x1080 > 1440x1088 those are fine for my HDTV no erros, but when i tryed 1280x720 ffmpeg come with internal resolution 1280x736, when i try to play the vídeo on my TV it show a green bar because ffmpeg internal resolution not 1280x720 coded internal size but 1280x736, here are my encoding options

ffmpeg -v verboe -hide_banner -hwaccel qsv -c:v h264_qsv -i Source.264 -c:v hevc_qsv -load_plugin hevc_sw -profile:v main -preset:v veryslow -g 240 -refs:v 6 -bf:v 3 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -bsf:v hevc_metadata=colour_primaries=1:transfer_characteristics=1:matrix_coefficients=1 -gpb 0 -vf "scale_qsv=1280:720" Destination.hevc

Another problem im facing are colorspace converter from any 8bit to 10bit P010le, those are working fime on sample_multi_transcode

ffmpeg -v verbose -hide_banner -c:v h264_qsv -i Source.264 -c:v hevc_qsv -pix_fmt p010le -load_plugin hevc_sw -profile:v main10 -preset:v veryslow -g 240 -refs:v 6 -bf:v 3 -gpb 0 Destination.hevc

Can someone here send this bug to ffmpeg developers? I tryed already but they dont care Simple ffmpeg dont set internal resolution correctly like sample_multi_transcode or sample_encode and the colorspace converter dont work at all from any 8bit to 10bit P010le

Regards

thx4ever

thx4ever avatar Jul 27 '19 21:07 thx4ever

Can someone here send this bug to ffmpeg developers? I tryed already but they dont care

How you ping ffmpeg developers, please share me the link.

ffmpeg internal resolution not 1280x720 coded internal size but 1280x736, here are my encoding options

Please try to apply this patch and report me it help or not.

diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index 499534e..3cc05b6 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -201,8 +201,8 @@ static int init_out_pool(AVFilterContext *ctx,
     out_frames_hwctx = out_frames_ctx->hwctx;

     out_frames_ctx->format            = AV_PIX_FMT_QSV;
-    out_frames_ctx->width             = FFALIGN(out_width,  32);
-    out_frames_ctx->height            = FFALIGN(out_height, 32);
+    out_frames_ctx->width             = FFALIGN(out_width,  16);
+    out_frames_ctx->height            = FFALIGN(out_height, 16);
     out_frames_ctx->sw_format         = out_format;
     out_frames_ctx->initial_pool_size = 4;

lizhong1008 avatar Jul 29 '19 15:07 lizhong1008

@thx4ever , could you answer?

dmitryermilov avatar Aug 08 '19 16:08 dmitryermilov

Sorry for late response, i tryed with this patch and it works, only problem now that vpp_qsv dont convert colorspace from 8 bit to 10bit p010le

thx4ever avatar Aug 09 '19 19:08 thx4ever

@thx4ever is it still actual?

daleksan avatar Feb 12 '20 14:02 daleksan

For me this patch does not solve problem.

I try to scale from 4K to FullHD: -hwaccel qsv -c:v vp9_qsv -i INPUT -vf scale_qsv=1920:1080 -c:v h264_qsv -b:v 6000k -profile:v high OUTPUT

I solve green bar problem when did not use hw qsv decoder: -init_hw_device qsv=hw -filter_hw_device hw -i INPUT -vf hwupload=extra_hw_frames=64,format=qsv,scale_qsv=1920:1080 -c:v h264_qsv -b:v 6000k -profile:v high OUTPUT

amnonbb avatar Aug 26 '20 12:08 amnonbb

What happen again this patch already applied to ffmpeg but the problem continues, if i add those commands to ffmpeg -vf scale=1280:720 or -vf scale_qsv=1280:720 final video are coded 1280x736, can someone take a look on this problem? framecoded The final video on my tv show a green horizontal bar

thx4ever avatar Aug 21 '21 03:08 thx4ever