Currently Being Moderated
Brandon Law

Making of Gangnam Geek

Posted by Brandon Law in SAP Lumira on Nov 2, 2012 2:47:54 AM

Overview

 

In this blog, I would like to show you how I made the Gangnam Geek video. It is the result of expanding what I had worked on for my first entry to The Data Geek Challenge.
I have broken this blog down to three parts.
  1. Visual walkthrough of the process.
  2. DIY
  3. The geeky details...

Part 1 - Brief Walkthrough

Convert video file to a sequence of pictures with a video editor:
ConvertVideoToPNG.png
Convert sequence of pictures to a special container file using PNGtoCSV:
ConvertPNGtoContainer.png
Like the step above, convert the music file to a special container file using FrequencyDump:
ConvertMusicToContainer.png
Create a dataset for Visual Intelligence, refresh the data, take a screenshot, and repeat:
RefreshAndTakeScreenshots.png
After this process, I ended up with a bunch of screenshots (6,000+) which I put together using a video editor in order to turn that into a stop motion animation.

Part 2 - Try It Yourself!

In this section, you can try it yourself! The programs I wrote to create these visualization were rather crude and far from straight forward to use. In my effort to make it more accessible to you, I have created a DIY package to demonstrate the steps I described in Part 1. The idea for the waveforms are the same, but I will save that for Part 3 for the sake of simplicity.
Requirements:
  • Visual Intelligence
  • Java Runtime Environment
  • Movie Maker or some video editor capable of stop motion animation
  1. Download the DIY Package.
  2. Extract the zip file - be sure to retain all the folders that are included in the zip file! The extracted contents will look like this:
DIYPackage.png
SAP Lego.mp4 is the video we would like to have Visual Intelligence play. This video will need to be converted to a sequence of black and white images before we can continue. There are no built in programs that will do this in Windows, so I converted it for you; the results of the conversion are in the SAP Lego folder.
  1. Create a Scatter Chart in Visual Intelligence using the Visual Intelligence Data Source.csv file as the dataset with the following Attributes and Measures:
VIConfig.png
  1. Double-click 1. Convert Images.bat. This will convert the pictures within the SAP Lego folder to a container file, named container.mcsv.
  2. Double-click 2. Capture Screenshots.bat and QUICKLY switch back to Visual Intelligence. Be patient, this process will take about ten minutes.
  3. After about ten minutes, you will see a bunch of screenshots of Visual Intelligence in the VI Screenshots folder.
  4. Start a new Movie Maker project.
  5. Import all the pictures in the VI Screenshots folder into Movie Maker.
  6. Set the duration of all images to 0.1. Hint: double-click an image, press Ctrl+A, then enter 0.10 in Duration.
  7. Press Play!
Otherwise, if I have not bored you to death yet, please continue to Part 3!

Part 3 - Geeky Side

For this project, I had to modify an existing piece of open source software and write two of my own. I whipped them out rather hastily for this project, so my apologies for the awful usability and possible bugs.

Program 1 - PNGtoCSV

I originally wrote PNGtoCSV for my first Data Geek entry. I have since modified it to convert multiple .png files at once to generate the animation for the music video.
Using PNGtoCSV.jar in Windows
  1. Place PNGtoCSV.jar file on your desktop.
  2. Open Command Prompt. Go to Start > All Programs > Accessories and select Command Prompt.
  3. In the Command Prompt, type: cd %HOMEPATH%\Desktop
  4. Press the Enter key.
  5. In the Command Prompt, type: java -jar PNGtoCSV.jar <input> <output>
<input> - This can be one .png file or a folder of .png files.
<output> - It will generate a .csv file if it is given a single picture. It will generate a .mcsv file, for use with SendControlRAndCaptureScreen, if given a folder of pictures.
  1. Press the Enter key.

Program 2 - FrequencyDump

Frequency Dump is a neat open source program that draws a real-time frequency spectrum while it plays an audio file. I made some modifications so that it would save the frequency spectrum information in the form of a text file.
The original project and source code can be found at their SourceForge page.
Using frequencydump.jar in Windows
  1. Place frequencydump.jar file on your desktop.
  2. Open Command Prompt. Go to Start > All Programs > Accessories and select Command Prompt.
  3. In the Command Prompt, type: cd %HOMEPATH%\Desktop
  4. Press the Enter key.
  5. In the Command Prompt, type: java -jar frequencydump.jar <mp3 file> <samples/second> <distribution> <output file>
Where:
<mp3 file> - Path and name of your music file.
<samples/second> - Number of spectrum samples per second. 15 samples/second is recommended.
<distribution> - This can be either LINEAR or LOG. LINEAR will distribute the frequency bands evenly. LOG will place more emphasis on the low frequency bars.
<output file> - Path and name of your output file, to be used with SendControlRAndCaptureScreen.
  1. Press the Enter key.
For example, if you had an mp3 named test.mp3 on your desktop and you would like to dump into a file called dump.fs, you would type the following in Command Prompt:
cd %HOMEPATH%\Desktop press enter
java -jar frequencydump.jar test.mp3 15 LOG dump.fs press enter

Program 3 - SendControlRAndCaptureScreen

The SendControlRAndCaptureScreen program does the following:
  1. Read file generated by the modified FrequencyDump program.
  2. Periodically update a CSV file for use with Visual Intelligence
  3. Send a Control+R keystroke to refresh Visual Intelligence
  4. Takes a screenshot
Creating sample data file for Visual Intelligence using SendControlRAndCaptureScreen.jar in Windows
  1. Place SendControlRAndCaptureScreen.jar on your desktop.
  2. Open Command Prompt. Go to Start > All Programs > Accessories and select Command Prompt.
  3. In the Command Prompt, type: cd %HOMEPATH%\Desktop
  4. Press the Enter key.
  5. In the Command Prompt, type java -jar SendControlRAndCaptureScreen.jar <input file> <outputfile> -count 1
Where:
<input file> - Path and name of the output file generated with the modified frequencydump.jar.
<output file> - Path and name of the data file for Visual Intelligence
  1. Press the Enter key.
For example, using the dump.fs generated using the modified frequencydump.jar above to create output.csv, type the following in Command Prompt:
cd %HOMEPATH%\Desktop press enter
java -jar SendControlRAndCaptureScreen.jar dump.fs output.csv -count 1 press enter

Thank You

Thanks for your interest and a big thank you to those organizing the Data Geek challenge!

Comments

Actions

Filter Blog

By author:
By date:
By tag: