October 6, 2017

FFMpeg

If your looking for a powerful multimedia framework check out FFmpeg. It's a powerful command line utility that has a strong user base and easy to learn.

ffmepg doesn’t have a fancy user interface, which may turn away some users. I believe It worth learning FFmpeg because you'll learn more about creating multimedia files.

Three Examples

Show MetaData

Find out some MetaData on your multimedia file. Here's what information that Quicktime and Finder shows:

Finder Metadata

This is what FFmpeg displays when you run the command:

ffmpeg -i

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/MONOCARPOUS/Computers/2003/3.17.03/done/mitt.mov':
  Metadata:
    creation_time   : 2003-03-16T05:31:43.000000Z
    encoder         : Encoded with Cleaner 5
    encoder-eng     : Encoded with Cleaner 5
  Duration: 00:00:30.06, start: 0.000000, bitrate: 491 kb/s
    Stream #0:0(eng): Video: svq1 (SVQ1 / 0x31515653), yuv410p, 320x240, 442 kb/s, 15 fps, 15 tbr, 600 tbn, 600 tbc (default)
    Metadata:
      creation_time   : 2003-03-16T05:31:43.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : Sorenson Video
    Stream #0:1(eng): Audio: qdm2 (QDM2 / 0x324D4451), 44100 Hz, mono, s16, 48 kb/s (default)
    Metadata:
      creation_time   : 2003-03-16T05:31:43.000000Z
      handler_name    : Apple Alias Data Handler

Convert old .MOV to the latest .MP4 standards

This is a basic functionality of FFmpeg. The core command is:

ffmpeg -i filename.mov filename.mp4

A more advance example would be:

for FILE in *.swf; do ffmpeg -i "$FILE" "${FILE[@]/%swf/mp4}"; done;

That will convert all Flash SWF files in a directory to the industry standard h264 format. This is very useful to view Flash video if you don't have a Flash player.

As you learn more about the FFmpeg, you'll understand which compression will work for your multimedia and distribution method.

Create a Looping File

Let's say you have a howling wolf audio clip and you wanted to have a longer version. Here's an example of how you would go about doing that using FFmpeg.

ffmpeg -stream_loop 4 -i howl.mp3 -c copy howl4.mp3

Real Video Files

I thought I might be interesting to see if FFmpeg would convert some old Real Media files to MP4. I tested converting a couple of Real Video and Real Audio files, some that you can see on this site, and they converted from Real Video 10 to H264 successfully.

Stream #0:1 -> #0:0 (rv10 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (ac3 (native) -> aac (native))

The video quality was bad. However, it was probably because when I encoded it I went for the smallest file size as possible.

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!