Transcode Video to FLV Sorenson Spark Using FFmpeg

This guide provides a straightforward tutorial on how to transcode modern video files into the legacy FLV (Flash Video) format using the Sorenson Spark video codec in FFmpeg. It covers the specific command-line arguments needed to invoke the correct encoder, manage video quality, and configure compatible audio for legacy playback systems.

To encode a video to Sorenson Spark, you must use the flv1 video encoder in FFmpeg, which implements the Sorenson H.263/Spark format. This codec is distinct from the standard Flash H.264 or On2 VP6 codecs often found in later FLV files.

The Basic Command

To convert an input video to an FLV file using Sorenson Spark with standard MP3 audio, use the following command:

ffmpeg -i input.mp4 -c:v flv1 -c:a libmp3lame output.flv

Controlling Video Quality

Because Sorenson Spark is an older, less efficient codec, you must manage the quality settings carefully to avoid pixelation.

Method 1: Constant Quality (Recommended) Use the -qscale:v (or -q:v) flag to set a fixed quality level. The scale ranges from 1 (highest quality, largest file size) to 31 (lowest quality, smallest file size). A value between 3 and 5 usually delivers the best balance.

ffmpeg -i input.mp4 -c:v flv1 -qscale:v 4 -c:a libmp3lame output.flv

Method 2: Target Bitrate If you need to limit the file size or restrict bandwidth for legacy streaming servers, specify a target video bitrate using the -b:v flag:

ffmpeg -i input.mp4 -c:v flv1 -b:v 1000k -c:a libmp3lame -b:a 128k output.flv

Audio Codec Compatibility

Sorenson Spark FLV files typically pair with MP3 or ADPCM audio.

To use ADPCM audio instead of MP3, modify the audio codec flag:

ffmpeg -i input.mp4 -c:v flv1 -qscale:v 4 -c:a adpcm_swf output.flv

Downscaling for Legacy Hardware

Sorenson Spark was designed for low-resolution video. If your source file is High Definition (1080p or 4K), you should downscale the video and lower the frame rate to ensure smooth playback on older systems.

The following command downscales the video to a width of 640 pixels (maintaining aspect ratio) and caps the framerate at 24 frames per second:

ffmpeg -i input.mp4 -c:v flv1 -qscale:v 4 -vf "scale=640:-1" -r 24 -c:a libmp3lame output.flv