Adding a unique ID in a WMV

Hi All,

I am putting together a site with PHP which will have some downloadable WMV’s. I don’t want them turning up elsewhere as they cost me money to make!

The site itself is coming together ok, but what I am hoping to do is add a piece of unique info to a meta data field of the WMV every time it is downloaded. I appreciate that this will probably not be massively secure and will be visible to clever folk, but it may just help me identify which member is redistributing stuff.

My gut instinct is that this will not be possible, but I thought that I would ask the question anyway.

Many thanks in advance,

Gravy

I had a similar need with MP3 files that I was selling on a site, I found that it was possible to insert several bytes of info into the mp3 file linking the transaction id to the downloaded file. Each file is ‘stamped’ before it is downloaded, so I can tell exactly where any file originated if I come across it.

Maybe you could do the same with WMV files

thanks, thats precisely what I want to do. It’s good to know that I am not after something impossible! Unfortunately my level of php is only 2 out of 10, so I wouldn’t even know where to start with that!

Could you point me in the direction of how you got it working on the mp3’s and I will have a play around?

Try changing the last 3 bytes of the WMV file for your ID code.

I hasten to add, that you will need to verify that you’re not affecting the usability of the file by adding or changing any bytes.

I think wmv use the asf container format, of which you can find out which bytes are modifiable in the format spec: http://download.microsoft.com/download/7/9/0/790fecaa-f64a-4a5e-a430-0bccdab3f1b4/ASF_Specification.doc

If you are already encoding your files using windows media encoder then you should also have the utilities WM File Editor (can rewrite metadata without reencoding) and Windows media ASF viewer, which you can use to see all metadata information.

Thanks Both,

As I say my level of PHP and programming in general is veru low. I am more than confident working with loops, lists and things like that. But file manipulation is not something I have done before.

I have looked around, and from What I can see I will use Fseek and Fwrite to make the modifications, and it is not actually that difficult. I found a class for doing it on an MP3 and it seemed to make sense.

What I am struggling with though is how I am going to make the changes to the individual download. I could easily have 100mb wmv’s if not bigger, so I don’t think that it would be practical to make copies every time and alter the copy. What I need to figure out is how I can make the first 99.9% of the file download, then just pop the last bit on the end! Am I now living in the realms of fantasy?

You have both been really helpful, and given me some hope on how to beat the pirates!

Thats a great documant that EastCoast has posted, and does highlight a section that is designed for the originator to “sign” the work.

However you will have to load the wmv into memory in order to alter the bytes, and that could be a sticking point unless you are in control of your server and can freely set the memory_limit of PHP.

Ahh, I think I get it now. Everytime someone wants to download the file, i will need to load it into memory, change the bytes, they download that version (directly from memory?), then clear it from memory when downloaded. I am thinking of moving over to a vps, but assuming 4 or 5 people want a vid at the same time (heres hoping), at 100mb i will need at least 500mb of ram allocation, probably more around 1gb for safety. This is beyond my modest means, as I was hoping to get away with just a cheap package as I have no other high strain requirements.

Could you confirm that that is what you mean? If so I may have to put it to one side, and work on it as a future upgrade if I find the funding.

I think your muddling up PHP memory (the RAM memory that the program will need), and hosting disk space, (the amount of space avalable to you on the server).

however if your thinking of a ‘cheap’ hosting solution your main problem could be bandwidth limits. Thats the amount of data transfer that your host company will allow per month. if your hoping that this file will be downloaded a lot then thats going to hit your bandwidth bigtime. You also need to look at download times for your users, maybe look at optimising your file and see if you can get that file smaller, which will easy all of the above.