Gabriel
Gabriel

Reputation: 1761

Extract undecoded audio payload from song file?

What tools are available to extract the raw undecoded audio payload from a song file?

I am looking for a solution that will work on wma, m4a, mp3, and ogg files.

One of the purposes is to be able to calculate the md5sum of the audio payload.

I tried ffmpeg -i <song file> -f md5 - but this actually does a decoding pass which is not desired. Also this seems to produce different results depending on the versions of the decoders in use.

I tried ffmpeg -i <song file> -acodec copy - > <raw payload file> but ffmpeg complains that it does not know the desired output format even though copy is explicitly specified.

I've tried various incarnations of -map_metadata -1 but the documentation is obtuse at best.

In the end the ideal is to have an stdout of the raw UNdecoded audio portion of a song file.

Any ideas?

Upvotes: 2

Views: 1025

Answers (1)

Multimedia Mike
Multimedia Mike

Reputation: 13256

You're really, really close. If you are just trying to checksum the raw audio data, combine the 2 command lines you posted-- use '-acodec copy' for extract the raw data and '-f md5' to compute MD5:

ffmpeg -i audio.file -acodec copy -f md5 - 2>NUL

That will dump the MD5 sum to stdout. Replace the '- 2>NUL' at the end of the command line with a filename if you want the hash to go into a file instead.

Is there another reason you wanted to extract the raw audio data? I know it's possible, but doing so feels like it might fall into the category of "solving the wrong problem". If you extract the raw audio data from a diverse range of formats (like wma, m4a, mp3, and ogg), you'll be left with no context for how to use the data later (unless you're planning to store the context elsewhere, like in a database).

Upvotes: 5

Related Questions