adblockradio/stream-audio-fingerprint

Can this be used to analyse a html5 video?

jimmywarting opened this issue · 2 comments

Ok, so I'm watching a html5 video and i would like to fingerprint the audio of the movie that you are watching.

is that possible with the AudioContext? My knowledge of AudioContext is close to nothing

dest4 commented

Hi,
server-side would be easier, but if you really want to do it in browser, here are my clues:
first thing to check is that you have CORS headers on the server hosting the video. If not, Javascript will not have access to audio data and it's (almost) game over.

Then, Webaudio API is a good area to look at. There is an API normally used for visualization that you could use to get PCM data: getByteTimeDomainData. It seems to be a good starting point.

As an alternative, there is a port of FFmpeg to JS that could let you convert your video to an audio channel compatible with the fingerprinter.

Lastly, some modifications would be needed for the fingerprinter to work in a browser. Not too hard.
Good luck :)

Hope that the WebAudio api works.

Edit: Yikes, was harder then i thought. Your lib parse the hole wav file.
I might as well forget about my hole idea.