Split Audio Stream Out of SWF File

This section provides a tutorial example on how to split the audio stream out of a stream SMF file. '-map 0:0' option is used to select the first stream (audio stream) of the first input file into the output file.

Another common task of manipulating stream SWF files is to split off the audio stream to a new SWF file or MP3 file. This can be done easily with the "ffmpeg" command:

C:\herong>\local\ffmpeg\bin\ffmpeg -i input.swf -map 0:0 output.swf

The above command uses "-map 0:0" to specify the first stream (audio stream) of the first input file to be mapped to the output file. You can specify "output.mp3" to get a MP3 output file.

Let's try it on our sample SWF file, Anchor_and_Spider_Man.swf:

C:\herong>\local\ffmpeg\bin\ffmpeg -i Anchor_and_Spider_Man.swf 
   -map 0:0 Audio_with_No_Video.swf

Input #0, swf, from 'Anchor_and_Spider_Man.swf':
 Duration: 00:02:04.08, start: 0.000000, bitrate: 127 kb/s
 Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
 Stream #0:1: Video: flv1, yuv420p, 416x240, 25 fps, 25 tbr, 25 tbn

Output #0, swf, to 'Audio_with_No_Video.swf':
 Metadata:
  encoder         : Lavf55.40.100
 Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p
  Metadata:
   encoder         : Lavc55.63.100 libmp3lame

Stream mapping:
  Stream #0:0 -> #0:0 (mp3 -> libmp3lame)

Press [q] to stop, [?] for help
size= 634kB time=00:00:39.44 bitrate= 131.8kbits/s

video:0kB audio:617kB subtitle:0kB other streams:0kB 
   global headers:0kB muxing overhead: 2.875846%

Check the output file with "swfdump" command from SWFTools first:

C:\herong>\local\SWFTools\swfdump Audio_with_No_Video.swf

==== Error: Real Filesize (649698) doesn't match header 
     Filesize (104857600) ====
     
[HEADER]        File version: 4
[HEADER]        File size: 104857600
[HEADER]        Frame rate: 10.000000
[HEADER]        Frame count: 6000
[HEADER]        Movie width: 320.00
[HEADER]        Movie height: 200.00
[02d]         6 SOUNDSTREAMHEAD2
[013]       421 SOUNDSTREAMBLOCK
[001]         0 SHOWFRAME 1 (00:00:00,000)
[013]       422 SOUNDSTREAMBLOCK
[001]         0 SHOWFRAME 2 (00:00:00,100)
[013]       422 SOUNDSTREAMBLOCK
[001]         0 SHOWFRAME 3 (00:00:00,200)
...
[013]       422 SOUNDSTREAMBLOCK
[001]         0 SHOWFRAME 1511 (00:02:30,994)

Notes on the SWF dump file:

Check the output file with "ffprobe" command from FFmpeg package:

C:\herong>\local\ffmpeg\bin\ffprobe Audio_with_No_Video.swf

...
Input #0, swf, from 'Audio_with_No_Video.swf':
  Duration: 00:00:40.61, bitrate: 128 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s

Now play it with projector with Flash Player Projector:

C:\herong>\local\bin\flashplayer_13_sa Audio_with_No_Video.swf

Enjoy the music! It will last for about 40.61 seconds.

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