Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd June 2025, 20:57   #1  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,754
Zscene - Scene change detection for Vapoursynth

Repo: https://github.com/adworacz/zscene
Version: 0.1

In a bit of "if you can't beat 'em, join 'em", I threw together a quick plugin to handle scene change detection. More specifically, it doesn't actually do any scene change detection itself (yet), but farms out to much more accurate tools like av-scenechange.

All that's currently implemented is a "ReadScenes" function that (you guessed it) reads the scene data produced by external tools and adds the pertinent scene change properties to each frame.

Use it to replace the (much outdated) "misc.SCDetect" function for automatic scene change detection.

In the future, I'll likely implement some custom scene change detection algorithms to do this all inline, but for now relying on scene change detection that's literally used in the AV1 compression algorithm is enough for most use cases.

Last edited by Adub; 2nd June 2025 at 20:59.
Adub is offline   Reply With Quote
Old 3rd June 2025, 06:31   #2  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,647
Quote:
Originally Posted by Adub View Post
Repo: https://github.com/adworacz/zscene
Version: 0.1

In a bit of "if you can't beat 'em, join 'em", I threw together a quick plugin to handle scene change detection. More specifically, it doesn't actually do any scene change detection itself (yet), but farms out to much more accurate tools like av-scenechange.

All that's currently implemented is a "ReadScenes" function that (you guessed it) reads the scene data produced by external tools and adds the pertinent scene change properties to each frame.

Use it to replace the (much outdated) "misc.SCDetect" function for automatic scene change detection.

In the future, I'll likely implement some custom scene change detection algorithms to do this all inline, but for now relying on scene change detection that's literally used in the AV1 compression algorithm is enough for most use cases.
Finally a sequel to scxvid. Scene change detection has now come full circle.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 3rd June 2025, 07:50   #3  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 957
Personally I don't think av-scenechange is good.
Sure it's better than simple pixel difference thresholding or smth, but we have mvtools which is online and faster (last time I checked it).
Taking some sort of RD cost into account (av-scenechange is taken from rav1e, so I think there must be some) can be a desired feature depending on the following process though.

Last edited by Z2697; 3rd June 2025 at 07:59.
Z2697 is offline   Reply With Quote
Old 3rd June 2025, 23:51   #4  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,754
Quote:
Finally a sequel to scxvid. Scene change detection has now come full circle.
Right you are. Only took 3 major generations of codec development...

Quote:
Personally I don't think av-scenechange is good.
Any particular data you have to back this statement? I agree that the MVTools may have advantages if you're already running an MAnalyse pass (since the scene detection built from those vectors is essentially free at that point).

av-scenechange uses 3 different metrics for scene change detection, as described in the source code: https://github.com/rust-av/av-scenec...ard.rs#L19-L21

And to clarify the av-scenechange / rav1e relationship - rav1e was the original source of the scene change detection, but it was split out as a separate module to av-scenechange and now rav1e has been updated to depend on av-scenechange directly. So they are using the exact same code at this moment.
Adub is offline   Reply With Quote
Old 4th June 2025, 05:10   #5  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 957
Quote:
Originally Posted by Adub View Post
Any particular data you have to back this statement?
I don't have. It's more like a personal preference. I don't want to consider encoding cost in the scene detection for filtering.
Plus the ability to run online.
And the speed, well I tested again, av-scenechange can be faster, even much faster if the fast mode is used, but MVTools is still fast enough.
Although, I must say they are closely related - the motion and the cost, and worth considering in many cases.
Z2697 is offline   Reply With Quote
Old 4th June 2025, 15:30   #6  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,859
I'll wait till zscene incorporates av-scenechange, since I only need the scene detection info attached to the frames not in an external file.
=> looking forward to when misc.SCDetect can be replaced.
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 5th June 2025, 05:46   #7  |  Link
Z2697
Registered User
 
Join Date: Aug 2024
Location: Between my two ears
Posts: 957
Quote:
Originally Posted by Selur View Post
I'll wait till zscene incorporates av-scenechange, since I only need the scene detection info attached to the frames not in an external file.
=> looking forward to when misc.SCDetect can be replaced.
Several alternatives to misc.SCDetect already exist though.
If we forget about the outdated XviD based ones, there're MVTools and styler00dollar's AI models (works on downscaled video so quite fast actually), and others I don't know of.
(I don't mean zscene shouldn't be one of them)

Speed-wise, I don't think there's anything that can beat misc.SCDetect because it's so simple.
Z2697 is offline   Reply With Quote
Old 9th June 2025, 04:37   #8  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,754
Quote:
I'll wait till zscene incorporates av-scenechange, since I only need the scene detection info attached to the frames not in an external file.
Just to be clear - Zscene *does* attach the scene detection info to the frames, as the standard props. It just reads the JSON file emitted by av-scenechange to do it.
Adub is offline   Reply With Quote
Old 9th June 2025, 06:26   #9  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,859
Sorry, yes, but you would still have to use something like:
Code:
vspipe -c y4m source.vpy - | av-scenechange -o scenes.json -
to create the json, right?
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 9th June 2025, 17:56   #10  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,754
Yes, that's correct, although depending on your use case, and the features (like ffmpeg support) that av-scenechange is compiled with, you can feed your source file directly to it with something like this:

Quote:
av-scenechange -o scenes.json foobar.mkv
So you can avoid the use of vapoursynth for the initial scenes collection if desired.

But in sum, you do need to run av-scenechange on your source somehow to produce the JSON that Zscene can then read.
Adub is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.