I'm using ffmpeg's vidstabdetect
and vidstabtransform
filter to stabilise videos. Currently I first cut out the scenes from the single input that I want to stabilise into individual files, which I then stabilise, transform, and join together. To avoid creating these intermediate files, is it possible to:
- specify multiple time ranges to stabilise;
- create the necessary
*.trf
file(s) in a first pass; - stabilise (transform) the time ranges from the input in a second pass and create a single output file containing just the stabilised scenes
without creating intermediate files beyond the *.trf
file(s)? I am asking because I am not sure that the *.trf
files can deal with non-continuous scenes.
What would be the right flag to specify the time ranges to stabilise and join?
Current workflow to extract and stabilise a scene from foo.mp4
:
$ ffmpeg -v error -y -ss 00:00:00 -to 00:01:00 -i foo.mp4 -c copy foo-000000-000100.mp4
$ ffmpeg -y -v error -i foo-000000-000100.mp4 -vf vidstabdetect=stepsize=6:shakiness=6:accuracy=9:result=foo-000000-000100.trf -f null -
$ ffmpeg -v error -y -i foo-000000-000100.mp4 -vf vidstabtransform=input=foo-000000-000100.trf:zoom=1:maxangle=(1*PI/180):smoothing=30,rotate=(0.0*PI/180):ow=1920:oh=1080,scale=1440:-2,unsharp=5:5:0.8:3:3:0.4,drawtext=fontfile=din.ttf:fontcolor=0x55b575:fontsize=18:x=w-tw-10:y=h-th-10:timecode='00\:00\:00\:00':rate=60,drawtext=fontfile=din.ttf:fontcolor=0x55b575:fontsize=18:x=10:y=h-th-10:text='foo' -vcodec libx264 -preset slow -tune film -an -r 60 -crf 26 foo-000000-000100.stab.mp4