[FFmpeg-user] Trouble selecting a pixel format/colorspace while trying to encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces
Dennis Mungai
dmngaie at gmail.com
Fri Dec 9 21:36:01 EET 2022
On Fri, 9 Dec 2022 at 09:16, Chen, Wenbin <
wenbin.chen-at-intel.com at ffmpeg.org> wrote:
> > > Output of 'ffmpeg -h filter=vpp_qsv' is bellow
> > >
> > > ====
> > > Filter vpp_qsv
> > > Quick Sync Video VPP.
> > > Inputs:
> > > #0: default (video)
> > > Outputs:
> > > #0: default (video)
> > > vpp_qsv AVOptions:
> > > deinterlace <int> ..FV....... deinterlace mode: 0=off,
> 1=bob,
> > > 2=advanced (from 0 to 2) (default 0)
> > > bob 1 ..FV....... Bob deinterlace mode.
> > > advanced 2 ..FV....... Advanced deinterlace
> mode.
> > > denoise <int> ..FV....... denoise level [0, 100]
> (from 0
> > > to 100) (default 0)
> > > detail <int> ..FV....... enhancement level [0,
> 100] (from
> > > 0 to 100) (default 0)
> > > framerate <rational> ..FV....... output framerate (from 0
> to
> > > DBL_MAX) (default 0/1)
> > > procamp <int> ..FV....... Enable ProcAmp (from 0
> to 1)
> > > (default 0)
> > > hue <float> ..FV....... ProcAmp hue (from -180
> to 180)
> > > (default 0)
> > > saturation <float> ..FV....... ProcAmp saturation (from
> 0 to
> > > 10) (default 1)
> > > contrast <float> ..FV....... ProcAmp contrast (from 0
> to 10)
> > > (default 1)
> > > brightness <float> ..FV....... ProcAmp brightness (from
> -100 to
> > > 100) (default 0)
> > > transpose <int> ..FV....... set transpose direction
> (from -1
> > > to 6) (default -1)
> > > cclock_hflip 0 ..FV....... rotate counter-clockwise
> with
> > > horizontal flip
> > > clock 1 ..FV....... rotate clockwise
> > > cclock 2 ..FV....... rotate counter-clockwise
> > > clock_hflip 3 ..FV....... rotate clockwise with
> horizontal
> > > flip
> > > reversal 4 ..FV....... rotate by half-turn
> > > hflip 5 ..FV....... flip horizontally
> > > vflip 6 ..FV....... flip vertically
> > > cw <string> ..FV....... set the width crop area
> > > expression (default "iw")
> > > ch <string> ..FV....... set the height crop area
> > > expression (default "ih")
> > > cx <string> ..FV....... set the x crop area
> expression
> > > (default "(in_w-out_w)/2")
> > > cy <string> ..FV....... set the y crop area
> expression
> > > (default "(in_h-out_h)/2")
> > > w <string> ..FV....... Output video width
> (default
> > > "cw")
> > > width <string> ..FV....... Output video width
> (default
> > > "cw")
> > > h <string> ..FV....... Output video height
> (default
> > > "w*ch/cw")
> > > height <string> ..FV....... Output video height
> (default
> > > "w*ch/cw")
> > > format <string> ..FV....... Output pixel format
> (default
> > > "same")
> > > async_depth <int> ..FV....... Internal parallelization
> depth,
> > > the higher the value the higher the latency. (from 0 to INT_MAX)
> (default 0)
> > > scale_mode <int> ..FV....... scale mode: 0=auto,
> 1=low power,
> > > 2=high quality (from 0 to 2) (default 0)
> > > ====
> > >
> > > I tried the following command with vpp_qsv filter but pixel
> > format/colorspace
> > > of the output is the same:
> > >
> > > ====
> > > ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -v verbose -f
> x11grab
> > > -draw_mouse 0 -framerate 20 -probesize 42M -video_size 1920x1200
> > > -thread_queue_size 1000 -vcodec rawvideo -i ":0.0" -an -vf
> > > 'hwupload=extra_hw_frames=64,vpp_qsv=format=bgra' -c:v hevc_qsv -
> > preset
> > > veryslow -global_quality 17 -look_ahead 1 -y /tmp/output.mkv
> > > ====
> > >
> > > The ffprobe result for the above command is:
> > >
> > > ====
> > > Input #0, matroska,webm, from '/tmp/output.mkv':
> > > Metadata:
> > > ENCODER : Lavf59.27.100
> > > Duration: 00:00:04.85, start: 0.000000, bitrate: 50 kb/s
> > > Stream #0:0: Video: hevc (Main), yuvj420p(pc, gbr/unknown/unknown,
> > > progressive), 1920x1200 [SAR 1:1 DAR 8:5], 20 fps, 20 tbr, 1k tbn
> > > Metadata:
> > > ENCODER : Lavc59.37.100 hevc_qsv
> > > DURATION : 00:00:04.850000000
> > > ====
> > >
> > > On Thu, 8 Dec 2022 at 17:06, Dennis Mungai <dmngaie at gmail.com> wrote:
>
> In case of RGB input, VPL/MSDK uses 420 chroma format as default for the
> purpose of backward compatibility.
> I will send patch to enable 444 encoding for RGB input, then you can get
> the same output as libx265 SW.
>
> Thanks
> Wenbin
>
> > >
> > > > Hey there,
> > > >
> > > > I'd recommend using the vpp_qsv filter instead.
> > > >
> > > > Please provide the output of:
> > > >
> > > > ffmpeg -h filter=vpp_qsv
> > > >
> > > > And I'll generate a command line you can use to test and report back.
>
>
Perhaps we can try out libplacebo.
That vulkan-based filter should have support for the output format(s)
you're targeting. See https://ffmpeg.org/ffmpeg-filters.html#libplacebo
I'll need access to an Intel system running Windows to test that feature.
More information about the ffmpeg-user
mailing list