Currently, trickplay uses the ffmpeg fps filter to extract scrubbing thumbnails.
This is slow as it needs to decode the entire video.
Simply extracting all keyframes instead is roughly 110 times faster (244 vs 2.2 FPS, tested on Win11, Ryzen 7950X3D Eco Mode)
Current ffmpeg command for 10s interval:
ffmpeg [...] -i [INPUT] -an -sn -vf "fps=0.10000000149011612,setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,240)/2)*2:trunc(ow/a/2)*2,format=yuv420p" -threads 8 -c:v mjpeg -qscale:v 2 -f image2 "[...]/%08d.jpg"
My proposal, 110x faster:
ffmpeg [...] -skip_frame nokey -i [INPUT] -an -sn -vf "fps=0.10000000149011612,setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale=trunc(min(max(iw\,ih*a)\,240)/2)*2:trunc(ow/a/2)*2,format=yuv420p" -threads 8 -c:v mjpeg -qscale:v 2 -vsync passthrough -f image2 "[...]/%08d.jpg"
Note the -skip_frame nokey before the input, which tells the decoder to only decode keyframes, and -vsync passthrough before the output, which avoids duplicated frames in the output as ffmpeg would otherwise duplicate frames to match the input frame rate.
I'm currently looking at the code and trying to get it to work, though I'm not familiar with the codebase and how the timestamps are stored, if at all.
Currently, trickplay uses the ffmpeg fps filter to extract scrubbing thumbnails.
This is slow as it needs to decode the entire video.
Simply extracting all keyframes instead is roughly 110 times faster (244 vs 2.2 FPS, tested on Win11, Ryzen 7950X3D Eco Mode)
Current ffmpeg command for 10s interval:
My proposal, 110x faster:
Note the
-skip_frame nokeybefore the input, which tells the decoder to only decode keyframes, and-vsync passthroughbefore the output, which avoids duplicated frames in the output as ffmpeg would otherwise duplicate frames to match the input frame rate.I'm currently looking at the code and trying to get it to work, though I'm not familiar with the codebase and how the timestamps are stored, if at all.