Téléchargements complémentaires¶
Pour avoir le ffmpeg qui a les options de stabilisation d'image (et statique) je propose :
- Linux : https://www.johnvansickle.com/ffmpeg/
- Windows : https://ffmpeg.zeranoe.com/builds/ et https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-3.2.2-win32-static.zip
Utilisation¶
Step 1. Calculating the stabilization vectors.¶
In this step, we calculate the stabilization vectors with some parameters which define how much we want to stabilize. These parameters will be saved in the file “transform_vectors.trf” (file can be deleted, after both steps are completed and output video delivers expected quality). The following example is for extreme stabilization tasks. If you only need to do soft stabilization, reduce shakiness to 3-4.
ffmpeg -i SHAKY_INPUT_VIDEO.mp4 -vf vidstabdetect=stepsize=6:shakiness=8:accuracy=9:result=transform_vectors.trf -f null -
Step 2. Transcoding the video with the data from Step 1 into a nice and smooth output video file.¶
This step transcodes the video based on the stabilization vectors calculated in Step 1. Again this is for an extreme example of shaky footage. If you only want to correct a bit, reduce values of zoom and smoothing. Zoom is also responsible for cutting away the outer edges, which are used for the stabilization. In any case you will loose content near the border of the video…but thats the cost for the stabilization.
ffmpeg -i SHAKY_INPUT_VIDEO.mp4 -vf vidstabtransform=input=transform_vectors.trf:zoom=1:smoothing=30,unsharp=5:5:0.8:3:3:0.4 -vcodec libx264 -preset slow -tune film -crf 18 -vb 20M -acodec copy SMOOTH_OUTPUT_VIDEO.mp4
During transcoding, in this step, i do NOT transcode the audio track, but simply copy it from input to output. Why make something worse through recoding, if there is no need for it.
If you have any better tips or recommendations for parameters available, or if above tips worked for you, please let me know in the comments.
Piste pour faire un outil vite fait: https://www.autoitscript.com/forum/topic/163257-ffmpeg-batch-conversion-automator/
Autres commandes
Autre commande ffmpeg plus “moderne” (qui ne demande pas le ffmpeg spécial en tout cas)¶
ffmpeg -i PORCEPIC.mp4 -cpuflags -sse2 -vf deshake /tmp/out.mp4
Pour coller les deux fichiers côte à côte pour comparaison:
ffmpeg -i PORCEPIC.mp4 -i /tmp/out.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS, pad=iw*2:ih[bg]; [1:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=w" /tmp/compare.mp4