Compress Audio to Shorten SHN Format Using FFmpeg

This article explains how to compress audio files into the Lossless Audio Shorten (SHN) format using FFmpeg. Since FFmpeg natively supports decoding SHN files but lacks a native SHN encoder, this guide demonstrates how to pipe FFmpeg’s output into the command-line shorten tool to successfully compress your audio.

Why You Need an External Tool

While FFmpeg is excellent at reading and converting .shn files to modern formats like FLAC or WAV, it does not contain an internal encoder to write SHN files. To compress audio to SHN, you must use FFmpeg to decode your source file to raw WAV data and pipe that stream into the official shorten command-line utility.

Prerequisites

Before starting, ensure you have both tools installed on your system: 1. FFmpeg: Available on most package managers or the official website. 2. Shorten: The original command-line compiler for SHN files (often installable via packages like shorten on Linux/macOS).

The Compression Command

To compress any audio file supported by FFmpeg into a Shorten (.shn) file, run the following command in your terminal:

ffmpeg -i input.wav -f wav - | shorten - output.shn

How the Command Works

Decompressing SHN Files

If you ever need to decompress an SHN file back into a standard format, FFmpeg can handle this natively without any external tools. Use the following simple command:

ffmpeg -i input.shn output.flac

This command directly converts the legacy SHN file into a modern, widely-supported lossless FLAC file.