As a side interest, I've become curious about video and audio encoding. I've been looking into the many different flavors of encoding there are, and attempting to determine the best way forward. This is purely selfish as I have a collection of videos that are taking up too much space and I want to make them smaller, but also keep as much detail as possible.
Getting more to the point, my primary system is a Windows desktop with NVidia graphics card. While I was able to encode videos using Linux, the machine running Linux was either a Virtual Machine or a laptop. Either way, performance for encoding was not great. I wanted to not only get my much stronger desktop involved, but also utilize the graphics card. I was previously using HandBrake, which is a neat application. However, I wanted more control over what was happening, and also just get a bad vibe from that tool (and don't want it running on my primary system). One of the most well known and respected tools in this area is ffmpeg. If you haven't looked at it, I'd highly recommend reading their docs. Really cool stuff.
Anyway, ffmpeg doesn't have Windows binaries for download. There is a site called Zeranoe that has builds that they've compiled if you're willing to trust them. Further, default compile options do not include NVENC (NVidia's current hardware accelerated encoding offering) by default so it's unclear if Zeranoe's version would have that support. While I do have a Visual Studio install, I thought cross compiling would be easier. Plus, I <3 Linux so I'm used to compiling my own stuff. What follows are my steps for cross compiling ffmpeg with basically full support for NVENC and most other options baked in.
First off, I followed this article (https://trac.ffmpeg.org/wiki/CompilationGuide/CrossCompilingForWindows). It was actually not entirely accurate as I will show. The operating system I used was Ubuntu 15.10. These instructions will likely work on other OSes, with some minimal changes.
First off, you don't actually have to install mingw gcc, as the github script actually builds the latest for you in a "sandbox" (really just a temporary directory).
- Ensure your firewall outbound allows FTP And HTTP (and if you're not restricting outbound, you really should)
- Create a temporary directory for your install
- mkdir -p ~/opt/ffmpeg-cross-compile
- Get the script (https://github.com/rdp/ffmpeg-windows-build-helpers)
- cd ~/opt/ffmpeg-cross-compile
- wget https://raw.github.com/rdp/ffmpeg-windows-build-helpers/master/cross_compile_ffmpeg.sh -O cross_compile_ffmpeg.sh
- This script is awesome. It does all the work for you!
- Run it!
- chmod u+x cross_compile_ffmpeg.sh
- Answer any questions it asks.
That's really all there is to it. Note, it will take a while. I think mine took about 45 minutes to complete on my laptop. The script will go get the latest version of ffmpeg and dependencies and compile everything for you. It automatically compiles in NVENC support, as well as most other encoders/decoders (including the ever loved AAC!). At the end of it's compiling (mine didn't throw any errors), you should have your binaries under ~/opt/ffmpeg-cross-compile/sandbox/x86[_64]/ffmpeg_git_with_aac. These will include ffmpeg.exe, ffplay.exe, and ffprobe.exe.
Note that these are all statically compiled, meaning you should just be able to copy them over to a windows box and have fun!