Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: VA_RC_ICQ not available in AV1 encoder on DG2 #1597

Closed
nyanmisaka opened this issue Jan 14, 2023 · 56 comments
Closed

[Bug]: VA_RC_ICQ not available in AV1 encoder on DG2 #1597

nyanmisaka opened this issue Jan 14, 2023 · 56 comments
Assignees
Labels
AV1 AV1 Encode video encode related In Progress PR: still under discussion P2 Medium priority

Comments

@nyanmisaka
Copy link
Contributor

nyanmisaka commented Jan 14, 2023

Which component impacted?

Encode

Is it regression? Good in old configuration?

No, this issue exist a long time

What happened?

  1. Linux, FFmpeg
  2. libva 2.16, media-driver 22.6.4 or master
  3. Run ffmpeg -f lavfi -i "testsrc2=s=1920x1080,format=nv12" -c:v av1_qsv -global_quality 25 -g:v 120 -f null -
  4. Error:
[av1_qsv @ 0x55f3edf29ec0] Initialized an internal MFX session using hardware accelerated implementation
[av1_qsv @ 0x55f3edf29ec0] Using the intelligent constant quality (ICQ) ratecontrol method
[av1_qsv @ 0x55f3edf29ec0] Selected ratecontrol mode is unsupported
[av1_qsv @ 0x55f3edf29ec0] Low power mode is unsupported
[av1_qsv @ 0x55f3edf29ec0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

What's the usage scenario when you are seeing the problem?

Transcode for media delivery

What impacted?

ICQ rate control is not available in AV1 encoder on DG2 on Linux.

Cannot use the -global_quality option in FFmpeg.

Debug Information

I tried ICQ rate control with AV1 on Windows and it works just fine with FFmpeg.

Do you want to contribute a patch to fix the issue?

None

@nyanmisaka
Copy link
Contributor Author

@Jexu Jexu added Encode video encode related HEVC HEVC AV1 AV1 labels Jan 17, 2023
@intel-mediadev
Copy link
Contributor

Auto Created VSMGWL-60768 for further analysis.

@channeladam
Copy link

Is there any way we can see or be informed of the status/progress of VSMGWL-60768 ?

@vid-bin
Copy link

vid-bin commented Mar 5, 2023

Is there any update to this?

@channeladam
Copy link

Hi, can someone please provide an update on this issue? Is there a fix in the works? Will it be addressed? Is there an expected timeline? Anything?

@nyanmisaka
Copy link
Contributor Author

@channeladam It seems Intel haven't figure out the AV1 ICQ support on DG2 platforms, including the next gen MTL, which is being actively developed in their new code path "media_softlet".

HEVC ICQ on DG2 might just be a capability reporting bug (if DG2 and Gen12 share the same code path), while AV1 ICQ doesn't seem to be implemented yet as I can't find it anywhere.

@Jexu may be able to provide more progress on this.

@channeladam
Copy link

Thank you @nyanmisaka, I appreciate your response and you creating this issue.

I bought my Intel Arc A770 reasonably expecting/assuming HEVC & AV1 ICQ to be working since H264 ICQ does... I guess I was either foolish or misled.

It would be nice to hear from someone at Intel to understand if AV1 ICQ will happen & when, or not...
@Jexu @thomasli21801 @XinfengZhang

Thank you in advance.

@vid-bin
Copy link

vid-bin commented Mar 21, 2023

@channeladam I also bought the A380 for VP9/AV1 video encoding (VP9 appears to have the same issue BTW). It would be great to get some kind of communication on this issue.

@nyanmisaka
Copy link
Contributor Author

@channeladam I also bought the A380 for VP9/AV1 video encoding (VP9 appears to have the same issue BTW). It would be great to get some kind of communication on this issue.

The RC modes of VP9 are correct even though I don't use it.

VAProfileVP9Profile2/VAEntrypointEncSliceLP
    VAConfigAttribRTFormat                 : VA_RT_FORMAT_YUV420
                                             VA_RT_FORMAT_YUV444
                                             VA_RT_FORMAT_YUV420_10
                                             VA_RT_FORMAT_YUV444_10
                                             VA_RT_FORMAT_RGB32
                                             VA_RT_FORMAT_RGB32_10
                                             VA_RT_FORMAT_RGB32_10BPP
                                             VA_RT_FORMAT_YUV420_10BPP
    VAConfigAttribRateControl              : VA_RC_CBR
                                             VA_RC_VBR
                                             VA_RC_CQP
                                             VA_RC_ICQ
                                             VA_RC_MB

@nyanmisaka
Copy link
Contributor Author

nyanmisaka commented Mar 21, 2023

#1630 ONLY fixes the HEVC ICQ.
AV1 ICQ needs extra handling from Intel. So don't close this issue.

@vid-bin
Copy link

vid-bin commented Mar 21, 2023

The RC modes of VP9 are correct even though I don't use it.

Yet it doesn't work for me. Maybe it's user error or one of my packages it outdated, idk.

When you try running it yourself does it work?

@nyanmisaka
Copy link
Contributor Author

When you try running it yourself does it work?

What ffmpeg command did you use?

@vid-bin
Copy link

vid-bin commented Mar 24, 2023

What ffmpeg command did you use?

Just a basic ffmpeg command. Basically the same as in OP only with vp9_qsv. I also tried running -crf and -qp.

I then tried to use vp9_qsv with peertube in VBR. av1_qsv works fine in VBR. The 30 minute VP9 output works for 2-3 minutes and then seeking stops working and the video corrupts.

There were no errors listed during transcoding.

@nyanmisaka
Copy link
Contributor Author

nyanmisaka commented Mar 24, 2023

Confirmed the VP9 ICQ is also broken (device failed -17) on DG2 even if the driver reports VA_RC_ICQ.

@nyanmisaka nyanmisaka changed the title [Bug]: VA_RC_ICQ not available in AV1 and HEVC encoders on DG2 [Bug]: VA_RC_ICQ not available in AV1/HEVC/VP9 encoders on DG2 Mar 24, 2023
@janbrueggenjuergen
Copy link

Can also confirm ICQ broken for AV1.

@OttoYang OttoYang removed the HEVC HEVC label Jul 18, 2023
@leyu-yao leyu-yao added In Progress PR: still under discussion P1 Highest priority labels Jul 21, 2023
@vid-bin
Copy link

vid-bin commented Jul 24, 2023

I see this is now in progress. Is this just for AV1 or will VP9 also receive ICQ support?

(I really just care about AV1 though)

@BlakeB415
Copy link

Hey, I noticed this had been placed in progress on July 20th. It's currently August 17th. Do you have any progress updates you can share?

Thank you.

@leyu-yao
Copy link
Contributor

We are now working on final quality tuning. The patch will be online soon.

@leyu-yao leyu-yao added P2 Medium priority and removed P1 Highest priority labels Sep 8, 2023
@vid-bin
Copy link

vid-bin commented Sep 9, 2023

I noticed it was downgraded to priority 2. Does this mean it's ready for release?

@nyanmisaka
Copy link
Contributor Author

9ffcdf4

@leyu-yao
Copy link
Contributor

Thanks all of you.
We have upstream ICQ implementations in media-driver and oneVPL-intel-gpu
Media-driver commit 9ffcdf4
oneVPL commit intel/vpl-gpu-rt@4157fdb

I'm closing this issue now. Please feel free to re-open for any other concerns or issues.

@vid-bin
Copy link

vid-bin commented Sep 15, 2023

It appears to work from initial testing.

ffmpeg does throw this error with a simple command:

[av1_qsv @ 0x55dc9d895880] Warning in encoder initialization: incompatible video parameters (5)

ffmpeg -i "test.webm" -c:v av1_qsv -global_quality 20 -pix_fmt p010le -c:a libfdk_aac -profile 1 "output.mp4"

@xhaihao
Copy link
Contributor

xhaihao commented Sep 15, 2023

It appears to work from initial testing.

ffmpeg does throw this error with a simple command:

[av1_qsv @ 0x55dc9d895880] Warning in encoder initialization: incompatible video parameters (5)

av1_qsv works for me without this warning.

ffmpeg -i "test.webm" -c:v av1_qsv -global_quality 20 -pix_fmt p010le -c:a libfdk_aac -profile 1 "output.mp4"

@leyu-yao
Copy link
Contributor

Hi @vid-bin
This warning looks like not related to ICQ itself. I'm suspecting it as a tile setting issue. It is very likely that this is a VPL issue.

@BlakeB415
Copy link

BlakeB415 commented Sep 15, 2023

Hi, QVBR doesn't seem to be working with this.
ffmpeg -i input.mp4 -c:v av1_qsv -global_quality:v 25 -b:v 1000k -maxrate:v 1001k output.mp4
results in

[av1_qsv @ 0x561f1699f4c0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/av1_qsv @ 0x559966baf140] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height

@vid-bin
Copy link

vid-bin commented Sep 15, 2023

@BlakeB415

Doesn't seem to be implemented yet.

[av1_qsv @ 0x55f1cd368900] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/av1_qsv @ 0x55f1cd0a9980] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Function not implemented

@BlakeB415
Copy link

BlakeB415 commented Sep 15, 2023

@BlakeB415

Doesn't seem to be implemented yet.

[av1_qsv @ 0x55f1cd368900] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/av1_qsv @ 0x55f1cd0a9980] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Function not implemented

I see. Well, this works with h264_qsv on Linux so I was hoping this would add support for av1_qsv for it as well.

EDIT: There seems to be references to QVBR within the media-driver code for AV1 so maybe this is an issue upstream?

@leyu-yao
Copy link
Contributor

Hi @BlakeB415
Unlike avc, av1 does not supported QVBR, at least for now.
There is something common in ICQ and QVBR, so it is expected that some ICQ code may "look like" QVBR. I don't think this is an issue.

@Feierkuula
Copy link

I tested it, it works perfectly.

@Enverex
Copy link

Enverex commented Sep 25, 2023

Does this not include the LookAhead functionality? (i.e. icq_la).

@leyu-yao
Copy link
Contributor

I tested it, it works perfectly.

Nice to hear that!

@leyu-yao
Copy link
Contributor

Does this not include the LookAhead functionality? (i.e. icq_la).

Currently, we didn't include LookAhead functionality.

@channeladam
Copy link

@leyu-yao you will already know what this next question will be... :)

Is Look Ahead going to be implemented, and if so, what is the timeline?

I'm sure almost everyone here would agree that the genesis of this issue was for targeting the purpose of storage/archival, and LA_ICQ is the recommendation by Intel for that...

thank you.

@nyanmisaka
Copy link
Contributor Author

https://github.com/intel/media-delivery/blob/master/doc/quality.rst#enctools-and-extbrc
According to this article, LA on DG2+ is a software function implemented by EncTools in VPL runtime.

https://github.com/oneapi-src/oneVPL-intel-gpu
Maybe consider opening a feature request over there?

@SoTHISIsFitness
Copy link

so... last comment here was september last year... any update?

@leyu-yao
Copy link
Contributor

During the last few months, we did have some discussion on av1 LA_ICQ, but till now we haven't decided to implement it... For torage/archival usage, currently we recommend ICQ or VBR. I will update here if we got any implementation plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AV1 AV1 Encode video encode related In Progress PR: still under discussion P2 Medium priority
Projects
None yet
Development

No branches or pull requests