Flash Tutorials - Herong's Tutorial Examples - v3.03, by Dr. Herong Yang
Merge Video and Audio Streams to SWF File
This section provides a tutorial example on how to merge a video stream SWF file and an audio stream SWF file into a single SWF file. '-map' option used twice to specify video and audio streams into the output file.
I am sure now you want to know how to merge a video stream and an audio stream into a single SWF file. Here is the "ffmpeg" command to do this:
C:\herong>\local\ffmpeg\bin\ffmpeg -i video_input.swf -i audio_input.swf -map 0:0 -map 1:0 output.swf
The above command uses "-map 0:0" to specify the first stream (video stream) of the first input file to be mapped to the output file. And it uses "-map 1:0" to specify the first stream (audio stream) of the second input file to be mapped to the output file at the same time.
Let's try it on our sample SWF file, Anchor_and_Spider_Man.swf:
C:\herong>\local\ffmpeg\bin\ffmpeg -i Video_with_No_Audio.swf -i Audio_with_No_Video.swf -map 0:0 -map 1:0 Video_and_Audio.swf Input #0, swf, from 'Video_with_No_Audio.swf': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: flv1, yuv420p, 416x240, 25 fps, 25 tbr, 25 tbn Input #1, swf, from 'Audio_with_No_Video.swf': Duration: 00:00:40.61, bitrate: 128 kb/s Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s Output #0, swf, to 'Video_and_Audio.swf': Metadata: encoder : Lavf55.40.100 Stream #0:0: Video: flv1 (flv), yuv420p, 416x240, q=2-31, 200 kb/s, 25 fps, 90k tbn, 25 tbc Metadata: encoder : Lavc55.63.100 flv Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p Metadata: encoder : Lavc55.63.100 libmp3lame Stream mapping: Stream #0:0 -> #0:0 (flv -> flv) Stream #1:0 -> #0:1 (mp3 -> libmp3lame) Press [q] to stop, [?] for help frame=171 fps=0.0 q= 2.0 size= 395kB time=00:00:06.84 bitrate=472.7 frame=454 fps=454 q=21.7 size=1019kB time=00:00:18.16 bitrate=459.8 frame=730 fps=487 q=31.0 size=1543kB time=00:00:29.20 bitrate=432.7 frame=986 fps=510 q=30.5 Lsize=1937kB time=00:00:39.47 bitrate=402.0 video:1293kB audio:617kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.422432%
Now enjoy the play with video and audio together:
C:\herong>\local\bin\flashplayer_13_sa Video_and_Audio.swf
Table of Contents
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
SWFTools - SWF File Manipulation Tools
SWFC Script to Generate Flash SWF Files
ActionScript Embedded in SWFC Script
AS3Compile - ActionScript 3 Compiler
►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
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