Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save master-of-zen/b9eba4dc6f9e9e04d20a2e85e9bbe398 to your computer and use it in GitHub Desktop.
Save master-of-zen/b9eba4dc6f9e9e04d20a2e85e9bbe398 to your computer and use it in GitHub Desktop.

Goals and motivation

Current fast scene detection in rav1e relatively slow to compared methods of scene detection, and have proclivity to show false results or don't detect scene changes where they appear

This pr reworks fast scene detection algorithm, making it faster, better, and more accurate

Achieved goals are:

  • Faster decision making ( Both less and more efficient computations )
  • More accurate scene detection, by adjusting threshold based on previous frames
  • Frame downscale for faster decisions.

Example of adaptive threshold not cutting high motion segment which default static threshold method would cut

?  [SC-Detect] Frame 519: T=25.0 P=9.5 No cut
?  [SC-Detect] Frame 520: T=25.0 P=10.2 No cut
?  [SC-Detect] Frame 521: T=25.0 P=17.2 No cut

?  [SC-Detect] P: 29.0 [0.0, 1.8, 9.5, 10.2, 17.2] Cut: false
?  [SC-Detect] Frame 522: T=25.0 P=29.0 No cut

?  [SC-Detect] P: 33.6 [1.8, 9.5, 10.2, 17.2, 29.0] Cut: false
?  [SC-Detect] Frame 523: T=25.0 P=33.6 No cut

?  [SC-Detect] P: 34.0 [9.5, 10.2, 17.2, 29.0, 33.6] Cut: false
?  [SC-Detect] Frame 524: T=25.0 P=34.0 No cut

?  [SC-Detect] P: 26.4 [10.2, 17.2, 29.0, 33.6, 34.0] Cut: false
?  [SC-Detect] Frame 525: T=25.0 P=26.4 No cut

?  [SC-Detect] Frame 526: T=25.0 P=22.8 No cut
?  [SC-Detect] Frame 527: T=25.0 P=15.2 No cut
?  [SC-Detect] Frame 528: T=25.0 P=0.4 No cut

Speed comparison

2160p

new old

720p

new old
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment