Convert s16p to s16 Audio Format Using FFmpeg
This article provides a quick and direct guide on how to convert
audio sample formats from signed 16-bit planar (s16p) to
signed 16-bit packed (s16) using FFmpeg. You will find the
exact command-line syntax required for this conversion, an explanation
of the parameters, and how to verify that your output file is in the
correct format.
The FFmpeg Command
To convert an audio file from the s16p (planar) sample
format to the s16 (interleaved/packed) sample format, use
the -sample_fmt option in FFmpeg.
Run the following command in your terminal:
ffmpeg -i input.wav -sample_fmt s16 output.wavHow It Works
-i input.wav: Specifies the path to your input audio file.-sample_fmt s16: Forces FFmpeg to convert the audio stream’s sample format to signed 16-bit packed (s16).output.wav: The name of the resulting output file containing the converted audio.
Alternative: Converting to PCM 16-bit (LE)
If you are outputting to a raw PCM WAV file, you can also achieve the
s16 format by explicitly choosing the 16-bit little-endian
encoder:
ffmpeg -i input.wav -c:a pcm_s16le output.wavBecause the pcm_s16le codec natively uses the packed
s16 sample format, this automatically changes the layout
from planar to packed.
Understanding s16p vs. s16
s16p(Planar): The audio channels are stored in separate blocks of memory (e.g., all Left channel samples first, followed by all Right channel samples). This is often used internally by decoders.s16(Packed/Interleaved): The audio channels are interleaved together in a single stream (e.g., Left, Right, Left, Right). This is the standard format required by most hardware players and audio editing software.
Verifying the Output Format
To confirm that the conversion was successful, use
ffprobe to inspect the audio metadata of your new file:
ffprobe -v error -show_entries stream=sample_fmt -of default=noprint_wrappers=1 output.wavThe terminal should output sample_fmt=s16, confirming
that the format has been changed from planar to packed.