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

Add VAAPI hardware acceleraction encoder #1

Closed
AngryPenguinPL opened this issue May 7, 2017 · 10 comments
Closed

Add VAAPI hardware acceleraction encoder #1

AngryPenguinPL opened this issue May 7, 2017 · 10 comments

Comments

@AngryPenguinPL
Copy link

Hi.

FFMPEG from 3.1+ series support VAAPI HW encoding for Intel and AMD (closed and open drivers). So If we use old build FFMPEG like in Ubuntu 16.X we need manually compiling FFMPEG with flag vaapi but for new build FMMPEG this is enabled in default (for e.g in Ubuntu 17.04).
So we can record in FFMPEG with VAAPI hardware accelerated encoder like on nvidia with nvenc!
Basic Linux screen recorders can use it but they need only create new profiles to use vaapi hw encoder in h264 like in this request: MaartenBaert/ssr#466 or this https://obsproject.com/forum/threads/experimental-ffmpeg-vaapi-plugin.61529/

Also you can learn more about vaapi hw encode here: https://gist.github.com/Brainiarc7/4b49f463a08377530df6cecb8171306a
and here: https://gist.github.com/Brainiarc7/95c9338a737aa36d9bb2931bed379219

and few more directly in Brainiarc7 github page: https://gist.github.com/Brainiarc7

Can you add this VAAPI hw encoding for screencast?

@dbermond
Copy link
Owner

dbermond commented May 7, 2017

Hi, thank you for the interest in screencast.

I'll take a look at it as soon as I can.

@dbermond
Copy link
Owner

Do you have the a proper configured system and the supported hardware to make some tests?

@AngryPenguinPL
Copy link
Author

Yes I can try it.

x@x-Aspire-7551G:~$ vainfo
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.3)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints

So should work.

@dbermond
Copy link
Owner

I hope that your vainfo shows profiles with VAEntrypointEncSlice. This entrypoint means vaapi encoding capability.

VAEntrypointVLD is for decoding only. So probably it will not work if your vainfo shows only profiles with this entrypoint.

@AngryPenguinPL
Copy link
Author

Oh, sorry for the problem, I thought that also means support for encoding.

Maybe I should write in the forums or the reddit asking for help in VAAPI tests in the screencast - I think more people should help.

@dbermond
Copy link
Owner

Ok, no problem. But if you have VAEntrypointEncSlice in vainfo you're ready to go.

Anyway, let me implement it first. I didn't had the time yet.
I'll let you know when it will be ready to test.

@dbermond
Copy link
Owner

VAAPI hardware accelerated video encoding support has been added. It supports H.264, HEVC, VP8 and VP9 encoders.

The default DRM render node used by screencast is /dev/dri/renderD128. If in need to use another render node, it can be specified with the --vaapi-device (-A) option. Note that when wanting to use the default render node it does not need to be specified by the -A option.

Some usage examples:

Use the default /dev/dri/renderD128 DRM render node, which doesn't need to be specified by the -A option:
$ screencast -u -s 1280x720 -p 200,234 -v h264_vaapi

Use /dev/dri/renderD129 DRM render node:
$ screencast -u -s 1280x720 -p 200,234 -v h264_vaapi -A /dev/dri/renderD129

Just make sure that you have a supported graphics card and the proper configured system for the desired encoder.

@Brainiarc7
Copy link

Awesome work, @dbermond , thanks for this.

@AngryPenguinPL
Copy link
Author

Thanks. Good work. I create topic on reddit linux here: https://www.reddit.com/r/linux/comments/6pnkll/screencast_with_support_for_vaapi_hardware/

Looks like it work fine.

@dbermond
Copy link
Owner

@Brainiarc7
Thank you for the interest in this project. Please enjoy.

@AngryPenguinPL
Good to know that it is working.
Thank you for promoting the project on reddit.

Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants