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

plugins: linux-vaapi, Linux VA-API H.264 encoder #941

Closed
wants to merge 2 commits into from

Conversation

kingargyle
Copy link

Includes code from the reboot/obs-studio github project and the vaapi-h264 branch.

This adds the ability to use libva to use the gpu to do hardware encoding. It is
functional for both streaming and file recording.

Tested with Intel Haswell chipset.

Note that I had contact @reboot in regards to this code as it came from his branch. According to him it was from another branch in the original obs-studio code, but that branch has since been deleted and the work was never included into the original code. It also appears that @kc5nra did a lot of the original work.

I'm re-submitting it for possible inclusion if somebody wants to take it over. I believe it addresses issue
https://obsproject.com/mantis/view.php?id=263

Includes code from the reboot/obs-studio github
project and the vaapi-h264 branch.

This adds the ability to use libva to use the
gpu to do hardware encoding.  It is fully
functional for both streaming and file recording.

Tested with Intel Haswell chipset.
@kingargyle
Copy link
Author

Unfortunately work is blocking the travis-ci build link, I'll have to check to see why that failed this weekend.

@kingargyle kingargyle changed the title Linux VA-API H.264 encoder plugins: linux-vaapi, Linux VA-API H.264 encoder Jun 9, 2017
@kc5nra
Copy link
Collaborator

kc5nra commented Jun 9, 2017 via email

@kingargyle
Copy link
Author

@kc5nra It is pretty functional as it is right now from my limited testing. I mainly wanted to get this back out to a wider audience, as it really made a huge difference on my dedicated streaming laptop I take to tournaments with me. I might not have time myself to work on it but figure the wider community could help out to finish it up.

@kingargyle
Copy link
Author

This looks like it is missing the libva-dev files installed on the travis build system.

In file included from /home/travis/build/jp9000/obs-studio/plugins/linux-vaapi/surface-queue.c:1:0:
/home/travis/build/jp9000/obs-studio/plugins/linux-vaapi/surface-queue.h:3:19: fatal error: va/va.h: No such file or directory
#include <va/va.h>
^
compilation terminated.

It can't find the appropriate header files on the system.

Copy link
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Congrats on your first PR! To help out, I've reviewed this PR for code style, spelling, and your Travis build issue.

The commit message subject should be prefixed by the component. Use something like:

linux-vaapi: Add Linux VA-API H.264 encoder

The rest of the commit message (the body) should be wrapped at 72 characters.

I don't see a reason to include the doc-pak/* files in this PR. They should probably be removed from this PR.

In addition to the review comments I've made on handling missing dependencies (libva, etc.), you should add the following line to CI/install-dependencies-linux.sh on line 22 (bump libvlc down to line 23):

        libva-dev \

Sorry for the lengthy review. Let me know if you have any questions!

#include "bitstream.h"
#include <util/darray.h>

#define BS_ROUNDUP_DIV(x, sz) ((x+(sz-1))/sz)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Use spaces around the arithmetic operators, unless it would somehow break the define.

// nal_hrd_parameters_present_flag
bs_append_bool(bs, nal_hrd_parameters_present_flag);
if (nal_hrd_parameters_present_flag) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Remove this empty line.

for(size_t i = 0; i < enc->caps->attribs_cnt; i++) {
VAConfigAttrib attr = enc->caps->attribs[i];
switch (enc->caps->attribs[i].type)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: This curly brace should be at the end of the preceding line (on the same line as the "switch" statement).


enum nal_unit_type
{
NAL_UNKNOWN = 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Lines 47-58 should be indented with a single tab instead of using spaces.


enum nal_priority
{
NAL_PRIORITY_DISPOSABLE = 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Lines 63-66 should be indented with a single tab instead of using spaces.

obs_data_set_default_int (settings, "min_qp", 1);
obs_data_set_default_int (settings, "max_qp_delta", 4);
obs_data_set_default_bool (settings, "rc_type", VAAPI_RC_CBR);
obs_data_set_default_int (settings, "profile",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: I don't see a reason to line break this. It doesn't exceed 80 characters.


static void vaapi_enc_defaults(obs_data_t *settings)
{
obs_data_set_default_int (settings, "device_type", VAAPI_DISPLAY_X);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block (395-405) is odd. It places spaces between the called function name and the opening parenthesis. I'm pretty sure you aren't supposed to do that. If you're going to use spaces to align something, you could use them to align the second parameter in these calls.

bool obs_module_load(void)
{
if (!vaapi_initialize()) {
VA_LOG(LOG_WARNING, "no VA-API supported devices found with "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: Don't break user-visible strings. See other comments about this as well.

Consistency note: I've seen "vaapi", "VAAPI", and "VA-API" throughout. For printed strings, I'd suggest picking one style and using that.

@@ -0,0 +1,40 @@
project(linux-vaapi)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow disabling of this module, add this here:

if(DISABLE_VA)
	message(STATUS "VAAPI plugin disabled")
	return()
endif()


find_package(LibVa)
find_package(X11 REQUIRED)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow graceful failure/omission of this module if libva or other dependencies are not found on the system, add this here:

if(NOT LIBVA_INCLUDES_FOUND AND ENABLE_VA)
	message(FATAL_ERROR "LibVA includes not found but set as enabled")
elseif(NOT LIBVA_INCLUDES_FOUND)
	message(STATUS "LibVA includes not found, VAAPI plugin disabled")
	return()
endif()

@kc5nra
Copy link
Collaborator

kc5nra commented Jun 13, 2017

Haha, thanks RytoEX. This code is old, though I appreciate you going through all this.

It might make more sense if I reopen this PR with RytoEX's fixes so that the origin authorship is preserved in the git history. Let me know if this is something you are interested in!

@kingargyle
Copy link
Author

@kc5nra yeah, I'm fine with you re-opening the PR since you originally wrote it and have the commit history. I just didn't want this to get lost and found it useful enough to use in place of the x264 encoder.

@RytoEX
Copy link
Member

RytoEX commented Jun 13, 2017

@kc5nra No problem. If you open a new PR for this and you want another review of that, just tag me.

@reboot
Copy link
Contributor

reboot commented Jun 13, 2017

If you reopen the PR with the original branch don't forget to include the fix i made on https://github.com/reboot/obs-studio/commits/vaapi-h264. This PR is based on my repository, as far as i know, and should contain the fix.

@kingargyle
Copy link
Author

kingargyle commented Jun 13, 2017

@reboot yes, it is based on your repository.

@pschichtel
Copy link

What is currently holding this back?

@sebix
Copy link

sebix commented Jun 25, 2017

@pschichtel One build fails on travis: https://travis-ci.org/jp9000/obs-studio/jobs/240913031#L4248 (may be a reason)

@kingargyle
Copy link
Author

Actually, I think @kc5nra was going to re-submit the PR since he originally worked on it, and it would contain the full development history. That is the reason I haven't tried to address any of the issues above or the build failure.

@kc5nra
Copy link
Collaborator

kc5nra commented Jun 25, 2017 via email

@kingargyle
Copy link
Author

@kc5nra I ran this code for 13+ hrs of recording this last weekend, and it worked well, expect for the occasional B-Frame glitch every once in a while. If I had the time I'd try and investigate it myself as this worked well enough for what I needed it to do (i.e. relieve the stress on the CPU so it could do other things besides encode the video). I'd encourage fixing the B-Frame and then working on the libyami implementation, but it is up to you.

@vsnrain
Copy link

vsnrain commented Jul 16, 2017

Hello. I tried using this branch, but whenever I start recording or streaming with hardware encoder, it fails with error:

12:00:52 AM.413: [VAAPI encoder]: "vaEndPicture(q->display, q->context)": invalid parameter
12:00:52 AM.413: [VAAPI encoder]: unable to encode frame
12:00:52 AM.413: Error encoding with encoder 'streaming_h264'

Still, h264_vaapi hardware encoder seems to work ok when converting streams in ffmpeg.
What could be the problem?
Full logs here.

@kingargyle
Copy link
Author

@vsnrain what does the command vainfo report?

@vsnrain
Copy link

vsnrain commented Jul 17, 2017

@kingargyle vainfo

@kingargyle
Copy link
Author

@vsnrain after upgrading to 17.04 of Ubuntu, I'm seeing the same error.

@kingargyle
Copy link
Author

More information;

info: [VAAPI encoder]: settings:

device_type :          X11
device:                Intel i965 driver for Intel(R) Haswell Mobile - 1.8.0
device_path:           (null)
fps_num:               30
fps_den:               1
width:                 1280
height:                720
profile:               main
keyint:                2 (s)
rc_type:               CBR
bitrate:               2500 (kbit)
use_custom_cpb:        no

info: libfdk_aac encoder created
info: libfdk_aac bitrate: 160, channels: 2
info: ==== Recording Start ===============================================
info: [ffmpeg muxer: 'adv_file_output'] Writing file '/home/dcarver/Videos/ravensq/2017-07-28 19-34-16.mkv'...
error: [VAAPI encoder]: "vaEndPicture(q->display, q->context)": invalid parameter
error: [VAAPI encoder]: unable to encode frame
error: Error encoding with encoder 'recording_h264'

The issue appears that the display_path is returning NULL. I'll see if I can track this down.

@kingargyle
Copy link
Author

Further investigation seems to be a bug either in Ubuntu 17.04 or the libva implementation there. 1.7.3-2 causes the same problem. Ubuntu 16.10 which has 1.7.1 and corresponding intel drivers worked. I didn't have any issues until upgrading to 17.04.

I've opened up an issue with the libva project, so maybe I can get some info from them

https://github.com/01org/libva/issues/87

@vsnrain
Copy link

vsnrain commented Jul 29, 2017

I am using Arch, and I tried downgrading packages to

libva-intel-driver-1.7.1-1
libva-1.7.1-1

and it is still does not work. Same behavior, but this time it does not even show error and end log with

==== Recording Start ===============================================
[ffmpeg muxer: 'adv_file_output'] Writing file '/home/vsnrain/2017-07-29 10-39-16.mkv'...

the video file is created, but only with single frame.

@kingargyle
Copy link
Author

@vsnrain I'm going to try and install a dual boot into ubuntu 16.10 later tonight which has 1.7.1-2 and I'll let you know what I see. I didn't start getting problems until I upgraded to 17.04. I'll let people know what I find out, and hopefully can get some extra info from the libva project itself.

@kingargyle
Copy link
Author

Locally I was able to get this working again, but I had to go back to Ubuntu 16.04 and it's native libva libraries. This is running 1.7.0 of the intel driver. I've tested it with FLV and MKV files. I do think long term that lib-yami is probably a better option as it wraps VA-API and takes much of the grunt work out of it from what I can tell. Something changed in the later versions, just not sure what yet.

@kingargyle
Copy link
Author

So answer I got from the LIBVA developers is as follows.

"intra_period is set to 60 however ip_period is to 0 in your case, however 0 is invalid for ip_period when using CBR mode. The new driver adds some checks for intra_period/ip_period. Please set a valid ip_period, sorry for the inconvenience."

So, it looks like with the newer drivers we need to ip_period to something other than 0.

@kingargyle
Copy link
Author

Putting this here, as a sample on on how to set the ip_period, (sample comes from the libva project).

"You may refer to https://github.com/01org/libva-utils/blob/master/encode/h264encode.c for how to set ip_period in your application:"

@Bleuzen
Copy link

Bleuzen commented Aug 12, 2017

I also get this error when using CBR:

error: [VAAPI encoder]: "vaEndPicture(q->display, q->context)": invalid parameter
error: [VAAPI encoder]: unable to encode frame
error: Error encoding with encoder 'streaming_h264'

So I tryed CQP, maybe I can at least use it for recording.
But no.
When recording with VAAPI CQP it freezes my computer after about 20 seconds.
I can't even press the reset button: nothing happens
I have to take it from the power cable to 'shut down' and restart it.

A part of the console output after obs started:

libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: va_openDriver() returns -1
error: [VAAPI encoder]: "vaInitialize(display, &major_version, &minor_version)": unknown libva error                
libva info: VA-API version 0.40.0                                                                                   
libva info: va_getDriverName() returns 0                                                                            
libva info: Trying to open /usr/lib/dri/i965_drv_video.so                                                           
libva info: Found init function __vaDriverInit_0_40                                                                 
libva info: va_openDriver() returns 0                                                                               
libva info: VA-API version 0.40.0                                                                                   
libva info: va_getDriverName() returns 0                                                                            
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so                                                       
libva info: va_openDriver() returns -1                                                                              
error: [VAAPI encoder]: "vaInitialize(display, &major_version, &minor_version)": unknown libva error                
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): libnvidia-encode.so.1: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden

I made a 2 seconds test recording (because I don't want my computer to freeze again) and this is the log file of it:
2017-08-12 09-24-29.txt

The recorded video is ok and plays fine in VLC.

My OBS settings:
screenshot_20170812_093150

I'm using this branch: https://github.com/kingargyle/obs-studio/tree/vaapi-h264

@kingargyle
Copy link
Author

yeah, this code should be considered beta. I'm hoping to get some time soon to at least address the CBR issue that has been reported. I've had some success with VBR but again that it is on Ubuntu 16.04.

@kingargyle
Copy link
Author

kingargyle commented Sep 9, 2017

@RytoEX haven't had time myself to work on things. I know what is causing the issue for the crashes some people are experiencing I just haven't had time to actually make the appropriate change in the code. I thought @kc5nra was going to either update this or create a different implementation. I've got a working system locally but would like to try and fix it for others using the newer vaapi drivers.

Last implementation I did was just to sync my code up with master to make sure it still worked locally.

@jp9000
Copy link
Member

jp9000 commented Sep 12, 2017

Just making a sort of official note here -- unfortunately still not mergeable as of yet I feel. Also still has that cmake configuration issue where it still won't find va/va.h when compiling for example. The required package really needs to be put in cmake.

Might be worth checking out libyami like fruitman was saying. Unfortunately I can't really dedicate the time to implement this myself -- I feel like I'll really have to delegate this to someone else who's able and willing.

I have a backup of the old branch still locally as well just in case.

@kingargyle
Copy link
Author

@jp9000 I agree that libyami is probably the way forward. I'll be giving a presentation in a couple weeks at the Ohio Linuxfest on OBS Studio and I'll bring up there that the project is looking for someone to step up and create an Intel hardware encoder. Like others, my time unfortunately right now is limited and I have a version working for my needs. If you want to close the PR, feel free to do so I'll keep my branch up to date with master.

@jp9000
Copy link
Member

jp9000 commented Sep 12, 2017

Oh really? That's quite awesome, wish I could be there to see it in person and say hi -- if there's a video of it email it to me.

Perfectly understandable though -- I'm very grateful regardless. Having it as a PR put it kind of in a more public spotlight than when it was rotting on a stale branch, and the testing on the PR has been interesting. VAAPI is certainly usable, although implementing it properly is definitely not a simple task. A library that implements it is likely the best option at this point.

It's not really a critical or high priority thing these days as CPUs are more powerful and have more cores. x264 doesn't really have troubles these days like it used to 4 or 5 years ago. I suppose hardware encoding is mostly just a luxury more than anything, so definitely not a big deal either way.

@pschichtel
Copy link

From what I have seen about libyami, this library seems focus on Intel's CPUs. Would this still work with other GPUs supporting vaapi ?

@kingargyle
Copy link
Author

@jp9000 actually, I use a laptop for most of my use of OBS and honestly, I had to have hardware encoding because using the x264 encoder would eventually cause dropped frames when the CPU usage would get up around 20% on the system. Using the VAAPI hardware encoder built into the laptop, keeps the CPU usage around 8% to 10% which doesn't cause any frame drops. So in my case, I need the hardware encoding as x264 even on the fastest setting possible uses too much CPU for the poor laptop.

@jp9000
Copy link
Member

jp9000 commented Sep 12, 2017

I suppose that's true, I have a bad tendency to sort of disregard laptops when it comes to serious streaming -- it's kind of a bad habit.

@kingargyle
Copy link
Author

@jp9000 No big deal, the use case I have, is recording Live events for miniature games, and the laptop was just the most portable solution. Ideally I get the time to build out a more robust mini desktop machine that can be taken, but until then the laptop with hardware encoding does the job.

@reboot
Copy link
Contributor

reboot commented Sep 12, 2017

I have been wondering if there is any benefit of directly implementing a VAAPI encoder. FFmpeg has a h264_vaapi encoder that could probably be used just like it is already done for NVENC.

@iopq
Copy link

iopq commented Sep 12, 2017

Any way to use the ffmpeg h264_vaapi encoder in OBS? Or is that something that would require a pull request?

@reboot
Copy link
Contributor

reboot commented Sep 12, 2017

The FFmpeg output in the advanced recording settings should allow any codec supported by FFmpeg.

@iopq
Copy link

iopq commented Sep 12, 2017

There isn't such a setting in the streaming tab

@kingargyle
Copy link
Author

@reboot I've tried to get the ffmpeg encoder with vaapi working in OBS and have failed miserably. None of the command line options seem to work in the ffmpeg encoder settings. If somebody wants to wrap a friendlier gui around it I'd be all for it, but until then, I think from a users point of view, having something native just makes it easier for those that don't want to have a PHD in FFMPeg.

@jp9000
Copy link
Member

jp9000 commented Sep 13, 2017

Well technically all you'd need to do it basically copy a significant portion of the NVENC code (which is implemented through FFmpeg similarly) and just adapt it to VAAPI, I should probably try that if I ever get time. Could probably make that code abstract at some point like I did for the audio encoders.

@ONSBalder
Copy link

Can one of the admins verify this patch?

@kingargyle
Copy link
Author

@ONSBalder there are some bugs as noted with this patch that would need to be addressed so that it works with the newer VAAPI versions. I think this is mainly staying open until either I get time to try and fix a few of the bugs, or somebody comes along and writes a better more complete implementation.

@RytoEX
Copy link
Member

RytoEX commented Sep 29, 2017

@kingargyle
ONSBalder is a bot that had been dormat, and then suddenly awakened and commented on all of the open PRs.

@kingargyle
Copy link
Author

Ah... thought that was the case after I checked it's activity. :)

@Bleuzen
Copy link

Bleuzen commented Oct 22, 2017

I took the code from w23 and updated it to work with the newest obs.
This uses ffmpeg and it works for me on Manjaro with ffmpeg 3.4 and libva 1.8.3 installed.

Old source: https://github.com/w23/obs-studio/tree/ffmpeg-vaapi
Updated branch with 20.1: https://github.com/Bleuzen/obs-studio/tree/ffmpeg-vaapi
Patch file: https://patch-diff.githubusercontent.com/raw/Bleuzen/obs-studio/pull/1.patch

The only thing that you have to change is this line in /plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c:

ret = av_hwdevice_ctx_create(&enc->vadevice_ref, AV_HWDEVICE_TYPE_VAAPI, "/dev/dri/renderD129" /*FIXME*/, NULL, 0);

for me it works with /dev/dri/renderD129, because /dev/dri/renderD128 is my AMD GPU and /dev/dri/renderD129 my Intel GPU.
If you also have 2 GPUs, you may have to change /dev/dri/renderD129 to /dev/dri/renderD128 before compiling, if you want to use your other GPU.
If you only have 1 GPU, you should also change it to /dev/dri/renderD128.

TODO:

  • There is no way to change the render device from GUI already
  • Implement VBR encoding (currently only CBR supported)

BUGS:

  • CBR encoding is not realy constant bitrate. The set bitrate just acts like a maximum. If nothing happens on the screen, the bitrate drops down.
  • Sometimes when starting a recording, the bitrate drops to 0. The output file is empty. Restarting OBS helps, if not, restarting my system, and it work's fine again. It only happens realy rarely. I still try to figure out, how to trigger it. I'm not sure if this is an issue with OBS or my system configuration.

@eduardoc25
Copy link

eduardoc25 commented Oct 26, 2017

Hi guys,

I've tried the @kingargyle branch and this is what throws me into the console:
nfo: ==== Recording Start =============================================== info: [ffmpeg muxer: 'adv_file_output'] Writing file '/home/eduardo/2017-10-26_14-56-01.mp4'... error: [VAAPI encoder]: "vaDeriveImage(enc->display, surface, &image)": invalid VASurfaceID error: [VAAPI encoder]: unable to upload frame to input surface error: Error encoding with encoder 'recording_h264'
This is the last configuration that probe, but without success in any test.
screenshot_20171026_150029
I've also tested the @Bleuzen branch and the latter works but with glitches...
info: ==== Recording Start =============================================== info: [ffmpeg muxer: 'adv_file_output'] Writing file '/home/eduardo/2017-10-26_15-09-08.mp4'... [mp4 @ 0x2043280] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. [mp4 @ 0x2043280] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. [mp4 @ 0x2043280] track 1: codec frame size is not set info: [ffmpeg muxer: 'adv_file_output'] Output of file '/home/eduardo/2017-10-26_15-09-08.mp4' stopped info: Output 'adv_file_output': stopping info: Output 'adv_file_output': Total frames output: 1775 info: Output 'adv_file_output': Total drawn frames: 1938 (1944 attempted) info: Output 'adv_file_output': Number of lagged frames due to rendering lag/stalls: 6 (0,3%) info: ==== Recording Stop ================================================ info: Video stopped, number of skipped frames due to encoding lag: 1665/1855 (89,8%)
This is the last configuration that probe:
screenshot_20171026_151241
I do not know if I still have to implement B frames for AMD accelerators, since both in my R9 290 and my old 7850 I get the same message:
libva info: VA-API version 0.40.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib64/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_0_40 libva info: va_openDriver() returns 0 [h264_vaapi @ 0x2aa68c0] B frames are not supported (0x1). warning: [VAAPI encoder: 'recording_h264'] Failed to open VAAPI codec: Argumento inválido
This is how it is recorded with AMD cards:
https://youtu.be/qBEZ58nl0No
PS: My distribution is Opensuse Tumbleweed (desktop) and Opensuse 42.3 (notebook), I had no problem compiling both projects on my computers, I have all packages updated to date. I want to emphasize that both projects work for me as long as I use the intel accelerator (HD4600). Actually my skills as a programmer are very low so I point to test.
Regards

@eduardoc25
Copy link

Hi guys, as I do not see any new advances... I want to inform mine ...
At last I have managed to make vaapi work with my AMD GPU through ffmpeg, these are the parameters:

DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -f x11grab -r 30 -s 1920x1080 -i :0.0+0,0 -an -f pulse -ac 2 -i 1 -vf 'format=nv12|vaapi,hwupload' -threads 4 -vcodec h264_vaapi -profile 66 -bf 0 -b 10M -acodec pcm_s16le output.mkv

Regards

@ghost
Copy link

ghost commented Jan 6, 2018

@eduardoc25 - If you're only interested in full screen recording, newer versions of ffmpeg have -i kmsgrab, which should perform much better than x11grab as it can skip the overhead of X11 + hwupload entirely.

@soredake
Copy link

Is it dead?

@jp9000
Copy link
Member

jp9000 commented Feb 23, 2018

We're going to use FFmpeg's implementation rather than a custom implementation. Someone is working on it currently, just not complete yet.

@Angelspiritofswe

This comment has been minimized.

@rkantos
Copy link

rkantos commented Mar 22, 2018

I tried building this for my x5-z8300 Intel Compute Stick using kingargyles sources and had the same issues as Bleuzen.. Going to try with his solution next..

It's not really a critical or high priority thing these days as CPUs are more powerful and have more cores. x264 doesn't really have troubles these days like it used to 4 or 5 years ago. I suppose hardware encoding is mostly just a luxury more than anything, so definitely not a big deal either way.

Please NO! I cannot understand why people working with similar open source projects do not take the time to understand hardware encoding / decoding etc. In my opinion it is very important to understand that a lot of people are using very old hardware or in other words cheap hardware to run.. you've guessed it; open source software. This means one should forget modern hardware, such as the Intel Atoms like Bay Trail and more recently Cherry Trail CPUs which are all very capable computers for the price.

And I mean all, ALL!!, it takes is to implement proper support for at least the basic hardware capabilities of the CPUs that exist! Imagine all the Atom-based TV-devices running 2W TDP (and older hardware, like the Intel HD2000, HD2500 and HD3000) going from potentially unusable 720p h264 encoding to something where you can actually encode 1080p on a 2W cpu with less than 70% cpu usage. Again, In my opinion it is a very big deal.

I suppose that's true, I have a bad tendency to sort of disregard laptops when it comes to serious streaming -- it's kind of a bad habit.

If I can ask, maybe in the future at least think about disregarding ALL low power cpus and older hardware, not just laptops, since the reality is you can reliably run OBS on this:

...On Windows.

@dodgepong
Copy link
Member

There is now a PR that uses the FFmpeg implementation of VAAPI here: #1255

@jp9000
Copy link
Member

jp9000 commented Apr 26, 2018

Moved -> #1256

@jp9000 jp9000 closed this Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet