# Install-Instructions#windows - tips



## pantonvich (Mar 4, 2016)

https://github.com/jp9000/obs-studio/wiki/Install-Instructions#windows

this might save the next person some time:

1. I didn't understand that the dependencies.zip file already included FFmpeg, x264 etc as there isn't a folder with those names. I figured it out by looking at the FFmpeg dev folder and seeing the folders that matched the dependencies i.e. libavcodec etc

2. I had no clue on cMake variables:

in the CmakeLists.txt I added the following after the project(obs-studio)  - note I unzipped the dependencies.zip file into C:/obs-studio/dependencies/

set(DepsPath "C:/obs-studio/dependencies/win32")
set(FFmpegPath "C:/obs-studio/dependencies/win32")
set(x264Path "C:/obs-studio/dependencies/win32")
set(curlPath "C:/obs-studio/dependencies/win32")
set(LibfdkPath "C:/obs-studio/dependencies/win32")
#set(DISABLE_UI TRUE)
set(QTDIR "C:/Qt/5.5/msvc2013")
set(CMAKE_PREFIX_PATH "C:/Qt/5.5/msvc2013/lib/cmake")​read next post

Note - at first I was getting this error from VS2013 as the default installs for QT is"msvc2012" and "msvc2013_64" but you need "msvc2013"

  Error    2    error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in platform-windows.obj


----------



## RytoEX (Jul 20, 2016)

This post helped me complete the setup for building OBS on Windows.  I had to do a few things differently to get it working for me.  I'll try to outline the steps I took, but this will be partly from memory, so I may miss some details.  I used the instructions here in conjunction with the post above to do this.

For background, I'm working on a Windows 10 64-bit system, and I'll assume you already have git installed and configured.  I will include instructions for getting set up to build 32-bit or 64-bit OBS Studio from 64-bit Windows.  On a 32-bit Windows system, the steps may be a bit different.

Install Microsoft Visual Studio 2013 or 2015.
I installed Microsoft Visual Studio Community 2015 (currently Version 14.0.25422.01 Update 3), so these steps will reflect that choice.  You may choose another up-to-date version of Visual Studio 2013 or 2015.
Please note that VS Community 2015 comes with a 30-day trial.  It is still free to use after that trial ends, but you must sign in with a Microsoft Account to continue using it.

Get the pre-built obs-studio dependencies.
Since I installed VS2015, I got the VS2015 dependencies.  We'll say these are extracted to: C:\obs-dev\deps

Install Qt
Download the installer for the current version of Qt5 Open Source (currently Qt 5.7).
While running the installer, make sure to select "msvc2015 64-bit" and optionally "msvc2015 32-bit" if you intend to build 32-bit versions (or the appropriate component for your Visual Studio version and architecture).
We'll assume Qt is installed to: C:\Qt

Install CMake for Win64.
Clone obs-studio git repo (git clone --recursive https://github.com/jp9000/obs-studio.git).  We'll say the local path is: C:\obs-dev\obs-studio
Create build directories inside C:\obs-dev\obs-studio:  build32; build64; debug32; debug64; release32; release64
Edit C:\obs-dev\obs-studio\CMakeLists.txt right after "project(obs-studio)" (currently between lines 3 and 5) to add:
set(DepsPath "C:/obs-dev/deps/win64")
set(FFmpegPath "C:/obs-dev/deps/win64")
set(x264Path "C:/obs-dev/deps/win64")
set(curlPath "C:/obs-dev/deps/win64")
set(QTDIR "C:/Qt/5.7/msvc2015_64")
Don't edit the CMakeLists.txt file, per @Osiris.

Run CMake (cmake-gui)
For "Where is the source code:", put "C:/obs-dev/obs-studio"
For "Where to build the binaries:"...
If you're building 32-bit OBS Studio, put "C:/obs-dev/obs-studio/build32"
If you're building 64-bit OBS Studio, put "C:/obs-dev/obs-studio/build64"

Setup your Make/configuration variables.
If you did not use or do not want to use system variables for this, you can set these up in CMake.
Add the following variables by clicking the "Add Entry" button (use the variable type "PATH"; variable data is presented below in the format VariableName: VariableValue):
For 32-bit OBS Studio:
DepsPath: C:/obs-dev/deps/win32
QTDIR: C:/Qt/5.7/msvc2015
For 64-bit OBS Studio:
DepsPath: C:/obs-dev/deps/win64
QTDIR: C:/Qt/5.7/msvc2015_64
Or, if you intend to build both 32-bit and 64-bit versions:
DepsPath32: C:/obs-dev/deps/win32
DepsPath64: C:/obs-dev/deps/win64
QTDIR32: C:/Qt/5.7/msvc2015
QTDIR64: C:/Qt/5.7/msvc2015_64

Click the "Configure" button.
At this point, CMake may ask you to specify a generator.  If you've installed the same versions as I've outlined above, then...
To build 32-bit OBS Studio, select "Visual Studio 14 2015"
To build 64-bit OBS Studio, select "Visual Studio 14 2015 Win64"
Leave the rest of the options alone.  If you installed a different version of Visual Studio, check the version of Visual Studio you installed and select the corresponding entry here.  Click the "Finish" button to continue.
You probably have some time to kill, so get a drink or snack, or read something for a bit.
Once CMake is done configuring, enable the "COPY_DEPENDENCIES" option.
Click the "Configure" button again.  This time, it should only take a few seconds.
Once CMake is done configuring again, click the "Generate" button.

If you're building 32-bit OBS Studio, open "C:\obs-dev\obs-studio\build32\obs-studio.sln" in Visual Studio.
If you're building 64-bit OBS Studio, open "C:\obs-dev\obs-studio\build64\obs-studio.sln" in Visual Studio.

This should successfully open the project in Visual Studio.  CMake does still display two red entries:
COPIED_DEPENCIES:  enabled
Libavcodec_DIR:  Libavcodec_DIR-NOTFOUND​
I'm pretty sure the first one is intended, but I'm not sure about the second one.

If anyone knows that I've made a mistake here, please feel free to give advice on what was done wrong and how to fix it.  Similarly, if anyone knows anything about that second red CMake entry, please feel free to let me know.


EDIT (September 19, 2016):  I've made a bunch of updates to these instructions.
Changes:

Added details for building 32-bit OBS Studio (Thanks goes to Jim for helping me with that!)
Updated links to the dependencies
Changed formatting
Changed wording


----------



## Osiris (Jul 20, 2016)

Editing CMakeLists.txt is not needed and not recommended. You either use environment variables or you add them through cmake-gui.

You can also put 32 or 64 behind the variable names and have them point to their respective dependencies, that way you can build both 32-bit and 64-bit obs-studio (ofcourse in seperate build folders).


----------



## RytoEX (Jul 20, 2016)

Osiris said:


> Editing CMakeLists.txt is not needed and not recommended. You either use environment variables or you add them through cmake-gui.
> 
> You can also put 32 or 64 behind the variable names and have them point to their respective dependencies, that way you can build both 32-bit and 64-bit obs-studio (ofcourse in seperate build folders).



Ahh, that's good information!  The existing instructions weren't clear about the preferred method for creating cmake variables, and searching the Internet for info on how to do that yielded information resembling the CMakeLists.txt edits from the first post.  I'll adjust my workflow accordingly.  Is there a way to import multiple CMake variables via cmake-gui rather than environment variables?

When you say to put the 32 or 64 behind the variable names, do you mean like this (ignoring the syntax)?

DepsPath32:"C:/obs-dev/deps/win32"
QTDIR32:"C:/Qt/5.7/msvc2015"
DepsPath64:"C:/obs-dev/deps/win64"
QTDIR64:"C:/Qt/5.7/msvc2015_64"


----------



## Osiris (Jul 20, 2016)

You can just add variables through cmake-gui.

And yes, those variables are correct.


----------



## RytoEX (Jul 20, 2016)

Osiris said:


> You can just add variables through cmake-gui.
> 
> And yes, those variables are correct.



I apologize, I asked my question incorrectly.  Is there a way to add multiple variables en masse all at once, aside from environment variables?  I'm guessing no, but I thought I'd ask.

Great!  I'll try to redo the setup with variables like that made in cmake-gui.  Do I need to alter the build-path in cmake-gui to omit the 32/64 and let CMake produce two separate builds, or does that not matter?


----------



## Daze (Jul 22, 2016)

Thank you very much RytoEX. That explanation helped finally build t he source :)


----------



## E.K.G (Aug 23, 2016)

In my experience, I also need to add Qt5 bin path into Windows system variable PATH: \YOUR_QT5_PATH\msvc2015_64\bin, otherwise it will keep saying Qt5*.dll is missing.


----------



## Jack0r (Aug 23, 2016)

Well Rytoex simply adds those folders as variables in cmake. (Step 8.3) Either way, cmake should be able to find them afterwards.


----------



## aecium (Jan 11, 2017)

Thank you very much for the instructions RytoEX with the additional details I now have a working build environment for OBS Studio


----------



## RytoEX (Jan 12, 2017)

aecium said:


> Thank you very much for the instructions RytoEX with the additional details I now have a working build environment for OBS Studio


Glad the instructions helped!


----------



## VinnyJ (Feb 10, 2017)

While trying this out, because eventually I wanted to get my feet wet with making plugins down the line.

This works with msvc2017 RC, almost as-is.

Since I've only tried this with 64-bit.
Cmake generator is set to "Visual Studio 15 2017 Win64"

Used Qt 5.8, qalgorithms.h needs this patch. , otherwise VS will mention over 400+ errors.

QSV_Encoder.cpp in \plugins\obs-qsv11\ needs a line added:
 #include <intrin.h>

or it says something about undeclared "__cpuid" identifier


----------



## Racer Andy (Feb 12, 2017)

Thank you RytoEX and pantonvich!!! this helped me get it going! I wish there was a link to this thread on this page
https://github.com/jp9000/obs-studio/wiki/Install-Instructions
I was stuck and this thread got me the rest of the way through the process. I now have a running build environment and have compiled OBS studio for the first time myself !!!


----------



## RytoEX (Feb 12, 2017)

VinnyJ said:


> While trying this out, because eventually I wanted to get my feet wet with making plugins down the line.
> 
> This works with msvc2017 RC, almost as-is.
> 
> ...


If Qt 5.8 requires a patch to work correctly with VS2017, that should probably be submitted to the Qt development team.




Racer Andy said:


> Thank you RytoEX and pantonvich!!! this helped me get it going! I wish there was a link to this thread on this page
> https://github.com/jp9000/obs-studio/wiki/Install-Instructions
> I was stuck and this thread got me the rest of the way through the process. I now have a running build environment and have compiled OBS studio for the first time myself !!!


Glad the additional instructions could help!


----------



## greatimon (Nov 7, 2018)

Thank you so much *RytoEX. It helped a lot to me!*


----------

