Re: [FFmpeg-user] Trouble selecting a pixel format/colorspace while trying to encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces

2022-12-08 Thread Chen, Wenbin
> > 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   ..FV... deinterlace mode: 0=off, 
> > 1=bob,
> > 2=advanced (from 0 to 2) (default 0)
> >  bob 1..FV... Bob deinterlace mode.
> >  advanced2..FV... Advanced deinterlace mode.
> >denoise   ..FV... denoise level [0, 100] (from 0
> > to 100) (default 0)
> >detail..FV... enhancement level [0, 100] 
> > (from
> > 0 to 100) (default 0)
> >framerate..FV... output framerate (from 0 to
> > DBL_MAX) (default 0/1)
> >procamp   ..FV... Enable ProcAmp (from 0 to 1)
> > (default 0)
> >hue ..FV... ProcAmp hue (from -180 to 180)
> > (default 0)
> >saturation  ..FV... ProcAmp saturation (from 0 to
> > 10) (default 1)
> >contrast..FV... ProcAmp contrast (from 0 to 
> > 10)
> > (default 1)
> >brightness  ..FV... ProcAmp brightness (from -100 
> > to
> > 100) (default 0)
> >transpose ..FV... set transpose direction (from 
> > -1
> > to 6) (default -1)
> >  cclock_hflip0..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
> >  reversal4..FV... rotate by half-turn
> >  hflip   5..FV... flip horizontally
> >  vflip   6..FV... flip vertically
> >cw ..FV... set the width crop area
> > expression (default "iw")
> >ch ..FV... set the height crop area
> > expression (default "ih")
> >cx ..FV... set the x crop area expression
> > (default "(in_w-out_w)/2")
> >cy ..FV... set the y crop area expression
> > (default "(in_h-out_h)/2")
> >w  ..FV... Output video width (default
> > "cw")
> >width  ..FV... Output video width (default
> > "cw")
> >h  ..FV... Output video height (default
> > "w*ch/cw")
> >height ..FV... Output video height (default
> > "w*ch/cw")
> >format ..FV... Output pixel format (default
> > "same")
> >async_depth   ..FV... Internal parallelization 
> > depth,
> > the higher the value the higher the latency. (from 0 to INT_MAX) (default 0)
> >scale_mode..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.00, 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.85000
> > 
> >
> > On Thu, 8 Dec 2022 at 17:06, Dennis Mungai  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.
> > ___
> > ffmpeg-user mailing list
> > ffmpeg-user@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To 

Re: [FFmpeg-user] MPEG OPTION CONFIGURATION

2022-12-08 Thread Cédric Cochennec
Hey Guys

Maybe nobody have a clue or it is a too old subject, but any help would be
appreciated.
Any reading, blog, documentation, I searched all google (or near).

I tried this (changing all setting but bufsize and removing -f vcd). Seems
better, no underflow problems.
But having a warning which I can't understand and get read of.

[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255 speed=3.19x
Last message repeated 3 times
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.23x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.26x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.24x
Last message repeated 1 times
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.26x
Last message repeated 2 times
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.27x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.21x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255 speed=3.21x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.22x
Last message repeated 1 times
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255 speed=3.17x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.22x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.19x
Last message repeated 4 times
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed=3.27x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed= 3.2x
[mpeg1video @ 01d4dd794940] warning, clipping 1 dct coefficients to
-255..255speed= 3.2x
frame=28625 fps= 78 q=2.5 Lsize=  320570kB time=00:19:04.98
bitrate=2293.6kbits/s speed=3.14x


Can anybody help me on this ?

here the full output os the shell:

ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the
FFmpeg developers
  built with gcc 11.2.0 (Rev5, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static
--disable-w32threads --disable-autodetect --enable-fontconfig
--enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib
--enable-lzma --enable-libsnappy --enable-zlib --enable-librist
--enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth
--enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d
--enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e
--enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg
--enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r
--enable-libfreetype --enable-libfribidi --enable-libvidstab
--enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm
--enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc
--enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc
--enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio
--enable-libgme --enable-libmodplug --enable-libopenmpt
--enable-libopencore-amrwb --enable-libmp3lame --enable-libshine
--enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc
--enable-libilbc --enable-libgsm --enable-libopencore-amrnb
--enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa
--enable-libbs2b --enable-libflite --enable-libmysofa
--enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil  57. 17.100 / 57. 17.100
  libavcodec 59. 18.100 / 59. 18.100
  libavformat59. 16.100 / 59. 16.100
  libavdevice59.  4.100 / 59.  4.100
  libavfilter 8. 24.100 /  8. 24.100
  libswscale  6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc56.  3.100 / 56.  3.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'T:\TEMP\0079\test_file.mp4':
  Metadata:
major_brand : mp42
minor_version   : 0
compatible_brands: mp42isom
creation_time   : 2022-11-02T15:43:01.00Z
  Duration: 00:42:11.04, start: 0.00, bitrate: 6114 kb/s
  Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 4570 kb/s,
25 fps, 25 tbr, 24k tbn (default)
Metadata:
  creation_time   : 2022-11-02T15:43:01.00Z
  vendor_id   : TELE
  encoder : AVC
  Stream #0:1[0x2](eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz,
stereo, s16, 1536 kb/s (default)
Metadata:
  creation_time   : 2022-11-02T15:43:01.00Z
  vendor_id   : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> mp2 (native))
Press [q] to stop, [?] for help
Output #0, 

Re: [FFmpeg-user] Trouble selecting a pixel format/colorspace while trying to encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces

2022-12-08 Thread caetano
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   ..FV... deinterlace mode: 0=off, 1=bob, 
2=advanced (from 0 to 2) (default 0)
 bob 1..FV... Bob deinterlace mode.
 advanced2..FV... Advanced deinterlace mode. 
   denoise   ..FV... denoise level [0, 100] (from 0 to 
100) (default 0)
   detail..FV... enhancement level [0, 100] (from 
0 to 100) (default 0)
   framerate..FV... output framerate (from 0 to 
DBL_MAX) (default 0/1)
   procamp   ..FV... Enable ProcAmp (from 0 to 1) 
(default 0)
   hue ..FV... ProcAmp hue (from -180 to 180) 
(default 0)
   saturation  ..FV... ProcAmp saturation (from 0 to 10) 
(default 1)
   contrast..FV... ProcAmp contrast (from 0 to 10) 
(default 1)
   brightness  ..FV... ProcAmp brightness (from -100 to 
100) (default 0)
   transpose ..FV... set transpose direction (from -1 
to 6) (default -1)
 cclock_hflip0..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
 reversal4..FV... rotate by half-turn
 hflip   5..FV... flip horizontally
 vflip   6..FV... flip vertically
   cw ..FV... set the width crop area 
expression (default "iw")
   ch ..FV... set the height crop area 
expression (default "ih")
   cx ..FV... set the x crop area expression 
(default "(in_w-out_w)/2")
   cy ..FV... set the y crop area expression 
(default "(in_h-out_h)/2")
   w  ..FV... Output video width (default "cw")
   width  ..FV... Output video width (default "cw")
   h  ..FV... Output video height (default 
"w*ch/cw")
   height ..FV... Output video height (default 
"w*ch/cw")
   format ..FV... Output pixel format (default 
"same")
   async_depth   ..FV... Internal parallelization depth, 
the higher the value the higher the latency. (from 0 to INT_MAX) (default 0)
   scale_mode..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.00, 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.85000


On Thu, 8 Dec 2022 at 17:06, Dennis Mungai  wrote:

> 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.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Trouble selecting a pixel format/colorspace while trying to encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces

2022-12-08 Thread Dennis Mungai
On Thu, 8 Dec 2022 at 22:32,  wrote:

> I'm having trouble selecting a pixel format/colorspace while trying to
> encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces. I
> have an i7-1165G7 with integrated graphics and I'm using ffmpeg 5.1.1 with
> ubuntu
>
> I'm able to select the pixel format/colorspace with the SW encoder, for
> instance, if I use the following command:
>
> 
> ffmpeg -f x11grab -draw_mouse 0 -framerate 20 -probesize 42M -video_size
> 1920x1200 -thread_queue_size 1000 -vcodec rawvideo -i ":0.0" -an -c:v hevc
> -preset veryslow -global_quality 17 -look_ahead 1 -y /tmp/output.mkv
> 
>
> I get the correct pixel format and with ffprobe I have the following:
>
> 
> Input #0, matroska,webm, from '/tmp/output.mkv':
>   Metadata:
> ENCODER : Lavf59.27.100
>   Duration: 00:00:02.90, start: 0.00, bitrate: 92 kb/s
>   Stream #0:0: Video: hevc (Rext), gbrp(pc, gbr/unknown/unknown,
> progressive), 1920x1200, 20 fps, 20 tbr, 1k tbn
> Metadata:
>   ENCODER : Lavc59.37.100 libx265
>   DURATION: 00:00:02.9
> 
>
> The video from the above example is correctly encoded and colors are
> exactly what I need them to be.
>
> On the other hand, when I try to use the HW encoder, the pixel format is
> wrong. For instance:
>
> 
> 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,scale_qsv=format=bgra' -c:v hevc_qsv -preset
> veryslow -global_quality 17 -look_ahead 1 -y /tmp/output.mkv
> 
>
> ffprobe generates:
>
> 
> Input #0, matroska,webm, from '/tmp/output.mkv':
>   Metadata:
> ENCODER : Lavf59.27.100
>   Duration: 00:00:04.40, start: 0.00, bitrate: 55 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.4
> 
>
> As you can see, in the first example, libx265 SW encoder based, the output
> is generated with the "gbrp" colorspace while in the second example,
> hevc_qsv HW encoder based, the output is generated with the "yuvj420p"
> pixel format.
>
> QUESTION: How can I properly control the pixel format/colorspace of the
> generated output using the HW based encoders such as QSV or VAAPI with
> my i7-1165G7 integrated graphics card ? I would like a format that is 24 or
> 32bits instead of the 12bits I'm getting
>
>
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.
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-user] Trouble selecting a pixel format/colorspace while trying to encode a video using ffmpeg and HW accelerated vaapi or qsv interfaces

2022-12-08 Thread caetano
I'm having trouble selecting a pixel format/colorspace while trying to encode a 
video using ffmpeg and HW accelerated vaapi or qsv interfaces. I have an 
i7-1165G7 with integrated graphics and I'm using ffmpeg 5.1.1 with ubuntu

I'm able to select the pixel format/colorspace with the SW encoder, for 
instance, if I use the following command:


ffmpeg -f x11grab -draw_mouse 0 -framerate 20 -probesize 42M -video_size 
1920x1200 -thread_queue_size 1000 -vcodec rawvideo -i ":0.0" -an -c:v hevc 
-preset veryslow -global_quality 17 -look_ahead 1 -y /tmp/output.mkv


I get the correct pixel format and with ffprobe I have the following:


Input #0, matroska,webm, from '/tmp/output.mkv':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 00:00:02.90, start: 0.00, bitrate: 92 kb/s
  Stream #0:0: Video: hevc (Rext), gbrp(pc, gbr/unknown/unknown, progressive), 
1920x1200, 20 fps, 20 tbr, 1k tbn
    Metadata:
      ENCODER         : Lavc59.37.100 libx265
      DURATION        : 00:00:02.9


The video from the above example is correctly encoded and colors are exactly 
what I need them to be.

On the other hand, when I try to use the HW encoder, the pixel format is wrong. 
For instance:


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,scale_qsv=format=bgra' -c:v hevc_qsv -preset 
veryslow -global_quality 17 -look_ahead 1 -y /tmp/output.mkv


ffprobe generates:


Input #0, matroska,webm, from '/tmp/output.mkv':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 00:00:04.40, start: 0.00, bitrate: 55 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.4


As you can see, in the first example, libx265 SW encoder based, the output is 
generated with the "gbrp" colorspace while in the second example, hevc_qsv HW 
encoder based, the output is generated with the "yuvj420p" pixel format.

QUESTION: How can I properly control the pixel format/colorspace of the 
generated output using the HW based encoders such as QSV or VAAPI with my 
i7-1165G7 integrated graphics card ? I would like a format that is 24 or 32bits 
instead of the 12bits I'm getting
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".