Flash Tutorials - Herong's Tutorial Examples - v3.03, by Dr. Herong Yang
Reduce Video Stream Resolution
This section provides a tutorial example on how to reduce display resolution of the video stream a SWF file with the '-s nnn:nnn' option on the output file of the 'ffmpeg' command.
Sometimes you want to reduce the video resolution to reduce the SWF file size. This can be done by the "ffmpeg" command as shown below:
C:\herong>\local\ffmpeg\bin\ffmpeg -i input.swf -s nnn:nnn output.swf
"-s nnn:nnn" specifies the new video resolution in pixels for the output file.
Our last sample SWF, Video_and_Audio.swf, has a video stream with a 416x240 resolution. We can reduce it to 208x120:
C:\herong>\local\ffmpeg\bin\ffmpeg -i Video_and_Audio.swf -s 208:120 Resolution_Reduced.swf Input #0, swf, from 'Video_and_Audio.swf': Duration: 00:02:03.96, 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 'Resolution_Reduced.swf': Metadata: encoder : Lavf55.40.100 Stream #0:0: Video: flv1 (flv), yuv420p, 208x120, 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:1 -> #0:0 (flv -> flv) Stream #0:0 -> #0:1 (mp3 -> libmp3lame) Press [q] to stop, [?] for help frame=321 fps=0.0 q=6.3 size= 641kB time=00:00:12.84 bitrate=408.9 frame=644 fps=643 q=8.9 size=1208kB time=00:00:25.76 bitrate=384.0 frame=960 fps=640 q=5.3 size=1732kB time=00:00:38.40 bitrate=369.6 frame=986 fps=639 q=6.8 Lsize=1775kB time=00:00:39.44 bitrate=368.6 video:1130kB audio:617kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.578117%
Checking the file size:
C:\herong>dir *.swf ... 05/27/2014 10:35 PM 1,817,328 Resolution_Reduced.swf 05/27/2014 09:21 PM 1,983,411 Video_and_Audio.swf
Why the SWF file with reduced video resolution is almost the same as the original SWF file? May be the compression on the video data is so good on animation video, I guess.
Now enjoy the video with the reduced resolution:
C:\herong>\local\bin\flashplayer_13_sa Resolution_Reduced.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