Green artifacts for transcoded videos when using intel arc a380 vaapi

I get green artifacts in the transcoded videos when using hardware encoding on my intel a 380 gpu. A horizontal green line is shown and colors are way off with ghostly artifacts.

(I will self answer this as i searched hours to fix it and want to have the result posted here for others)
Was this page helpful?