Sorry, your browser doesn’t support this Canvas demo.
Well, if you subscribe to the Betteridge school of thought, you know the answer already: No. But that doesn’t mean we can’t have some fun.
document.addEventListener(‘DOMContentLoaded’,function(){var v=document.getElementById(‘v’);var canvas=document.getElementById(‘c’);var context=canvas.getContext(‘2d’);cw=canvas.width;ch=canvas.height;v.addEventListener(‘play’,function(){draw(this,context,cw,ch)},false)},false);function draw(v,c,w,h){if(v.paused||v.ended)return false;c.drawImage(v,0,0,w,h);setTimeout(draw,20,v,c,w,h)}
After spotting the unflagged YouTube video with the screwed-up colors, cnelson wondered if you could actually do the color correction during playback. I took the uploaded video and attempted to manipulate it in Photoshop to restore the original colors. I compared my efforts to the original source (the Global HD watermark is a giveaway that it was from the LOL torrent release). While I was able to restore some of the original color, it proved very difficult, and I guessed that some of the image data had been lost in the color manipulation and it wouldn’t be fully reversible.
I decided to perform my own reversible color manipulation and see if I could bypass YouTube’s content detection. I exported the source with a 30deg color rotation. You can see the resulting video at the top of this page. If you click play, you’ll see the same video with the colors corrected playing below it. This corrected version is being drawn live to a <canvas>Â element and the color correction is being applied using the style -webkit-filter: hue-rotate(270deg);
Hey look it works!
Well, sorta, the original goal is to host “scrambled” videos on YouTube and then play them back and descramble them in the browser. When I uploaded my hue-rotated video to YouTube, it flagged the copyright content immediately. I suspect that part of the content fingerprinting process is first converting the material to black and white so shifting the hue of a video would look no different than the original. You could come up with a more complex per-pixel transformation to reverse in the <canvas>Â element, but the cross-origin security would prevent you from doing this to items originating on YouTube on your own site.
Footnote: I’m only using <canvas> for this demo to show both versions at the same time. I could apply the hue-rotation style directly to the <video>Â for the same result.
both versions have the same hue in my mac chrome: http://cl.ly/0v0n2y2A2d2t1W113p3h
LikeLike
If works cross domain, you could post some pretty scrambled video (rearrange the macroblocks etc) and then efficiently descramble them client side.
LikeLike
Er, if the video tag works.
LikeLike
@thedaniel I’m using the mac chrome 19 beta
@dan my understanding is if the video in the video tag is from a different domain, and you copy it into the a canvas element, it taints the canvas and the browser won’t let you access the pixel data.
LikeLike
i’m tellin’ you — browser plugin!
LikeLike