Home Ask Login Register

Developers Planet

Your answer is one click away!

Twois February 2016

Hide text inside audio file with php

Is it possible to add hidden string to an audio file (mp3, mid) via PHP?

I have an online music store and some of my custumer resell the songs, and I want to hide his e-mail address in the audio file to identify them.


Brad February 2016

Audio Files

For real audio files (not MIDI, which is not really an audio file), the best method for this is to use audio watermarking. There are many algorithms and tools (such as AWT) that can be executed from your PHP script to handle this. They work by modifying the audio data in a way that cannot be perceived but can be decoded.

Most of these algorithms can encode the watermark in such a way that they survive re-encoding with other codecs. This is a critical difference from what you are asking for. If you simply were to add an ID3 tag, any tool could remove that. In fact, it's likely your tag would get removed just by tools that read and re-write your ID3 tags. With the information embedded in the actual audio itself however, it will survive. If someone decodes the file and re-encodes with another codec, depending on your watermarking algorithm, the watermark will still survive. Even if someone streams it within another stream, the watermark can survive.

and I want to hide his e-mail address in the audio file to identify them

Rather than embedding personally identifying information, you should store an ID or hash of an ID that you keep in your own database. It might be even better if you generate a new ID for each download so that should you need to find the user who re-sold your files, you can prove when they downloaded it and from what IP address, along with any other information you wish to keep in your database.

MIDI Files

For MIDI, you will have to embed your ID in the metadata of the file. This can be easily defeated, and may not be worth your time at all.

Post Status

Asked in February 2016
Viewed 1,245 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life