Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support PySceneDetect scene CSV format #1

Closed
schtritoff opened this issue May 2, 2023 · 7 comments
Closed

support PySceneDetect scene CSV format #1

schtritoff opened this issue May 2, 2023 · 7 comments

Comments

@schtritoff
Copy link

schtritoff commented May 2, 2023

Hi

I'm extracting scenes/chapters from a video file by using PySceneDetect since it is really established solution. The problem is that PySceneDetect is focused on scene detection and then video splitting; to output detected scenes to some wide used format is not prioritized even though this is on roadmap https://github.com/Breakthrough/PySceneDetect/blob/master/docs/features.md#version-roadmap

Is there a way to support PySceneDetect CSV scene (chapter) format (example attached) as an import so that it can be edited and converted to other formats supported by your tool?
kazeta5.23-04-15_20-13.00-Scenes.csv

The CSV is generated on list-scenes command and is handled by this piece of code: https://github.com/Breakthrough/PySceneDetect/blob/aa97ed212584447ecd69cb97bf72b4d14277949e/scenedetect/scene_manager.py#L182

@Mtillmann
Copy link
Owner

That's a good suggestion and I think it'll be easy to implement but I don't know when I'll come around to do it

@schtritoff
Copy link
Author

Found implementation of PySceneDetect scene CSV file parser in python - should make implementation easier: https://github.com/Mirellanmawl/PySceneDetect-CSV-to-Vegas-EDL/blob/44ecab10f12f480858b42d97e97b2ecd419b5208/PySceneDetect%20CSV%20to%20Vegas%20EDL.py#L9

@Mtillmann
Copy link
Owner

Thanks! I'll ping you here when I've made some progress. Are you interested in CLI or Browser usage?

@schtritoff
Copy link
Author

CLI since I'm trying to automate these steps:

  • capture raw video
  • process audio and video using avisynth
  • detect scenes/chapters using PySceneDetect, convert resulting scenes CSV using your chaptertool to some supported chapter file like nero, apple or matroska
  • mux audio, video and chapters to resulting MKV or MP4 file

@schtritoff
Copy link
Author

Found implementation of PySceneDetect scene CSV file parser in python - should make implementation easier: https://github.com/Mirellanmawl/PySceneDetect-CSV-to-Vegas-EDL/blob/44ecab10f12f480858b42d97e97b2ecd419b5208/PySceneDetect%20CSV%20to%20Vegas%20EDL.py#L9

Another thing found regarding PySceneDetect scene CSV file - it could have first line omitted when generated by list-scenes -s switch (reference Breakthrough/PySceneDetect#136 (comment)) and then it emits just a simple standard CSV file - attached here kazeta5.23-04-15_20-13.00-Scenes-without-extra-row.csv.

@Mtillmann
Copy link
Owner

I've added the format and published on npm. You should be able to use it instantly if you use npx

@devinellis
Copy link

Sorry for commenting on a closed issue. I cannot get convert to recognize the --format flag. It always outputs JSON:

$ npx chaptertool@latest convert ./Scenes.csv --format mkvmergesimple
{
  imagePrefix: '',
  writeEndTimes: true,
  psdFramerate: 23.976,
  psdOmitTimecodes: false
}
{"version":"1.0.0","chapters":[{"startTime":0,"endTime":0.099},{"startTime":0.1,"endTime":42.174},{"startTime":42.175,"endTime":108.24},{"startTime":108.241,"endTime":206.806},{"startTime":206.807,"endTime":471.67},{"startTime":471.671,"endTime":524.256},{"startTime":524.257,"endTime":723.589},{"startTime":723.59,"endTime":820.053}]}

This is in GitBash on Windows. BTW I tried generate too but if I try to set a flag like scene-value I get Node errors.

My goal is to auto detect camera cuts and write them to my MKVs as chapter markers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants