FFMPEG - how to achieve fast seeking when trimming

My current command looks like this:

-i Video.mp4 -i Image.png -filter_complex [1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v] -map [v] -ss valueLeft -to valueRight -c:v libx264 -preset ultrafast Output.mp4

I asked a question on how to export a image faster, you can read more about it here. He suggested that I should put my -ss before -i for fast seeking and it worked perfectly.

I then tried to do the same thing with trimming a video by trying this:

 -ss valueLeft -i Video.mp4 -i Image.png -to valueRight -filter_complex [1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v] -map [v] -c:v libx264 -preset ultrafast Output.mp4

then -to just gets ignored.


I also tried this-

-ss valueLeft -i Video.mp4 -to valueRight -i Image.png -filter_complex [1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=0.7[ovrl];[base][ovrl]overlay[v] -map [v] -c:v libx264 -preset ultrafast Output.mp4

in my log showing this:

Image.png -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.


Can someone please help me with the correct way how to do this?


The way -to is implemented, it can only be used in limited circumstances, such as when slow seek is being performed or timestamps are being copied over. With fast seek, output timestamp of first input frame gets reset to 0, and so -to is useless.

Workaround is to use -t whose value is -to time - -ss time.