ffmpeg: using vidstab{detect,transform} on parts of a video 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
It is possible to use the select filter to select scenes for stabilisation and inclusion into the final result - see the example below. It seems that select is slow for skipping over unwanted material. This does not create any intermediate files except the *.trf file. In my example I am not using audio, which would have to be selected likewise. 

#! /bin/bash

f="20191128_215245A.mp4"
x="select='between(t,5,10)+between(t,15,20)',setpts=N/FRAME_RATE/TB"
s="vidstabdetect=stepsize=6:shakiness=6:accuracy=9:result=foo.trf"
y="vidstabtransform=input=foo.trf:zoom=1:maxangle=(1*PI/180):smoothing=30"
z="scale=1440:-2,unsharp=5:5:0.8:3:3:0.4"
a="-an -tune film -r 60 -crf 26 -vcodec libx264 -preset slow"

ffmpeg -y -i $f -vf "$x,$s" -f null -
ffmpeg -y -i $f -vf "$x,$y,$z" $a foo.mp4