Change PCM Endianness with FFmpeg

This article explains how to change the byte order (endianness) of a raw PCM audio file using FFmpeg. Since raw PCM files do not contain header metadata, you must explicitly define the input audio properties—such as sample rate, channel count, and format—before converting the stream to your desired target endianness.

To convert a raw PCM file from little-endian to big-endian, use the following FFmpeg command:

ffmpeg -f s16le -ar 44100 -ac 2 -i input.pcm -f s16be -c:a pcm_s16be output.pcm

To convert a raw PCM file from big-endian to little-endian, reverse the format parameters:

ffmpeg -f s16be -ar 44100 -ac 2 -i input.pcm -f s16le -c:a pcm_s16le output.pcm

Command Breakdown