This chapter aims to take a humorous and unusual approach to explain some fundamentals of how video encoding works. We aim to do this by entering the slightly crazy world of Datamoshing.
By the end of this task you should be able to:
- Share the joys of Datamoshing
- Understand how I frames and P frames are used for video compression
- Start to alter video encoding parameters using advanced tools
Tools you will need for this task:
- Internet Connection
- Avidemux - available for Mac, Linux & Windows
- ffmpeg - available for Mac, Linux & Windows
Datamoshing refers to a particular way of breaking video files so that they look strange. This is normally done for entertainment in videos like music videos.
The process of creating a datamosh involves some understanding of processes in video encoding including i-frames, p-frames and the concept of motion tracking.
The following videos show you how to do datamoshing and gives you the chance to try hands on manipulation of video files. So here's part two.
and part three.
Tips on finding suitable clips
You can use openly licensed video or as you are using clips and sharing for educational use, you can be a more free about the clips you use.
Using Avidemux for simple datamoshing
The how to video is aimed at people using Mac computers. It mentions two main bits of software. Avidemux and FFmpegX.
Avidemux is available for Mac, Linux and Windows. There is a FLOSS Manual on it here. It is easy to install. However, FFmpegX is only available for Mac and it is pretty tricky to install. So we were a bit worried you may get stuck.
Luckily, we can achieve a datamosh using only Avidemux (part 3 of the video) as long as we delete all I frames in the clips (apart from the first one). To do this following these steps.
- Open a clip in Avidemux
- If needed add another clip using File > Append in Avidemux
- Remove parts of the video so you have a short clip which cuts between suitable scenes with the right kind of motion. Try out different ones.
- Remove the Iframes from all your video, by manoeuvring to key frames with the double-arrows, setting in and out points one frame part and deleting the selected I-frame.
- Save to a new video file using the follow settings
TIP: You may need to resize clips to be able to combine them in Avidemux. There is help on how to do that here.
Introduction to command line tools (optional)
As you can see from the above example, removing the I frames of a longer video file using Avidemux would be very time consuming. If we were going to create a longer example we would want a tool which removed I frames all at once.
There is a really easy way to achieve this using the command line application ffmpeg. ffmpeg is easy to install on a on a Linux computer. The video tutorial mentions FFmpegX which is a front end for ffmpeg. Unfortunately this tool is for Mac only, and you may find it difficult to install.
So this seems like a good point in the course to give you the option of taking the next step in working with open video. This is step is to start to alter files using a command line application like ffmpeg. Later tasks in part two of this course take the use of ffmpeg much deeper. This is a good task to get you started.To reduce / remove keyframes use the following command as an example
ffmpeg -i inputfile.flv -g 500 -acodec libmp3lame outfile.avi
the -g option specifies keyframes. You will get an error if you set this too high try this with ffmpeg (999 is still very high but gives no fatal error). Your outputted files now have very few i-frames. We also set the audio codec used to be mp3.
After this you will find the process of creating a datamosh in Avidemux much quicker as there will be almost no I frames in your source video files.
Here are Instructions for installing on Windows and a tip for an easy way to install on Mac and Ubuntu & Debian. If you get stuck we may not be able to help but put your problem in the comments and we'll try to steer you in the right direction.
Task - Get moshing & earn a badge
The fun assessment task for this chapter is to either create a quick datamosh example and post it to a video sharing site to share with us in the comments.
When you have created your mosh you can apply for your "I looked at Open Video" badge.
If you get stuck. We are aware that this is quite a hard task. Hey you do get to earn a badge, after all. If you get stuck post in the comments and we will try to help you with the specifics of your problem. This is what peer learning is all about.