ffmpeg -i VID_20180208_142855.mp4 -vf vidstabdetect=stepsize=5:shakiness=8:accuracy=15:result=transform_vectors.trf \ -f null -
ffmpeg -i input.mp4 -vf vidstabtransform=input=transform_vectors.trf:zoom=2:smoothing=12,unsharp=5:5:0.8:3:3:0.4 \ -c:v libx265 -preset slow -crf 23 -acodec copy smooth_output.mp4 #encodig for dumb H.264 players, audio-codec: aac ffmpeg -i input.mp4 -vf vidstabtransform=input=transform_vectors.trf:zoom=2:smoothing=12,unsharp=5:5:0.8:3:3:0.4,format=yuv420p \ -c:v libx264 -crf 26 -preset slower -c:a aac -movflags +faststart output.mp4
Stacking two videos next to each other
ffmpeg -i input1.mp4 -i output2.mp4 -filter_complex vstack merged.mp4 #vertical stacking ffmpeg -i input1.mp4 -i output2.mp4 -filter_complex hstack merged.mp4 #horizontal stacking
Split-screen video (left side from first, right side from second video
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v]crop=iw/2:ih:0:0[left]; [1:v]crop=iw/2:ih:ow:0[right]; \ [left][right]hstack" merged.mp4
Rotate videos without re-encoding
ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4
The CRF parameter sets quality and influences file size. Lower values mean higher quality.Typical values range from 18 to 28 (default is 23).
ffmpeg -i input.mov -c:v libx264 -crf 26 -preset slower -c:a aac -vf format=yuv420p -movflags +faststart output.mp4
Resize to 1080: -vf scale=1920:1080
, tune for slideshow: -tune stillimage
(it seems only one -vf filter can be applied).
-t 300
encodes 5 minutes for quick quality control:
ffmpeg -i input.mov -t 300 -vf scale=1920:1080 -crf 26 -tune stillimage -c:a aac -movflags +faststart output1080.mp4
* Web-Optimized: https://superuser.com/questions/1155186/convert-mov-video-to-mp4-with-ffmpeg/1155189
ffmpeg -i broken.mp4 -c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p working.mp4