PySceneDetect
PySceneDetect copied to clipboard
Split video based on CSV file
Hi
I'm using PySceneDetect command line to generate a list of scenes, so far the result is good but some of my scenes are detected as multiple scenes.
I was thinking, is there a way to just modify the csv file generated from list-scenes (edit start/end of the frame or the timecode) and feed the csv file back again to the split-video function?
PS: I know about option -s, but it will not work in my case, some time I want to merge 2-3 actual scenes into one video during the split.
Are you manually modifying the csv file and then wanting to feed that csv back to the program to split the video? As the software is now, I don't think that is possible via command line, you would have to use the python api. You would have to feed the start and end timecodes for each scene to either the split_video_mkvmerge (ref) or split_video_ffmpeg (ref) function depending on your environment. These python functions are really just wrappers around command line functions using either mkvmerge or ffmpeg. So, a bit of bash scripting could bridge the gap without having to dip into the python api.
An option if you want to stick with python would be moviepy by importing the video file and specifying a subclip using the start and end timecodes docs. Then, save the subclip to file docs.
This does seem like a decent feature idea though...basically feed it a scene list that you might have modified using some external means and then let it do the splitting based on that csv. Tagging @Breakthrough to see if this would be in scope or not.
I think this would be feasible enough - an option could be added to split-video pointing it to a scene .csv file that contains the required splits. For now though as you said @wjs018 it might be better to just hack something together in Python that loads the scenes from the CSV and calls split_video_ffmpeg directly, just since there's so much in the backlog right now... However this might be a good first issue for a new contributor to tackle.
See #275 for a further discussion of a possible approach to implementing this.
@mrahmadt Just wanted to let you know that I took a first pass at implementing this. See #294 for usage and limitations. Let me know if you have any feedback.
This will be included in v0.6.2 as the load-scenes command (docs). Thanks @wjs018 for kicking off the implementation.