Convert Video to Grayscale
I'm a JavaScript fanatic but I've always been fascinated with media manipulation. Maybe it's because I've secretly always wanted to be a designer, but I'm fine with being able to manipulate art with software instead of create the art myself. One type of art I've always enjoyed was black and white (/grayscale) video.
To convert a video to black and white, you can utilize ffmpeg with a few simple arguments:
ffmpeg -i input.mp4 -vf hue=s=0 output.mp4
The preceding command turns this color video:
... to the following grayscale video:
If you were to search ffmpeg on this blog, you'd find dozens of tutorials about how amazing the tool is. Play around with ffmpeg and let me know what awesomeness you come up with!
Before we get started, it's worth me spending a brief moment introducing myself to you. My name is Mark (or @integralist if Twitter happens to be your communication tool of choice) and I currently work for BBC News in London England as a principal engineer/tech...
Firefox OS is all over the tech news and for good reason: Mozilla's finally given web developers the platform that they need to create apps the way they've been creating them for years -- with CSS, HTML, and JavaScript. Firefox OS has been rapidly improving...
The jQuery homepage has a pretty suave tooltip-like effect as seen below:
Here's how to accomplish this same effect using MooTools.
The XHTML
The above XHTML was taken directly from the jQuery homepage -- no changes.
The CSS
The above CSS has been slightly modified to match the CSS rules already...
One of my favorite social APIs was the Open Graph API adopted by Facebook. Adding just a few META tags to each page allowed links to my article to be styled and presented the way I wanted them to, giving me a bit of control...
Nice, ffmpeg seems to be quite handy!
Btw the same effect may be achieved on the client using CSS grayscale-filter, which is nowadays supported by any major browser (but IE). E.g. https://codepen.io/MattDiMu/pen/pBqQqR
Doing this on the client-side, however, will probably result in much larger file sizes than necessary, as grayscale videos offer much better compression. In your example the difference is 399kB vs 270kB.
I noticed the file size difference as well.
David, could you confirm that just adding
-vf hue=s=0
reduced the file size by 129KB, there were no other transformations?Thanks
In my case, the file size dropped to 1/3 of original file.
Hey David! Since there is difference between BLACK AND WHITE filter and GRAYSCALE filter.
A truly black and white image would simply consist of two colors—black and white. Grayscale images are created from black, white, and the entire scale of shades of gray.
Is method you mentioned rather grayscale? Or rather black and white filter?