Extract Audio to MPC Musepack Using FFmpeg
This article provides a straightforward guide on how to extract audio
from any video or audio file and encode it into the Musepack (MPC)
format using FFmpeg. Since FFmpeg supports decoding Musepack but does
not contain a native MPC encoder, you will learn how to extract the
audio using FFmpeg and pipe it directly into the official Musepack
encoder (mpcenc) in a single command.
Prerequisites
To use this method, you must have both FFmpeg and the Musepack command-line encoder (mpcenc) installed on your system and accessible via your command line.
- FFmpeg extracts the audio stream from your source file and outputs it as uncompressed WAV data.
- mpcenc receives the WAV data and compresses it into the Musepack (.mpc) format.
The Extraction and Encoding Command
Open your terminal or command prompt and run the following command:
ffmpeg -i input.mp4 -f wav - | mpcenc --quality 6 - output.mpcHow the Command Works
ffmpeg -i input.mp4: Specifies the input video or audio file (input.mp4) from which you want to extract the audio.-f wav -: Forces the output format to be WAV and directs the output stream to the stdout (represented by the hyphen-) instead of saving it to a physical file.|(pipe): Takes the audio stream from FFmpeg and passes it directly to the next command without writing temporary files to your hard drive.mpcenc: Invokes the Musepack encoder.--quality 6: Sets the compression quality. The quality scale ranges from1(lowest quality, smallest file size) to10(highest quality, largest file size). A quality setting of5to7is recommended for transparent, CD-quality audio.-: Instructsmpcencto read the incoming audio data from stdin (the pipe).output.mpc: The name of the final compressed Musepack file.
Selecting Specific Audio Tracks
If your input file has multiple audio tracks and you want to extract
a specific one, use the -map option in FFmpeg. For example,
to extract the second audio track:
ffmpeg -i input.mkv -map 0:a:1 -f wav - | mpcenc --quality 6 - output.mpc