Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding watermarks to mp3 downloads

I noticed that companies such as iTunes and Amazon add "watermarks" to their mp3 files showing information such as the following:

  • From where the file was purchased.
  • Who purchased it.
  • etc.

Amazon also states that

"Some record companies require us to insert identifiers in the metadata that accompanies music"

The e-commerce website that I'm busy developing is going to sell mp3 downloads. Since iTunes and Amazon are forced to add watermarks to their songs, some record companies will most probably require the one I'm developing to do the same.

The website is a web application developed using ASP.NET 4 and C#. It seems impractical to generate a new file with the metadata modifications on our web servers for each user who downloads a mp3, because that will cause thousands of temporary mp3 files to reside on our servers.

Is there any way to inject the relevant metadata into the file as it gets downloaded, or possibly on the client-side with HTML5?

like image 700
Curious Coder Avatar asked Oct 22 '22 14:10

Curious Coder


1 Answers

You do not need to create thousands of files on the server. You can read from the source, stream it through some method of inserting a watermark, and then output to a new mp3 stream directly to the http response.

This library provides a lot of useful classes for reading and writing mp3 streams and other audio manipulations.

http://naudio.codeplex.com/

It does not have watermarking built in. You'll need to do that. That is going to be the really complicated part. You need to modify the original file in a way that you can recognize the watermark data, but not affect the audio quality and not be able to remove easily. Good luck.

like image 131
Samuel Neff Avatar answered Oct 29 '22 18:10

Samuel Neff