# Rendering Video Special Effects in GLSL
Rendering real-time, hardware accelerated 3D graphics is one aspect of computer graphics, but there are others too. Recently I became interested in video editing. I wanted to add some special effects to a video and was looking for a technology to do that. Of course video editing software usually has some effects built-in, like different filters or transition effects, some borders or gradients. But I wanted something different. If I had and I knew how to use software like Adobe After Effects, I'm sure that would be the best and easiest way to make any effect imaginable. But as I don't, I decided to use what I already know - to write a shader :)
1. To run a shader, some hosting app is needed. Of course I could write one in C++, but for the purpose of this work it was enough to use Live Coding Compo Framework (a demoscene tool created by bonzaj, which was used during last year's WeCan demoparty). This simple and free package contains rendering application and preconfigured Visual Studio solution. Having VS installed (it works with Express version as well), all I needed to do was to edit "Run.bat" file to point to directory with VS installation in my system. Next, I just executed "Run.bat", and two programs were launched. On the left monitor I had fullscreen "Live Coding Preview", on the right: Visual Studio with special solution opened. I could then edit any of the GLSL fragment shaders contained in the solution. Every time I hit Compile (Ctrl+F7), the shader was compiled and displayed in the preview.
2. Being able to render my effect in real-time, next I needed to capture it to a video. Probably the most popular app for this is FRAPS. I ran it, set Video Capture Settings to frame rate that I was going to use in my final video (which was 29.97 fps) and then captured appropriate period of time of rendering my effect, starting and stopping recording with F9 hotkey.
3. Video captured by FRAPS is in full, original resolution and encoded with some strange codec, so next I needed to convert it to desired format. To do this, I used VLC media player. Some may think that it's just a video player, but in fact it's incredibly powerful and flexible video transmitting and processing software. (I once had an opportunity to work with libVLC - its features exposed as C library.) Its greatest advantage is that it has its own collection of codecs, so it doesn't care whether you have appropriate codecs installed in your system. To convert a video file, I selected: Media > Convert / Save..., selected my AVI file captured by FRAPS, pressed "Convert / Save" button, selected Profile: "Video - H.264 + MP3 (MP4)", customized it using "Edit selected profile" image button, selecting: Encapsulation = MP4/MOV, Video codec = MPEG-4 (on Resolution tab, I could also set new resolution to scale the content, my choice was 1280px x 720px), Audio disabled, Subtitles disabled. Then after pressing "Save", selecting path to destination file, pressing "Start" and waiting some time, I had my video converted to more standard MPEG-4 format (and more than 5 times smaller than the original one recorded by FRAPS).
4. Finally I could insert this video onto a new track in my video editing software and enable blending with underlying layer to achieve desired effect (I used "Overlay" blending mode and 50% opacity).
There are some details that I intentionally skipped here (like video bitrate) not to make this post even longer, but I hope you learned something new from it. My effect looked like this, and here is the source code: Low freq fx.glsl
By the way, here is another tutorial about how to make GIF like this from a video (using only free tools this time):
1. To capture video frames as images, use VLC media player:
2. To merge images into animated GIF, use GIMP:
# Pixel Heaven 2014 - My Photos
Here is the gallery of my photos from Pixel Heaven 2014:
# Pixel Heaven 2014 - My Impressions
31 May - 1 June I've been in Warsaw on Pixel Heaven. As I haven't been on previous edition, I didn't really know what to expect. Timetable was full of various activities - lectures, competitions or just opportunities to play some games. Would it be only about retro games, or also modern games? Only about indie games, or AAA games too? Is it more for gamers, or for professional game developers? What about demoscene? Either way, I decided to go there.
I'm not really into these retro platforms, so I planned to go listen to lectures about indie game development. I've seen and heard many interesting stuff there, like Adrian Chmielarz from The Astronauts presenting their game - The Vanishing of Ethan Carter - for the first time!
But as it turned out, I met so many interesting people there (some of them I haven't seen for years) that I've spent most of the time talking with someone :) It's a coincidence that just recently I've heard stories of several people who work for many (some more than 10) years in just one company. Very often that's their first job after graduating university. They speak with confidence like they know a lot about doing career. Surely after all these years they were promoted many times. But at same time, I think sometimes such people preceive possibilities and limitations of their job as something obvious, its rules as something critically important, like it was whole world. I don't think it's good attitude and I want to avoid that.
On the other hand, noone can try in his life every possibility in terms of work and career. For example, someone who already has a house and spouse and children and mortgage many not be willing to move to different city or country or try to make his living from doing a startup or indie gamedev studio. That's why I think it's so important to talk to many different people and hear their stories. Knowing how working for some other company looks like, whether your competition or in completely different business, or how totally different may someone's work and lifestyle be (e.g. freelancing, working from home, being a consultant, traveling to different countries to do different projects, making a startup) is mind-expanding because it makes you think about your own career with all its pros and cons in the context of bigger picture of what's possible.
Back to the Pixel Heaven, I recommend this party to anyone who is interested in either retro games or indie games. There is a lot of things to do all the time so noone should be bored.