From: bugzilla-daemon@freedesktop.org Subject: [Bug 104920] Broken hardware video encoding with vaapi/ffmpeg Date: Sat, 03 Feb 2018 00:23:52 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0312501404==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id A38C06F15D for ; Sat, 3 Feb 2018 00:23:52 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0312501404== Content-Type: multipart/alternative; boundary="15176174320.aC9dC4CB.15941" Content-Transfer-Encoding: 7bit --15176174320.aC9dC4CB.15941 Date: Sat, 3 Feb 2018 00:23:52 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D104920 --- Comment #1 from Andy Furniss --- You need -profile:v 578. x11grab on my old CPU at least is not the best way to go. ffmpeg is slow doing the BGR0 -> nv12 conversion, and by default it will be= 601 rather than 709. There are ways around that, and to be a bit faster with some convoluted commands. I don't know what versions of everything you need, but you can "now" get the GPU to do the conversion and zero copy input, which is way faster and does = BGR0 -> rec 709 CSC. The downside is you need to be root or suid the ffmpeg binary. 1920x1080 is also slightly problematic but using mp4 or mkv will hide it (I guess depending on player). mkv seems to be broken with current ffmpeg git, bah. The issue being that eg. .ts would be seen as 1088 rather than 1080. To get GPU accel using the newer/faster way would be something like - ffmpeg -framerate 60 -device /dev/dri/card0 -f kmsgrab -i - -vsync 0 -init_hw_device vaapi=3Dv:/dev/dri/renderD128 -filter_hw_device v -vf 'hwmap,scale_vaapi=3Dformat=3Dnv12' -c:v h264_vaapi -profile:v 578 -bf 0 ou= t.mp4 --=20 You are receiving this mail because: You are the assignee for the bug.= --15176174320.aC9dC4CB.15941 Date: Sat, 3 Feb 2018 00:23:52 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Commen= t # 1 on bug 10492= 0 from Andy Furniss
You need -profile:v 578.

x11grab on my old CPU at least is not the best way to go.
ffmpeg is slow doing the BGR0 -> nv12 conversion, and by default it will=
 be 601
rather than 709.
There are ways around that, and to be a bit faster with some convoluted
commands.

I don't know what versions of everything you need, but you can "now&qu=
ot; get the
GPU to do the conversion and zero copy input, which is way faster and does =
BGR0
-> rec 709 CSC.

The downside is you need to be root or suid the ffmpeg binary.

1920x1080 is also slightly problematic but using mp4 or mkv will hide it (I
guess depending on player). mkv seems to be broken with current ffmpeg git,
bah. The issue being that eg. .ts would be seen as 1088 rather than 1080.

To get GPU accel using the newer/faster way would be something like -

ffmpeg -framerate 60 -device /dev/dri/card0 -f kmsgrab -i - -vsync 0
-init_hw_device vaapi=3Dv:/dev/dri/renderD128 -filter_hw_device v -vf
'hwmap,scale_vaapi=3Dformat=3Dnv12' -c:v h264_vaapi -profile:v 578 -bf 0 ou=
t.mp4


You are receiving this mail because:
  • You are the assignee for the bug.
= --15176174320.aC9dC4CB.15941-- --===============0312501404== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0312501404==--