OBS-Studio and Hardware Encoding for Linux

There are a lot of different ways to do hardware based encoding with obs-studio, however, this particular article will discuss getting things to work with the libva api standard that some Intel and AMD gpu’s support.   Unfortunately, obs-studio doesn’t support this right out of the box, but since it is open source, several people have made the necessary files available.

First though why do you want Hardware Encoding of your videos, obs-studio by default comes with access to the x264 software based encoder that is used with ffmpeg.  While this does a good enough job, it is also very CPU intensive, and in my experience this is is pretty picky on CPU usage that can start to drop your frame’s per seconds down.  Dropped frames means stuttering or laggy video.  Which isn’t a good thing.

On my particular system using software encoding with OBS-Studio running would take between 18 to 25 percent cpu.  If it creeped up into the 20% range, it would  start to drop frames.   So I had to be judicial about what was being done with the scenes.   With Hardware encoding enabled, the system is consistently using between 5 to 8 percent CPU.  A huge difference that frees up the CPU to be used for other things by other applications.

If you have Ubuntu installed, you probably already have the necessary drivers needed to use LIBVA api for hardware encoding.   To check this you can run the command vainfo to get the necessary information if your system supports hardware encoding.

vainfo libva info: VA-API version
    0.38.0 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib64/dri/i965_drv_video.so libva info: Found init function
    __vaDriverInit_0_38 libva info: va_openDriver() returns 0 vainfo: VA-API version: 0.38 (libva 1.6.1) vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Desktop -
    1.6.1 vainfo: Supported profile and entrypoints
          VAProfileMPEG2Simple            : VAEntrypointVLD
          VAProfileMPEG2Simple            : VAEntrypointEncSlice
          VAProfileMPEG2Main              : VAEntrypointVLD
          VAProfileMPEG2Main              : VAEntrypointEncSlice
          VAProfileH264ConstrainedBaseline: VAEntrypointVLD
          VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
          VAProfileH264Main               : VAEntrypointVLD
          VAProfileH264Main               : VAEntrypointEncSlice
          VAProfileH264High               : VAEntrypointVLD
          VAProfileH264High               : VAEntrypointEncSlice
          VAProfileH264MultiviewHigh      : VAEntrypointVLD
          VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
          VAProfileH264StereoHigh         : VAEntrypointVLD
          VAProfileH264StereoHigh         : VAEntrypointEncSlice
          VAProfileVC1Simple              : VAEntrypointVLD
          VAProfileVC1Main                : VAEntrypointVLD
          VAProfileVC1Advanced            : VAEntrypointVLD
          VAProfileNone                   : VAEntrypointVideoProc
          VAProfileJPEGBaseline           : VAEntrypointVLD
          VAProfileH264MultiviewHigh      : VAEntrypointVLD
          VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
          VAProfileH264StereoHigh         : VAEntrypointVLD
          VAProfileH264StereoHigh         : VAEntrypointEncSlice

If you get information like above, you are set to move to the next step.  If you don’t, then either your system doesn’t support libva, or you may need to install the necessary deb file (intel-libva-driver I believe).

Next we need to recompile OBS-Studio with the necessary support plugin.  Fortunately, Reboot from GitHub has create the necessary plugin for us.   I’ve forked his code, and updated it to work with 19.x or above.   You will need to clone the repository and check out the vaapi-h264 branch I have.

I’m not going to go into detail on how to compile OBS-Studio, that is documented on the Wiki.   But once you recompile, you should now have a new menu option in the Output section of the preferences.   It will still default to x264, but you should be able to select the VA-API encoder option.   I would recommend this for both Streaming and Recording.  You shouldn’t need to mess with changing any of the defaults.

Start your recordings, and you should not see your CPU spiking as you did in the past.  You can play with the settings if you want, but the defaults worked well for me.

 

 

 

Posted in obs-studio, streaming, Uncategorized | Tagged , | Leave a comment

The State of Android and Eclipse

So it has been a while since I posted an update of where things stand.  Honestly, not a lot has changed on the eclipse front.  We still don’t have built in AAR support, there is no integrated Gradle support between Buildship and Andmore, we are behind on Nougat support, and O is fast approaching release status.   With that said, there have been a few bug fixes contributed by the community, which were released as a maintenance release, but the larger corporate adoption… is pretty much non-existent from a contribution stand point.

The later I’m not sure how to fix, as I whole heartily believe that Andmore needs a corporate backer and sponsor to fund things.   This could probably be avoided if several people that really have an itch to fix the base wanted to scratch it.   There is a lot to work on that it can be a bit overwhelming to figure out where to start.

When Google had announced a couple years ago that Android Development Tools would not be maintained any longer, I had that itch to see if I could at least get it and the Moto Dev Studio tools to a place where it would have a chance to survive.  I managed to scratch that and over the next year with the help of several other committers bring you Andmore 0.5.0.   Believe me the most difficult work has been done, and that is getting everything through the IP process, what is there is clean from that stand point.

So the general question now that Andmore is at the Eclipse Foundation, is there a dire need from the community to have Android tooling?   There was much outrage and yelling when Google made the decision to move to Intellij, some of it rightfully deserved some of it just background noise.   Regardless of the reasons, Android Tooling was always a Google controlled and sponsored project, it was open source in really name only (it took nearly 2 years for Doug’s CDT integration to be integrated into the core).   The same is happening with Android Studio, it is controlled and dominated by Google and is really open source in name only.  If Google decides for whatever reason that they want to move all development to the cloud and abandon Android Studio and Intellij, there is nothing that anyone will be able to do to prevent it.  The difference though is, that Jet Brains will pickup and continue developing Android support themselves.  Why, because they have a financial interest to make sure their IDE supports it for their corporate customers.

This brings us back to the question… Does the community really want Android tooling built off the eclipse platform?   If so, how do we improve it, given that right now, this is largely a volunteer effort.

 

Posted in android, eclipse, open source | Leave a comment

Andmore 0.5.1

A small maintenance release for the Andmore project has been released. This release contains a handful of bug fixes that have been provided entirely by the community. So if you have the will and desire to help move Android development for eclipse along, you just need to submit a pull request to the project and it will more than likely be included.

If you really, want to become a committer. The barrier to entry is pretty low. Just submit some quality pull requests to the project, and if you have the desire to work on the project more we will probably ask. Andmore is what the community makes it.

The maintenance release is available through the eclipse marketplace.

Posted in android, eclipse | 1 Comment

Andmore 0.5-M7 available.

Screen Shot 2015-04-19 at 4.44.52 PM

It’s been a while since I posted an update.  Milestone 0.5-M7 is available for download.  This is a pretty big upgrade to the underlying support libraries.   You should now be able to work with Android versions up to M with the this update.   It is recommended that you update your SDK as well if you haven’t already.

Android N may work as well, and we’ll need people to test this out.   The latest version is out in the Eclipse Market Place

https://marketplace.eclipse.org/content/andmore

The latest version can always be obtained from the following p2 url:

http://download.eclipse.org/andmore/latest/

Please do give this a tire kick, and thanks again to Matthew Piggot for contributing the update and  Kaloyan for getting this big change out.

Posted in android, eclipse, planetandroid | Tagged , | 1 Comment

Andmore 0.5-M3 available.

Screen Shot 2015-04-19 at 4.44.52 PM

The third stable milestone is ready for you, the user community to kick the tires, and use for your development.  This is primarily a bug and stability milestone.  The one big addition is that Andmore now supports multi-dexing of the APK files.    Also, starting with the next Neon milestone, an Android Developers EPP package will be available.   This effort is being lead by the newest committer Kaloyan Raev.

Also this release of Andmore can be installed on older versions of Eclipse other than Mars.   There is also now an Eclipse Marketplace entry for the project as well to make installing the tooling even easier.

https://marketplace.eclipse.org/content/andmore

 

The latest version can always be obtained from the following p2 url:

http://download.eclipse.org/andmore/latest/

Posted in android, eclipse, planetandroid | Tagged , | Leave a comment

Andmore 0.5-M2 Released

Screen Shot 2015-04-19 at 4.44.52 PM

The second stable milestone release is ready for you, the user community to kick the tires, and start to use for your development.  Thanks to several community members for fixes in this release.  The most important being that the Android XML Editor no longer tries to be the only XML editor in the system.  This should allow Andmore to play nicer with other plugins that you may be using.   Also the Database Perspective got some attention and when browsing a Database from a device you should no longer get an error dialog displayed. Full details can be found in the New and Noteworthy section for the release notes.

There is a p2 site for your installation needs, I haven’t had time yet to do a composite repository yet, but it is on the list.  In the mean time add the following update site to get the latest milestone release.

http://download.eclipse.org/andmore/milestone/0.5-M2/

Add the above url to your available software sites.

It is recommended to get also get the latest m2e-android as well.  It adds some support to guarantee that source folders stay in the correct order and helps guarantee that other eclipse plugins work well with Andmore when using maven.

We are still waiting for some extension points from the Buildship project so that we can provide Gradle integration.

Thanks again the community members that provided patches.  It helps move the project forward.

Posted in android, eclipse | Tagged , | 1 Comment

Android Developer Tools is dead….long live Andmore.

It is now official.   A posting from the official Android Developer’s blog has confirmed what many of us already knew, that the days of the original Android Developer Tools based on Eclipse was numbered.   Honestly, I think this is not  a bad thing.  It does free up the resources that Google has to fully concentrate on the Android Studio tooling, and continue to improve and advance their chosen strategy going forward.

However, all is not lost, as the Andmore project is here to continue to provide Android tooling for the Eclipse community.  However, progress right now is pretty slow, and that is because my own time has been limited.   With this said, we do have integrated support with Maven and the android-maven-plugin through the m2e-android project’s support.   The Buildship project can import an existing Android gradle project, and even run some tests, but it still has problems in setting up the project natures and make things work with Andmore.   There is a feature request opened to have some sort of project configuration extension so that Andmore can help configure such projects to better work with the tooling.

The state of Android development with Andmore and how well it keeps up with the yearly and quarterly updates coming from the Android Open Source Platform is going to greatly depend on contributions from the community.   We need your help, as one person definitely can not maintain the project alone.    So please do take a look at the bug/feature backlog, feel free to fork the project on GitHub, roll up your sleeves and get a bit dirty, submit pull requests and file new bugs.   Andmore is going to be what the community makes it.   We wished for years that ADT had been open more to contributions from the community, now is the time for us to follow through on that wish.

Posted in android, eclipse | Tagged , | Leave a comment