Working with multimedia files - Part 1: Flash - Tutorial


Updated: December 3, 2008

Tasks for today: download, play and convert Flash files, extract music clips from Flash files, manipulate ShockWave Flash files, and tag Flash videos.

This is the first of the three articles on how to use and manipulate multimedia formats: Flash, video and audio. In this first article, we will concentrate on Flash files: how to download them from websites, how to convert them from one format to another, say .flv to .swf or .avi, how to extract music from Flash movies, and several more cool tricks.

In the second article, we will talk about video files: splitting and joining them, changing encoding and compression, fixing bitrate discrepancies in audio and video, and other tasks. In the last article, we will manipulate audio files: convert between different music formats, like .mp3, .ogg, .wav, and others, mix sounds, compose custom pieces by splicing segments from different tracks, and more.

On top of all that, we will also talk about useful multimedia programs that can help us in our common daily tasks, namely audio and video recording software. Best of all, everything I'm going to show is free. Last but not the least, we will see examples for both Windows and Linux. So let us begin.

Table of contents:

  1. Flash content
    1. Download Flash
    2. Playing Flash content
    3. Extract audio from Flash movies
    4. Extract audio from online streams
    5. Convert Flash (.flv) to another video format (like .avi)
    6. Manipulate Shockwave Flash (SWF) files
    7. Manipulate Flash Video File (FLV) MetaData with FLVTool2
  2. Summary
  3. Conclusion

Flash content

We encounter Flash content quite a lot. There are entire websites created with Flash. You have Flash games. Recently, one of the most popular formats to stream video and audio online has become, take a wild guess, yes, correct - Flash. A website almost synonymous with Flash is - no surprise here - Youtube, which contains an endless collection of Flash clips, just waiting to be seen. And sometimes, downloaded, too.

To be able to watch Flash content inside your browser, you will require a Flash plugin. Installing it on Windows is rather trivial. On Linux, truth to be told, the task is as easy, but quite a few people are not familiar with the procedure. If you need to know how to install a Flash player inside your browser, please check this tutorial.

Download Flash

After a mini-gathering with some of my friends and acquaitances, I was amazed to discover that quite a few people do not know that Flash movies on Youtube - and other sites - can be downloaded and later enjoyed on the local machine. So, first, let's see how we can download Flash content from the Internet. To this end, we will need the following:

  1. Web browser: Firefox
  2. Firefox extension called Video DownloadHelper

If you need help with Firefox extensions, please refer to my article Firefox Add-ons - Manage browser add-ons in centralized manner - Tutorial. After DownloadHelper extension is installed you will get a new icon in your browser, similar to the rightmost one in the below screenshot:

DownloadHelper inactive

Whenever there's Flash content available for download, the icon will turn active; it will become bigger and colored (yellow, red, blue), similar to what you see below:

DownloadHelper active

So, on Youtube, or any other webpage you wish to download Flash content from, click on the small down-arrow to see what choices you have.

DownloadHelper download file

And that's it. After you download the file, it's on your computer! It will be saved in the .flv (Flash video) format. You can now watch it any time you want. The question is, what with?

Playing Flash content

Windows users will soon learn that the Windows Media Player can't do the job. However, there's a number of alternative, open-source players that will. The simplest, most sensible choice is the VideoLAN (VLC) media player. Not only will it run an astonishing array of formats (including audio, DVD and whatnot) without requiring any additional codecs, it's light and simple - and cross-platform. It runs on both Windows and Linux (and other OS). Here's what it looks like on Windows XP:

VLC on Windows

And here's on Linux (Gnome, Ubuntu):

VLC on Linux

And here's me playing a downloaded Flash in it:

VLC working

Another choice for Windows users is the FLV Player (currently at version 2.0):

FLV Player

So, we've covered the watching part. What about the audio, though?

Extract audio from Flash movies

Let's say you like Miami Vice, like me. Let's say you love Jan Hammer's music, like me. So you have downloaded the Crockett's Theme clip, but you'd also love to have just the music track. No problems. This can be done, rather quite easily.

ffmpeg

homepage

This is the tool of the trade. I have used ffmpeg on several occasions, to create my Flash movies in the game article 1942: Pacific Air War or to extract music from the intro movie in my article UFO: Enemy Unknown.

Linux users will have ffmpeg quite often bundled into their distribution of choice. Windows users will have to download it separately. The easiest way to obtain the Windows version is from free-codecs.com. As always, when dealing with multimedia-related Windows stuff, like codecs, converters and such, do exercise the necessary caution. Now ...

ffmpeg is a command-line tool. It has many options, regarding to formats, bitrate, sampling etc, but we do not really need all that right now. If you want to extract high-quality audio from Flash (.flv) files, all you need to do is run the following command:

ffmpeg -i input.flv -ab 128 -ar 44100 output.mp3

The tool will take an input file (specified by the -i flag) in the .flv format and create an output in the .mp3 format, with 128-bit rate (specified by the -ab flag) and 44,100Hz sampling frequency (specified by the -ar flag - stands for audio rate). Here's the typical output of ffmpeg in action (on Windows):

ffmpeg working

Don't worry about the torrent of text. You need pay no attention to it. In the end, you'll have the desired audio file (in any format you like).

Extract audio from online streams

ffmpeg is a mighty tool. You can also use it to download audio from online streams, radio casts etc:

ffmpeg -i http:///xxx.xxx.xxx.xxx/something -ab 128 -ar 44100 sound.mp3

Convert Flash (.flv) to another video format (like .avi)

This is something you may want to do, for whatever reason. Again, ffmpeg can serve you well here. It's rather simple (even more so than audio):

ffmpeg -i input.flv output.avi

If you're not GUI-dependant and you're willing to invest some time learning all the tricks ffmpeg can do, it should be the one and only tool you will ever need to create and edit multimedia files. I do recommend you read the ffmpeg documentation.

Manipulate Shockwave Flash (SWF) files

OK, we've seen what we can do with "ordinary" Flash video (.flv). But what about those Flash files called .swf? What do we do about them. Again, not to worry. There's a whole range of goodies available.

SWFTools

homepage

SWFTools are a collection of excellent utilities that allow you to convert movies, pictures, even PDF files to SWF format. The usage is very similar to ffpmeg, so if you're comfortable with ffmpeg, you won't have any problems using any of the SWF Tools. For example, to convert an .avi file to a .swf file:

avi2swf input.avi output.swf

That's the whole of magic there's to it. You can download the entire bundle or use the tools individually. Linux users will also have the chance to download software through the Package Manager, if the enabled repositories contain it.

SWFTools in Synaptic

Manipulate Flash Video File (FLV) MetaData with FLVTool2

homepage

You may want to tag your FLV files, whether you downloaded them or created them on your own. Either way, FLVTool2 provides you with the required needs. Like ffmpeg and SWFTools, FLVTool2 is a command-line utility. Again, it's usage is very simple.

I have found the examples on yonder site to be quite useful. Furthermore, for more details, you may want to consider reading the man page. FLVTools2 can be found in many Linux distro repositories.

Summary

Here is the overview of tasks we just undertook: First, we download Firefox, in case you did not have it installed, shame on you. Then, we installed the Video DownloadHelper extension. Next, we download a Flash video in the .flv format. After that, we played it on our computer, either via VideoLAN (VLC) or FLV Player. After that, we extracted audio from the .flv file using ffmpeg. For fun, we also used ffmpeg to download online streams. We also played with Shockware Flash (.swf) files using a range of utilities called the SWFTools, which allowed us to convert a variety of files, including movies, pictures and even PDF documents to the SWF format. Lastly, we edited the meta data of FLV files.

Conclusion

Flash manipulation is easy and fun. It takes very little effort to get the job done. Don't be scared about the command line. After all, you only need to run 2-3 simple commands, which you don't even have to remember by heart. Just jump in here when you feel the need.

Soon, we will explore the video and audio manipulation, as promised. There's a whole lot coming, including splitting and joining videos, changing encoding and compression, fixing bitrate discrepancies, convert between different music formats, mixing sounds, splicing tracks, and more. Stay tuned!

Have fun!

RSS Feed icon

del.icio.us del.icio.us stumbleupon stumble digg digg reddit reddit slashdot slashdot



Advertise!

Would you like to advertise your product/site on Dedoimedo?

Read more

Donate to Dedoimedo!

Do you want to
help me take early retirement? How about donating
some dinero to
Dedoimedo?

Read more

Donate