Convert File Format with "ffmpeg" Command

This section provides a tutorial example on how to use the FFmpeg 'ffmpeg' command to convert multimedia file from MPEG4 format to SWF format and other formats.

The main command of the "FFmpeg" package is the "ffmpeg" command, which can be used to convert a movie file from MPEG4 format to SWF format. Again let's use the MPEG4 file, Tony_reel_2009_512kb.mp4, downloaded in the previous tutorial as an example.

C:\herong>\local\ffmpeg\bin\ffmpeg 
   -f mp4 -i Tony_reelshow_2009_512kb.mp4 
   -f swf Tony_reelshow_2009_512kb.swf

...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Tony_reelshow_2009_512kb.mp4'
 ...
 Duration: 00:03:11.80, start: 0.000000, bitrate: 580 kb/s

 Stream #0:0(und): Video: h264 (Constrained Baseline) 
            (avc1 / 0x31637661), yuv420p, 416x240, 512 kb/s, 
            25 fps, 25 tbr, 25 tbn, 50 tbc (default)
   ...
 Stream #0:1(und): Audio: "aac" (mp4a / 0x6134706D), 44100 Hz, stereo,
            fltp, 63 kb/s (default)
   ...

Output #0, swf, to 'Tony_reelshow_2009_512kb.swf':
 ...
 encoder         : Lavf55.40.100

 Stream #0:0(und): Video: flv1 (flv), yuv420p, 416x240, q=2-31, 
           200 kb/s, 25fps, 90k tbn, 25 tbc (default)
  Metadata:
   creation_time : 1970-01-01 00:00:00
   handler_name  : VideoHandler
   encoder       : Lavc55.63.100 flv
 Stream #0:1(und): Audio: mp3 (libmp3lame), 44100 Hz, stereo, 
           fltp (default)
  Metadata:
   creation_time : 1970-01-01 00:00:00
   handler_name  : SoundHandler
   encoder       : Lavc55.63.100 libmp3lame

Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> flv)
  Stream #0:1 -> #0:1 (aac -> libmp3lame)

Press [q] to stop, [?] for help
frame= 246 fps=0.0 q=10.0  size= 609kB time=00:00:09.84 bitrate=507.1
frame= 493 fps=493 q=28.8  size=1044kB time=00:00:19.74 bitrate=433.0
frame= 787 fps=525 q=30.5  size=1541kB time=00:00:31.52 bitrate=400.5
frame=1099 fps=549 q=20.2  size=2015kB time=00:00:44.01 bitrate=375.0
frame=1423 fps=569 q=18.9  size=2594kB time=00:00:56.97 bitrate=373.0
frame=1748 fps=583 q=31.0  size=3168kB time=00:01:09.98 bitrate=370.9
frame=2075 fps=593 q=31.0  size=3726kB time=00:01:23.01 bitrate=367.7
frame=2414 fps=603 q=17.2  size=4209kB time=00:01:36.62 bitrate=356.8
frame=2738 fps=608 q=31.0  size=4807kB time=00:01:49.52 bitrate=359.5
frame=3045 fps=609 q=31.0  size=5286kB time=00:02:01.83 bitrate=355.4
frame=3355 fps=610 q=31.0  size=5768kB time=00:02:14.24 bitrate=352.0
frame=3666 fps=611 q=28.2  size=6290kB time=00:02:26.70 bitrate=351.2
frame=3980 fps=612 q=31.0  size=6739kB time=00:02:39.21 bitrate=346.7
frame=4289 fps=613 q=19.3  size=7186kB time=00:02:51.62 bitrate=343.0
frame=4613 fps=615 q=14.0  size=7749kB time=00:03:04.52 bitrate=344.0
frame=4795 fps=618 q=31.0 Lsize=8187kB time=00:03:11.80 bitrate=349.7

video:5055kB audio:2997kB subtitle:0kB other streams:0kB 
   global headers:0kB muxing overhead: 1.682181%

The output tells us that:

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

 Using "embed" Elements for Flash Files

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

 SWFC Script to Generate Flash SWF Files

 ActionScript Embedded in SWFC Script

 AS3Compile - ActionScript 3 Compiler

 Adobe Flex SDK 4

 SWF File Structure and Tags

 SWF File Processing Rules

SWF Files for Video and Audio Streams

 Video and Audio Stream SWF File Structure

 Installing FFmpeg to Manipulate Video SWF Files

 Playing Movie with FFmpeg "ffplay" Command

 See File Properties with FFmpeg "ffprobe" Command

Convert File Format with "ffmpeg" Command

 Issue with "ffplay" on SWF Output File

 "ffplay" Interactive Commands

 Break Long Video into Parts with "ffmpeg"

 Concatenate Video Files with "ffmpeg"

 Video/Audio Stream Concatenation Order

 Split Audio Stream Out of SWF File

 Split Video Stream Out of SWF File

 Merge Video and Audio Streams to SWF File

 Reduce Video Stream Resolution

 Reduce Video Frame Rate

 Outdated Tutorials

 References

 Full Version in PDF/EPUB