PySceneDetect icon indicating copy to clipboard operation
PySceneDetect copied to clipboard

Feature Request: Adding template variables for timecodes for split-video output

Open LeVolve opened this issue 2 years ago • 1 comments

I asked myself if it's possible to add variables like the beginning and ending timestamp of the current clip besides of the current scene number. To save it in the filename in order to sort and organize the scenes better. A variable like the current scene number is already available and I think it shouldn't be that diffcult. I mean in the Excel table are already these variables saved and they can use it more through that feature.

For example: I have a video file named "video" and use the command "scenedetect --input video.mp4 detect-content split-video" The new command could looks like this "scenedetect --input video.mp4 --output .../Folder/%FILENAME%-%CURRENT SCENE%-%START TIMESTAMP%-%END TIMESTAMP% detect-content split-video"

My output looks like this: video-Scene-001.mp4 video-Scene-002.mp4 video-Scene-003.mp4

And it could be like this: video-Scene-001-00;00;04-00;00;09.mp4 video-Scene-002-00;00;09-00;00;15.mp4 video-Scene-003-00;00;15-00;00;20.mp4

From this: [FILENAME]-[CURRENT SCENE] To this: [FILENAME]-[CURRENT SCENE]-[START TIMESTAMP]-[END TIMESTAMP] It would be very useful for sorting and searching if I can use variables in my command. Additionally it also can be added other variabe like start and end frame and many others.

LeVolve avatar Aug 15 '21 13:08 LeVolve

This is a great idea, @LeVolve, thanks for the submission. This is certainly possible!

The only thing I'm not sure about is the best way to approach formatting and how the user can specify that, although another CLI argument can be added to deal with that if required (my initial thought is to use :/. as separators instead of ;/, but I know the latter is more widely used in industry).

Currently there is only $VIDEO_NAME and $SCENE_NUMBER, so will look into adding the following:

  • $START_TIME
  • $END_TIME
  • $START_FRAME
  • $END_FRAME

Additionally $FRAME_NUMBER should also be added as a template variable for the save-images command.

I'll need to figure out when this can be planned for given the ongoing refactoring required for v1.0, but I'm not opposed to having this merged into the v0.5.x branch either if someone wants to take this on.

Breakthrough avatar Aug 15 '21 23:08 Breakthrough

@LeVolve Wanted to let you know that this has been implemented and merged into the v0.6.1 branch. Feel free to try it out. For details on the new naming options see #291. One thing to note is that this only works with the ffmpeg splitter backend (this is the default anyway) because mkvmerge does not allow the same kind of renaming of output files.

wjs018 avatar Oct 17 '22 04:10 wjs018