Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
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.
Visual walkthrough of the process.
DIY
The geeky details...
Part 1 - Brief Walkthrough
Convert video file to a sequence of pictures with a video editor:
Convert sequence of pictures to a special container file using PNGtoCSV:
Like the step above, convert the music file to a special container file using FrequencyDump:
Create a dataset for Visual Intelligence, refresh the data, take a screenshot, and repeat:
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
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:
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.
Create a Scatter Chart in Visual Intelligence using the Visual Intelligence Data Source.csv file as the dataset with the following Attributes and Measures:
Double-click 1. Convert Images.bat. This will convert the pictures within the SAP Lego folder to a container file, named container.mcsv.
Double-click 2. Capture Screenshots.bat and QUICKLY switch back to Visual Intelligence. Be patient, this process will take about ten minutes.
After about ten minutes, you will see a bunch of screenshots of Visual Intelligence in the VI Screenshots folder.
Start a new Movie Maker project.
Import all the pictures in the VI Screenshots folder into Movie Maker.
Set the duration of all images to 0.1. Hint: double-click an image, press Ctrl+A, then enter 0.10 in Duration.
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.
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
Place PNGtoCSV.jar file on your desktop.
Open Command Prompt. Go to Start > All Programs > Accessories and select Command Prompt.
In the Command Prompt, type: cd %HOMEPATH%\Desktop
Press the Enter key.
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.
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
Place frequencydump.jar file on your desktop.
Open Command Prompt. Go to Start > All Programs > Accessories and select Command Prompt.
In the Command Prompt, type: cd %HOMEPATH%\Desktop
Press the Enter key.
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.
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:
Read file generated by the modified FrequencyDump program.
Periodically update a CSV file for use with Visual Intelligence
Send a Control+R keystroke to refresh Visual Intelligence
Takes a screenshot
Creating sample data file for Visual Intelligence using SendControlRAndCaptureScreen.jar in Windows
Place SendControlRAndCaptureScreen.jar on your desktop.
Open Command Prompt. Go to Start > All Programs > Accessories and select Command Prompt.
In the Command Prompt, type: cd %HOMEPATH%\Desktop
Press the Enter key.
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
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%\Desktoppress enter
java -jar SendControlRAndCaptureScreen.jar dump.fs output.csv -count 1press enter
Thank You
Thanks for your interest and a big thank you to those organizing the Data Geek challenge!