FFMpeg Video Sharpening

FFMpeg Video Sharpening

It can seem magical when blurry and low detail video is refocused. Unsharpen masks are the wizard behind the curtain and FFMpeg has this feature. In this post I’ll give some examples of the unsharpen mask. I won’t go into the details or mechanics of how the filter works. This will merely be a quick how to.

I’m going to be working with a 30 second clip of video that was shot during the 2012 STP bicycle classic. It was shot late in the day on the Yelm-Tenino trail (GPS 46.8701, -122.7489 to be exact). There was a rider that was moving quickly in the opposite direction and we thought it odd. Anyway, this video is a series of still images with varying degrees of unsharpen filtering.

The variables are overlayed on the video. For ease of reading, here are the FFMpeg commands I used.

ffmpeg -ss 00:00:00 -i 201207141826.MOV -t 00:00:30 -c copy 201207141718_SharpenSource.MOV
ffmpeg -i 201207141718_SharpenSource.MOV -vf unsharp=3:3:1.5 201207141718_Sharpen_msize_x3_y3_amount_1-5.MOV
ffmpeg -i 201207141718_SharpenSource.MOV -vf unsharp=5:5:2 201207141718_Sharpen_msize_x5_y5_amount_2.MOV
ffmpeg -i 201207141718_SharpenSource.MOV -vf unsharp=3:3:5 201207141718_Sharpen_msize_x3_y3_amount_5.MOV
ffmpeg -i 201207141718_SharpenSource.MOV -vf unsharp=13:13:2.5 201207141718_Sharpen_msize_x13_y13_amount_2-5.MOV
ffmpeg -i 201207141718_SharpenSource.MOV -vf unsharp=13:13:5 201207141718_Sharpen_msize_x13_y13_amount_5.MOV

These are listed in order of degree of sharping. The msize and amount that I found to work the best for this footage was either 3:3:1.5 or 5:5:2. The imaging begins to become distorted as the amount and msize are increased beyond that.

I also named the file based on the timestamp of the video, so you also can see when this was taken, July 14th, 2012 at 5:18pm. That’s secondary info that matters little in this post. I like to include it because it will be useful in later processing, which I’ll cover in later posts.

Anyway, I hope you have enjoyed this brief intro into video enhancements with FFMpeg. I look forward to covering more topics with FFMpeg and hope you will return.

Comments are closed.