Just a nifty alias to make it automatically display in browser
Problem/Use Case
Just an alias to make it display asap, independent of the input filename. May come in handy for some or can be added as a switch in later versions.
Proposed Implementation:
alias scenedetectme='function _scenedetect() {
OUTPUT_FILE="$(dirname "$1")/$(basename "${1%.*}")-Scenes.html"
time scenedetect -i "$1" --verbosity info save-images -o "$(dirname "$1")" export-html
echo "Exported to: $OUTPUT_FILE. Opening it with Google Chrome ...".
google-chrome "$OUTPUT_FILE"
}; _scenedetect'
Output:
~$ scenedetectme "/TOSH-P2_Data_Public/Video/Test_detect/Military robots clearing.mp4"
[PySceneDetect] PySceneDetect 0.6.4
[PySceneDetect] Image output format set: JPEG [Quality: 95]
[PySceneDetect] Image output directory set:
/TOSH-P2_Data_Public/Video/Test_detect
[PySceneDetect] HTML file name format:
$VIDEO_NAME-Scenes.html
[PySceneDetect] Downscale factor set to 4, effective resolution: 256 x 144
[PySceneDetect] Detecting scenes...
Detected: 5 | Progress: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 748/748 [00:02<00:00, 337.08frames/s]
[PySceneDetect] Processed 748 frames in 2.3 seconds (average 330.48 FPS).
[PySceneDetect] Detected 6 scenes, average shot length 5.0 seconds.
[PySceneDetect] Generating output images (3 per scene)...
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 18/18 [00:02<00:00, 6.30images/s]
[PySceneDetect] Exporting to html file:
/TOSH-P2_Data_Public/Video/Test_detect/Military robots clearing-Scenes.html:
real 0m7.356s
user 0m22.813s
sys 0m2.058s
Exported to: /TOSH-P2_Data_Public/Video/Test_detect/Military robots clearing-Scenes.html. Opening it with Google Chrome ....
Opening in existing browser session.
Environment: Any, methinks.
I agree, this is an interesting idea to provide a bit of interactivity to the export-html command. The webbrowser module should suit this purpose well, and is already available.
Aside: we should also consider removing the need to specify save-images together with export-html, and just have the latter invoke the former with whatever the config file values are.
Thanks for the suggestion!
You had mentioned removing the need to specify both commands all the way back in #17. I am not really that good with the cli stuff, so I can't really make too much sense of how to invoke the save-images command from within the export-html command, but there has to be some way. Also, it would be nice if, when the --no-images flag is set, the save-images command is not invoked.