OBS Studio

I assume just about everyone who searched for a screen casting software in the last three years has heard of OBS Studio (or formerly just OBS). At this point it is an industry standard for recording and streaming videos. Since the complete rewrite there’s no reason not to use it: it’s free, open-source and cross platform.

A while ago I tried to write a plugin for the original OBS at which I failed tremendously at, for one because of my incompetence but also because it was badly documented and pretty tedious. Recently I got back to that idea of writing a plugin for it but now since it switched to being crossplatform the process changed completely.

Sadly it’s still pretty obscure, which shows in the fact that there’s barely any plugins for OBS Studio. It seems like the setup process is what keeps a lot of people from making a plugin and those who get it to work stop after finding out that there’s no real documentation (Except code comments). After spending about two days on setting OBS Studio up, I got it to work and after some more time spent I finished my plugin.

It adds a new source type to OBS which shows keyboard and mouse input on stream. If you want to check it out you can get it here. But now I’ll talk a little about the setup process.

Working with OBS Studio’s source code

The only real documentation is the guide up on github. But even with those instructions some things are a little unclear. For this guide I’ll assume you want to set up a development environment on windows.

So first of the requirements:

  • Visual Studio (2013 or 2015)
  • Qt5
  • cmake
  • Libraries
  • Git (Recommended)

Visual Studio 2017 was just released but I had no luck when trying to use it so I used VS 2013 Community. The following parts will show you how to set up all requirements, except Visual Studio, just google for the installer of the desired version and install it.

Dependencies

Now you should set up a dedicated folder for your development with obs (here refered to as “obs-dev/”) and download the dependencies first (Dependencies for Visual Studio 2013/2015). Unzip them and put them in a sub folder (here refered to as “obs-deps”).

Qt5

It’s not all that obvious as to how to get Qt5, since the guide only mentions folder names like D:\Qt\5.8\msvc2013 or D:\Qt\5.8\msvc2013_64. So first head to the Qt page and download the installer. Then skip the login part and select only these options when installing (These are the required ones, since everyting else just takes up disk space):

Unbenannt.png

Now obviously if you have Visual Studio 2013 you dont need msvc2015 and the other way around. Also if you only want to develop for 64 bit you don’t need 32 bit and vice versa. You can uncheck everything else, except the Qt creator since that ones required.

Note: You can only install Qt to a path that does not contain spaces, in my case

C:\Qt\

Cmake

Cmake is the software OBS uses to configure the environment for developing and it will take care of all the complicated stuff. So just install it, or download a portable version from the offical cmake page.

Git

This is only used to grab the source code and if you want to keep track of your changes. Get it here.

Putting it all together

Now let’s put all these new toys to use: First grab the source code from github via git. Open git bash (by default right click in your obs-dev folder and choose “open git bash here”) then enter this command

git clone --recursive https://github.com/jp9000/obs-studio.git

now you’ll have a sub folder called obs-studio, nice! Though this is the very latest and bleeding edge stuff. That’s cool if you’re planning to just build OBS or contribute to it’s development, but if you want to develop a plugin it’s better to use the latest stable release, so let’s turn back time to the latest stable release. Type:

git tag -l

This will list all past releases of obs studio. At the bottom there should be the latest version (eg. 20.0.1), now let’s load that version by running

git checkout 20.0.1

or if you plan on using git to track your changes

git checkout 20.0.1 -b plugin-dev

The second command will create a new branch with the name “plugin-dev”, this assures that all your future changes will be tracked on a separate branch without touching the original obs code (You obviously can’t acutally change the original code without having the right permissions, but it still helps to keep your local repository tidy).

That’s all we need from git, we now have stable releas of OBS we can base our plugin on.

Configuring Cmake

This step is only needed if you want to develop a plugin for OBS, if you just want to compile it or want to direcetly commit to the obs repository (in pull-requests), you can directly go to “Using Cmake”

Cmake by default only creates project files for OBS and it’s plugins. But our plugin isn’t included since it doesn’t exist yet. Let’s fix that by telling cmake to create an empty project for us. Head into “obs-dev/obs-studio/plugins” and create a new sub folder for your plugin (in this case “test-plugin”). Now inside that folder you need a file called “CmakeLists.txt” and a *.c or *.cpp file with the same name as your plugin. You can keep it empty, but we need something to fill your project for now. The last thing you need is a “data” folder with another folder called “locale”. Inside that you put your language files to translate your plugin (by default only “en_US.ini”.

So this is how your folder structure should look like by now:

  • test-plugin
    • data
      • locale
        • en_US.ini
    • CMakeLists.txt
    • test-plugin.c(pp)

Now we can leave all files empty except the CMakeLists.txt. This needs to contain information for Cmake so it can create the project. You can take a look at other plugins or copy what I have:

project(test-plugin)

if(MSVC)
 set(test-plugin_PLATFORM_DEPS
 w32-pthreads)
endif()

set(test-plugin_SOURCES
 test-plugin.cpp)

add_library(test-plugin MODULE
 ${test-plugin_SOURCES})
target_link_libraries(test-plugin
 libobs
 ${test-plugin_PLATFORM_DEPS})

install_obs_plugin_with_data(test-plugin data)

Just replace all instances of  “test-plugin” with your plugin name. The last thing we need to do is go back to the “plugins” folder and edit the CMakeLists.txt file which is inside that folder. At the bottom of that file you’ll see a bunch of “add_subdirectory(…)” lines. Just add another line with your plugin and save it.

add_subdirectory(test-plugin)

And that is all you need to do to tell CMake about your plugin, now we’ll let CMake take care of the rest.

Using Cmake

Open up the Cmake-gui and then set “Where is the source code:” to “obs-dev/obs-studio” and “Where to build the binaries” to a separate folder where you want to have all Visual Studio projects (it won’t actually put the binaries there), for me the folder is “obs-dev/obs-studio/vs”. Now click configure and select the Visual Studio version you use. You can choose between “Visual Studio <2013/2015>” and “Visual Studio <2013/2015> Win64”. Using 64 bit means your project will build 64 bit binaries and the same for 32 bit.

cmake1.PNG

After it’s done it’ll spit out some errors since it can’t smell where you put the dependencies. You’ll have to set two variables QTDIR and DepsPath. Both of these can be suffixed with “32” or “64” to tell Cmake what bit the dependencies are. So you either just set QTDIR, or if you want both 64 and 32 bit you’ll set QTDIR32 and QTDIR64. For me this is how I set them:

  • QTDIR32: C:/Qt/5.8/msvc2013
  • QTDIR64: C:/Qt/5.8/mscv2013_64
  • DepsPath32: ../obs-dev/obs-deps/win32
  • DepsPath64: ../obs-dev/obs-deps/win64

Note: Cmake uses forward slashes for paths since all Operating systems do that except Windoze.

cmake2.PNG

In this screenshot I only used the 64 bit dependencies, which means I can directly use “DepsPath” and “QTDIR”. If you want 32bit and/or 64bit you’ll need to click “Add entry” and add “DepsPath32” / “DepsPath64” and “QTDIR32” / “QTDIR64”, and set their values accordingly.

Keep in mind that the dependencies are different for VS 2013 and 2015! Now click configure again and after it finishes it’ll let you change some other settings which are unimportant for us so just click configure a third time and there should be no red items in the Cmake list left. After all that you can click Generate, which will create the Visual Studio Solution. When that is done you can click Open Project or directly open the solution.

cmake3.PNG

This is how Cmake should look like after the second configuring process (After you entered “DepsPath” & “QTDIR”).

And that’s it. Give VisualSudio some time since OBS is a huge project and it takes some time to index all the files. You should now be able to click the green play button and the latest version of OBS should run. If you configured CMake to create a project for your plugin you should also see a project with your plugin name in the project explorer.

vs.PNG

So this was all I had to go through to develop a small pugin that probably no one will use. If you compare this essay to the guide up on github you’ll see that it’s missing a couple of things. For experienced developers this process might be self explanatory but for a newbie like me it was quite the nerve wrecking adventure. Maybe this write up will prevent at least one persone from going throught that same process.

Advertisements

Punycode

Phishing or domain squatting is something that has been around for a while but people never stop to find new ways to trick users into handing them confidential data.

I never really got hit by any of that except for a few fishy links that looked like steamcommunity.com but for example there was an extra letter in the domain name. Now this way is easy to spot and usually your browser will block them anyways since their reported. A new way of luring people onto fake websites is Punycode. Well if I’m correct it’s not really new it just got some attention recently.

Take a look at the two urls. They are from two different websites, but they both look exactly the same, in fact I don’t remember which one is from the actual apple website anymore. That’s the power of punycode. It works in both Chrome and Firefox and any recent other browser. You can try it you yourself here (Test site: apple.com, Original: apple.com).

Punycode is used to allow special characters in urls like ü,ä,ö etc. but it also allows other characters from other alphabets that look exactly like the roman alphabet. Now while this sometimes is a useful feature it’s rarely used and it’s making it hard to tell the difference. In this case the entire domain is written in cyrillic letters (You can only really see it on the l). This way most browsers won’t see it as a phishing domain.

Depending on your operating system it might be that the current font will give away the fact that the url is not actually apple.com but on windows you won’t be able to tell. Both sites use https and have a working certificate making them look completely identical at first glance. Firefox also shows what certificate is used which can tell you whether or not you’re looking at the original site since it’ll say “Apple Inc. (US)” in the URL bar. That doesn’t happend with all URLs though so it’s not a consistent way of identifying phishing sites.

A way to dodge punycode phishing

Firefox allows you to disable punycode which is the easiest way, but it’ll also make normal website look a little off. Here’s how to disable it:

  1. Type about:config into the address bar (Accept the message if it shows up)
  2. Search for “puny”
  3. Set the value “network.IDN_show_punycode” to true
  4. Done.

Now the previous website’s URL will look like this: https://www.xn--80ak6aa92e.com/ instead of apple.com.

I’m not sure about chrome but there’s probably a way for it too but you’ll have to look for it yourself.

For the initial article and further reading (which is also linked on the testing domain) go here.

Protonmail

A lot of people use Gmail. It seems to have become a standart for email adresses just like most other google services. My google account to this day is linked to my old email address not because I dislike Gmail but because my account is already linked to a gmail which has a completely random and weird name so I can’t use it.

Gmail is definetely a good service. The web interface and the spam detection is pretty good, but is it really necessary that google gets another oppertunity to collect data? They say that they care about privacy but I still don’t think it’s needed. Also I kinda started disliking gmail addresses because so many people use them as their business addresses which is really unprofessional especially when they already own a domain and it’s only a matter of setting up an email server.

I recently was told about protonmail, which is a small secure email provider. It offers you the security by encrypting your emails with your password (So choose a strong one) and also your data is stored in a data center “underneath 1000 meters of solid rock”. The communication is oviously also end-to-end encrypted and overall it’s one of the most secure email services I’ve ever seen. The emails are accessed over the browser which means their not stored locally (For mobile there’s an android and iOS app). That’s both negative and positive. For one your messages are savely stored on the servers and even if someone had access to your local files they’d be safe. On the other hand you always have to login to use your email. Currently there’s no way to safe your login, which is probably intended for extra security. You can safe your login information but that would be counterproductive so I recommend to use a password manager.

Currently I haven’t completely switched to protonmail but if I’ll end up using it as my main email address I’ll probably ditch my email client and just have the proton inbox open in a tab for the most time so I don’t have to login over and over.

To sum it up: Try protonmail out, it’s pretty nifty if you care about security and your email domain will stick out in the masses of gmail addresses. Just note that if you use the free plan your emails will have this signature:

Sent with ProtonMail Secure Email.

So if you care about your privacy and want to support the people behind proton mail you can donate to them or get protonmail plus for 48 $/€/CHF per year and get some advantages.

Enpass

Small edit: I’m currently trying out Keepass, which an opensource password manager that has been around for over 10 years. It seems pretty good aswell but the user experience isn’t quite the same since it’s harder to setup and it doesn’t have any cloud syncing for linux. So if you don’ trust a newly established password manager that is closed source keepass is probably the way to go. It allows you to migrate from multiple other password managers including Enpass.

For the longest time I didn’t really follow the idea of “use strong unique passwords for every service”. One the one side I don’t really have any super important accounts (at least not that many) and all the ones that are important have two factor authentification. So I usually used pretty weak passwords and just relied on the two factore authentification. I never had any issues with it (maybe I’m jinxing it here. EDIT: I did 😛, but once again nothing happened) but a while ago I decided I shouldn’t wait until something bad happens to start using better passwords, infact I already got a number of emails from one service which told me that someone was trying to log into my account from somewhere in India, but they couldn’t since they also needed my email (Which obviously didn’t use the same password).

So I went ahead and looked for a good password manager and after a short search I found Enpahttp://keepass.info/ss. Keeping all passwords in one place is both good and really bad. For one their secured and you don’t have to memorize them. On the other hand if someone were to get access they’d have it really easy to compromise all of your accounts.

Enpass advertises itself as the “best password manager”. I haven’t used any others but for now I’m happy with it. It’s cross-platform runs on Linux, Windows and my android phone. It encrypts the entire password database with your master password and can sync across various cloud services like Google Drive.

The best thing about it is the browser addon which allows you to directly interact with enpass and transfer login information to the browser. Also it can generate passwords on the fly while creating a new account with settings like lenght, use special characters or only use pronouncable words. When creating a new account it can also automatically add the login information to the database. Obviously all that can only be done when logged in with the master password. You’ll be automatically logged out after 1 minute of inactivity within Enpass (Which can be changed). Passwords that have been copied to the clipboard will also be cleared after a give timeout.

Something that you should note is that passwords you have generated can be looked up in the password history of Enpass. I didn’t know that in the beginning an thought that the passwords were lost, since the clipboard was cleared.

To sum it up Enpass is a pretty useful tool which is free for Windows, Linux and Mac. The mobile version is limited to 30 database entries though. The only thing that can be concerning is the fact that one company could compromise thousands of accounts if they wanted to, let’s hope they don’t.

fping on windows

I started working on a ping plotter a while ago and back then I still was on linux and was currently getting into C. Now that I’m not on linux anymore I kinda dropped the project for a while. After that pause I’ve finally gone back I decided to ditch C and write it in Python since I’m developing it on windows but want it to work on linux aswell. The ping plotter is supposed to ping an ip over a timespan and then make a graph out of the latency values. For that I’ll use the ping command since that’s the easiest way to get latency values without adiministrative rights. The issue is that the windows ping.exe and the linux ping command return different outputs so formatting them means I have to differenciate between windows and linux.

After some searching I came across fping which is a custom ping program for linux. It’s designed to be used in scripts which digest it’s output. So now the only issue is to compile that for windows. I used cygwin for it since nobody seems to have done it before me. Sadly the build script returns errors when compiling. So here’s how I fixed that:

First get the sourcode from the releases. Now we’ll need to convince cygwin that we have the right headers. Download this header file (made by John Paul Morrison) as icmp.h. Copy it into these folders and replace it with the icmp.h that is in those folders (That one is empty, you can open it if you want):

\usr\include\icmp.h
\usr\include\cygwin\icmp.h

The path to cygwin will usually be C:\cygwin64\ or C:\cygwin\. Now you can run

$ ./configure
$ make

Now you’ll have a fping.exe in the ./src/ folder. Run a command prompt as admin and then run something like

C:\fping\src>fping.exe -s google.com

That should give someting like this

google.com is alive

       1 targets
       1 alive
       0 unreachable
       0 unknown addresses

       0 timeouts (waiting for response)
       1 ICMP Echos sent
       1 ICMP Echo Replies received
       0 other ICMP received

 36.6 ms (min round trip time)
 36.6 ms (avg round trip time)
 36.6 ms (max round trip time)
        0.038 sec (elapsed real time)

Pretty cool, huh? But if you read carefully it needs adminstrative rights on windows and root rights on linux so all of that was kinda wasted… I’ll just use the output of the native ping commands instead but if anyone needs fping on windows here you go. For those whore are to lazy to compile it themselves you can download my compiled binary for windows here (By the way there seems to be an infected version of fping on the web so if you need some confidence, that this one isn’t a virus heres a virustotal scan or scan it yourself). It’s completely unmodified and all credits go to the original authors.

I’ll now go back to getting back into python and formatting ping command outputs. Wohoo.

Windows 10

So I have avoided windows 10 ever since the tray icon showed up for everyone for the free upgrade. The furthest I’ve gone away from windows 7 was 8.1. Since my windows 7 installation was getting kinda slow I decided to make a clean installation, and while I’m at it I thought I’ll go ahead and, for the first time, install windows 10 outside of a virtual machine.

The installation went smooth and I only had to untick about 300 settings about “collecting data to improve my experience”. After the main installation I went ahead and ran a few scripts to disable the rest of the services and I think I now a have a relatively useable installation of windows 10. So after I installed the basic software I need (which I heard can be automated using ninite or allmyapps, but I haven’t tried them) I went ahead and looked at some customisation with designs. There were some pretty cool looking ones but sadly one of them ended up toasting windows and trying to fix it only made it worse. Luckily I made a backup so that helped out a lot.

So after almost loosing my first installation of windows 10 about 2 hours in I stopped with the designs and installed something I knew from windows 8.1: Classic Shell, the free StartIsBack. It gives you a way to customize (or for windows 8 bring it back) your startmenu. The windows 10 start menu is way to big and full of useless stuff in my opinion so with classic shell you’ll get back the windows 7 styled start menu with a skin to fit the flat design of windows 10. It’ll also give you the search bar back and it’ll adjust to the accent color.

Due to the roll back to the backup I lost some software I had already installed, including winamp which was my goto music player for a while now. So I thought I’d use ths opportunity to give foobar a try but quickly dropped it since I didn’t like the interface and installing skins didn’t really work for me. But while looking for skins I found out about AIMP. I’ve never heard of it but I found a cool skin for it and it offers a lot of customization while staying very light weight (at least in terms of RAM usage).

So this is what my current installation looks like:

Classic shell and AIMP with the ncmpcpp skin

That’s basically it. We’ll see how long I can stick with it until I get annoyed or maybe to my surprise I’ll actually stay who knows.

Styling Firefox

A while ago I found out about the firefox addon stylish. It’s an addon that allows you to change the look of your browser and specific websites. Unlike themes it can completely redecorate almost all elements like the url bar, bookmark bar etc.

A small side note: The addon has sadly been bought by a big company. This is not the first time this has happened to an addon, but sadly this means using the addon will send information to that company, since that’s pretty much the only reason they bought it. Currently this is only enabled in chrome and can be disabled under the settings. An update for firefox will probably follow at some point, but I doubt that the option to disable the information collection is here to stay. So use this addon only if you’re okay with sharing some of your data (which I am not). There’s an alternative for chrome called StyleRRR (Chrome/Firefox).

On userstyles.org you can browse website and browser styles. I for one installed DarkTube so the YouTube design is easier on the eyes. So yeah with stylish you can have dark themes for most popular websites which don’t natively support it.

YouTube with the DarkTube theme

So since only making YouTube darker is kinda lame i also wanted firefox to be more darkish and more flat. So after some searching I came across powerline. Which is pretty cool, but the theme doesn’t include the bookmark bar nor the addon icons. But with my amazing css skills and some googling I modified powerline to fit my needs.

Firefox with my modified version of powerline

So as you can see Firefox is now entirely dark themed. The tabs look a little bit like those from chrome and they take up 100% of the window width, devided evenly to all open tabs. The url is centered at the top and on right are the icons from my addons. It’s not perfect but it does the trick.

So if you want to try my version you can get it here. Just copy the css text, make a new style under about:addons and paste in the text.