Flash Tutorials - Herong's Tutorial Examples - v3.03, by Dr. Herong Yang
Reduce Video Frame Rate
This section provides a tutorial example on how to reduce frame display rate of the video stream a SWF file with the '-r nn' option on the output file of the 'ffmpeg' command.
Do you want to try to reduce the frame rate (fps) of a SWF stream file? Here is the "ffmpeg" command to do this:
C:\herong>\local\ffmpeg\bin\ffmpeg -i input.swf -r nn output.swf
"-r nn" specifies the new frame rate for the output file.
Our last sample SWF, Video_and_Audio.swf, has a frame rate of 25. We can reduce it to 12:
C:\herong>\local\ffmpeg\bin\ffmpeg -i Video_and_Audio.swf -r 12 Frame_Rate_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 'Frame_Rate_Reduced.swf': Metadata: encoder : Lavf55.40.100 Stream #0:0: Video: flv1 (flv), yuv420p, 416x240, q=2-31, 200 kb/s, 12 fps, 90k tbn, 12 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=161 fps=0.0 q=13.6 size= 682kB time=00:00:13.41 bitrate=416.4 frame=322 fps=322 q=16.4 size=1252kB time=00:00:26.83 bitrate=382.2 frame=476 fps=319 q=9.8 Lsize=1753kB time=00:00:39.66 bitrate=362.0 dup=0 drop=510 video:1123kB audio:617kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.777759%
The output confirms that the new frame rate is 12 fps. And 510 frames where dropped.
Check the output file with "swfdump" command from SWFTools first:
C:\herong>\local\SWFTools\swfdump Frame_Rate_Reduced.swf [HEADER] File version: 6 [HEADER] File size: 1794996 [HEADER] Frame rate: 12.000000 [HEADER] Frame count: 476 [HEADER] Movie width: 416.00 [HEADER] Movie height: 240.00 [02d] 6 SOUNDSTREAMHEAD2 [03c] 10 DEFINEVIDEOSTREAM defines id 0000 (476 frames, 416x240 ... [01a] 21 PLACEOBJECT2 places id 0000 at depth 0001 name "video" [03d] 9058 VIDEOFRAME adds information to id 0000 (frame 0) 416x240... [013] 421 SOUNDSTREAMBLOCK [001] 0 SHOWFRAME 1 (00:00:00,000) [01a] 5 PLACEOBJECT2 moves object at depth 0001 [03d] 896 VIDEOFRAME adds information to id 0000 (frame 1) 416x240... [013] 1676 SOUNDSTREAMBLOCK [001] 0 SHOWFRAME 2 (00:00:00,083) ...
The "swfdump" output confirms that the frame rate is reduced to 12 now.
Now enjoy the video with the reduced frame. We don't really feel the video quality is dropped, because our eyes cannot really tell the difference between 12 fps and 25 fps.
C:\herong>\local\bin\flashplayer_13_sa Frame_Rate_Reduced.swf
Try to reduce the frame rate further to 2 fps yourself. You see the impact on the video quality.
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