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.000000, 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.900000000
====

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.000000, 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.400000000
====

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
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to