Adding color noise to video with FFmpeg is a great way to add some extra visual interest to your footage. Don't know what FFmpeg? Read the final chapter for a short guide.
When you add color noise to a video, you are essentially adding errors to your existing video. So that's what we're going to do now.
The problem is that when we damage our video, it won't play in all browsers and video players. No worries. Once it's damaged we can easily fix it with the included visual errors so it can be played anywhere.
Here is the video that we're going to play with today.
I'll show you some ways below to add color noise and glitches to your video.
Check out the included previews and decide which one you like best.
Add a subtle color noise effect
Use the following command to add noise to your video. Make sure to change input.mp4 with the name of your video file.
ffmpeg -i input.mp4 -bsf:v noise -c:v mpeg2video -q:v 2 -c:a copy noise.ts
Repair the video with the following command
ffmpeg -i noise.ts -codec:v libx264 -pix_fmt yuv420p output.mp4
You can pixelate your input video by increasing the -q:v 2 amount. I've adjusted it to 30 for demonstration purposes, here's the command:
ffmpeg -i input.mp4 -bsf:v noise -c:v mpeg2video -q:v 30 -c:a copy noise.ts
The command created the following video.
Don't forgot the repair your video once you see what you like.
Add a color burn noise effect
Use the following command to add a more chaotic color noise to your video.
ffmpeg -i input.mp4 -codec:v huffyuv -c:a pcm_s16le -bsf noise=1000000 output.mkv
Change input.mp4 to your filename. Increase the noise=1000000 amount to make the effect more subtle.
Repair the damaged video with the following command
ffmpeg -i output.mkv -codec:v libx264 -pix_fmt yuv420p final.mp4
Add a film grain noise effect
Adding a simple film noise effect to your video is super easy with FFmpeg. It also does not require you to damage your video first.
Execute the following command and make sure to replace input.mp4 with your filename.
ffmpeg -i input.mp4 -vf noise=c0s=14:c0f=t+u output.mp4
The command creates the following result.
This creates a very subtle effect on your video. Very familiar with what you see in older movies and film noir. It gives a vintage or classy feel to your videos.
Create a new video with noise in color
Don't want to add an effect to an existing video? You can use FFmpeg to create a brand new video with colored noise.
It is quite simple and only requires one command.
ffmpeg -f rawvideo -video_size 1280x720 -pixel_format yuv420p -framerate 25 \
-i /dev/urandom -ar 48000 -ac 2 -f s16le -i /dev/urandom -codec:a copy \
-t 3 output.mkv
Adjust -video_size 1280x720 and -framerate 25 to change the resolution and frame rate of your video.
The result should be an animated color noise video.
What is FFmpeg and how do I install it?
FFmpeg is a free and open-source command-line tool. It is used for transcoding video and audio files. It is a cross-platform solution that can be used on Windows, Linux, and macOS.
Installing FFmpeg is relatively simple. On Windows, you can download a pre-built binary. For Linux, you can install it from your distribution's package manager. On macOS, you can use Homebrew to install FFmpeg.
Once FFmpeg is installed, you can use it to convert between various video and audio formats. For example, to convert an MP4 file to an AVI file, you would use the following command:
ffmpeg -i input.mp4 output.avi
FFmpeg can also be used to resize, crop, and add watermarks to video files. It is a powerful tool that can be used for a variety of tasks.