DAVIDQLZ

New Member
Joined
May 13, 2016
Messages
9
Reaction score
7
Country
Czech Republic
Hey everyone, this is my tutorial how to stabilize the recorded video.



STEP BY STEP:
  1. Download and unzip ffmpeg from https://ffmpeg.org/download.html
  2. Extract the 7zip archive (I recommend extract it to root of any partition e.g. C:\ or D:\)
  3. Rename the folder to „ffmpeg“
  4. Paste into „ffmpeg\bin“ folder your video
  5. Open command prompt(Win + R and type „cmd“)
  6. You must get into „C:\ffmpeg\bin“ – Type „cd C:\ffmpeg\bin“
  7. Now you’re ready to start encoding

  1. Type in this command:
  2. ffmpeg -i input_video.mp4 -vf vidstabdetect=shakiness=5:show=1 analyzed_video.mp4
  3. Wait until it’s done, then you dont need to open analyzed video.
  4. Type into prompt the second command:
  5. ffmpeg -i input_video.mp4 -vf vidstabtransform output_video.mp4
  6. It will take a minute.
Making video more realistic and fantastic:
(Thanks to Falsificator)
  1. Type in command prompt this command:
  2. ffmpeg -i input.mp4 -b 20000k -s 1920x1080 -vf "eq=contrast=1.02:saturation=1.7:gamma=1.3:brightness=-0.1:gamma_r=1:gamma_g=1:gamma_b=1.2, unsharp" output.mp4
Yeah done! Your video is stabilized !

Leave a comment with your results:) I will be happy if you give me like on video and subscribe my channel for more awesome videos and tutorials!:)


BTW: I recommend to stabilize rendered video ! The quality of the video will drop down :)
 
Last edited:
After stabilization I recommend to drive video with these settings (20Mbit):
Code:
ffmpeg -i input.mp4 -b 20000k -s 1920x1080 -vf "eq=contrast=1.02:saturation=1.7:gamma=1.3:brightness=-0.1, unsharp" output.mp4
1.webp 2.webp
3.webp 4.webp
5.webp 6.webp
 
Good job man, but I think, the saturation may be little bit lower :) It looks very colourfuly..

Can I post your command to my video ? :)
 
In my opinion, it is better to use "saturation:1.3". Final video looks more realistic :)
 
FFMPEG - batch processing 1080p (Xiaomi Yi)
-----------------------------------------------------------
BAT file: https://cloud.mail.ru/public/NEHB/NndxytgRX
-----------------------------------------------------------
Extract the BAT file from the archive to a folder with FFmpeg.exe and to copy the video files from the camera.
Run the BAT and wait. Processed files will be the same folder.
The new video will be -DOUBLE prefix in the filename.
BAT output settings 1920x1080p video with a bitrate of 20Mbit.
Along the way, enhanced sharpness, contrast increases slightly, stretched shadows,
overexposure is reduced in bright parts of the image. The color is more saturated ...
1.webp 2.webp
Also in the code, you can add a command correction WB. Make a picture a little colder.
Code:
-vf eq=gamma_r=1:gamma_g=1:gamma_b=1.2
 

Attachments

Last edited:
About the ffmpeg, anybody already know how to add this into autoexec ? So the footages are directly converted into stabilized?
 
Unpack the archive to a folder with FFMPEG.exe and to put the same video.
The video file to rename 1.mp4.
In turn run BAT-files PASS-1, PASS-2......
At the output we get 1080p video 20000kbit...

The question was to add it to autoscript.ash, and not how to use a batch script.... That is something i knew.
 
Last edited:
Hey everyone, this is my tutorial how to stabilize the recorded video.



STEP BY STEP:
  1. Download and unzip ffmpeg from https://ffmpeg.org/download.html
  2. Extract the 7zip archive (I recommend extract it to root of any partition e.g. C:\ or D:\)
  3. Rename the folder to „ffmpeg“
  4. Paste into „ffmpeg\bin“ folder your video
  5. Open command prompt(Win + R and type „cmd“)
  6. You must get into „C:\ffmpeg\bin“ – Type „cd C:\ffmpeg\bin“
  7. Now you’re ready to start encoding

  1. Type in this command:
  2. ffmpeg -i input_video.mp4 -vf vidstabdetect=shakiness=5:show=1 analyzed_video.mp4
  3. Wait until it’s done, then you dont need to open analyzed video.
  4. Type into prompt the second command:
  5. ffmpeg -i input_video.mp4 -vf vidstabtransform output_video.mp4
  6. It will take a minute.
Making video more realistic and fantastic:
(Thanks to Falsificator)
  1. Type in command prompt this command:
  2. ffmpeg -i input.mp4 -b 20000k -s 1920x1080 -vf "eq=contrast=1.02:saturation=1.7:gamma=1.3:brightness=-0.1:gamma_r=1:gamma_g=1:gamma_b=1.2, unsharp" output.mp4
Yeah done! Your video is stabilized !

Leave a comment with your results:) I will be happy if you give me like on video and subscribe my channel for more awesome videos and tutorials!:)


BTW: I recommend to stabilize rendered video ! The quality of the video will drop down :)

I can't get this to work, when i type the ffmpeg -i input_video.mp4 -vf vidstabdetect=shakiness=5:show=1 analyzed_video.mp4 i get this error
C:\ffmpeg\bin>ffmpeg -i input_video.mp4 -vf vidstabdetect=shakiness=5:show=1 analyzed_video.mp4
'ffmpeg' is not recognized as an internal or external command, operable program or batch file.

Also there is no bin folder inside ffmpeg when i extracted it so i created a bin folder, is that right?

Edit: My mistake. I downloaded the wrong version ffmpeg-3.0.2.tar.bz2. I thought it was for windows lol. I now downloaded the right version for windows and everything's ok now. Thanks.
 
Last edited:
When was this "vidstabdetect" introduces in ffmpeg?
Mine is from april but doesn't have it.
 
Here is my latest video from my XiaoYi camera! It is stabilized using ffmpeg and I used the Falsificator's command for better quality and colors. :) Enjoy ! :)

 
The bitrate after i use this down to 10mbs..is there anyway to increase man?
For example 36Mbits...
PASS-1
Code:
ffmpeg.exe -i input.mp4 -b:v 36000k -vf vidstabdetect=shakiness=5:show=1 analyzed_stab.mp4
PASS-2
Code:
ffmpeg.exe -i input.mp4 -s 1920x1080 -b:v 36000k -vf vidstabtransform output.mp4
 
For example 36Mbits...
PASS-1
Code:
ffmpeg.exe -i input.mp4 -b:v 36000k -vf vidstabdetect=shakiness=5:show=1 analyzed_stab.mp4
PASS-2
Code:
ffmpeg.exe -i input.mp4 -s 1920x1080 -b:v 36000k -vf vidstabtransform output.mp4

Thank you, so my guest after messing around with those code is right. but the point is, how can i put those 3 Pass into 1 .BAT file?
any suggestion?
 
Holy molly! This shanghai is getting real! Thanks dude!

Update: After testing the shakiness, I can see, if I'm not mistaken, vidstab lib is using a position-rotation-scale kind of technique from premiere. Is there a code to encode it to subspace warp?

Took me 10 grueling hours to install vidstab lib on mac. Too many compile errors.
 
Last edited:
Hey all.

Not to hijack the thread, but considering it's a HOWTO: Stabilizing your video subject, everyone will find this. I just wanted to point out, we were doing this software-only video stabilization nearly a decade before someone added it to ffmpeg.

In the science world, we needed to stabilize microscope output, both optical and the more advanced, astronomical image stacking for enhanced resolution, as well as machine vision, and even down to the lawyers wanting a way to stabilize police dashboard videos for trials (which I guess I should have led with, considering the site I'm typing this on...)

Anyway, for the user that wants to -understand- what's going on, as well as have more control over the finished video, there are other alternatives. (Note! These methods are kind of technical, and more intended for the proud linux geek than say a Windows user who might already be having trouble with cmd.exe commands, No judgement, just saving the non-scientific someones the trouble.)

MATLAB: Video Stabilization Using Point Feature Matching
http://www.mathworks.com/help/vision/examples/video-stabilization-using-point-feature-matching.html

ImageJ: Image Stabilizer for stacked images or video
http://www.cs.cmu.edu/~kangli/code/Image_Stabilizer.html

BoofCV: Image Stabilizing
http://boofcv.org/index.php?title=Example_Video_Stabilization

The MLT framework has a good implementation of vidstab
https://www.mltframework.org/bin/view/MLT/FilterVidstab

(The MLT/Melt one above is the one that made it into ffmpeg, by Marco Gittler / Jakub Ksiezniak.)

For those that like to work on their tablets/phones more than their desktops, there are apps for that. :-) There's an OpenCV implementation by Serafim Chekalkin although I think you are expected to pay for it if you don't do the compiling yourself. (caveat: never d/l'd Unshake nor tried it)
http://blog.denivip.ru/index.php/2016/04/faster-than-real-time-stabilization-of-videos/?lang=en

Speaking of OpenCV, there is a module in beta now, aptly named videostab.
http://docs.opencv.org/3.0-beta/modules/videostab/doc/videostab.html

There are of course others, but the top two are still my go-to software. Feel free to Google and experiment with other implementations and please share your findings!

FYI: Did you know many countries add a surcharge to imported electronic goods that contain image stabilization? Same goes for P&S or dSLRs that record video, they usually don't record too long, because that is considered "a camcorder" and has yet another (higher) import tax. Which is why you always what the .us model if in America.
 
Back
Top