Created
June 27, 2020 00:28
-
-
Save SpangleLabs/eda4c931e09a9dda194ad52cf83fa9bd to your computer and use it in GitHub Desktop.
Testing PySceneDetect and ffmpeg, experimenting to find a fast and correct solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------- | |
time ffmpeg -y -ss 00:00:42.543 -i 014092.mp4 -to 00:01:07.534 -sn output-02.mp4 | |
real 4m7.826s | |
user 5m19.675s | |
sys 0m33.276s | |
Result: Started at right place, cut video to 1m7s long (??) | |
--------- | |
time ffmpeg -y -i 014092.mp4 -ss 00:00:42.543 -to 00:01:07.534 -sn output-03.mp4 | |
real 1m31.886s | |
user 2m1.006s | |
sys 0m13.614s | |
Result: cut correctly | |
--------- | |
time ffmpeg -y -ss 00:00:42.543 -i 014092.mp4 -t 24.992 -sn output-04.mp4 | |
real 2m23.862s | |
user 1m52.849s | |
sys 0m26.881s | |
Result: Seems to have cut correctly? | |
--------- | |
pip uninstall scenedetect | |
pip install git+https://github.com/joshcoales/PySceneDetect.git@cut-video-without-final-frame | |
time scenedetect -i 014092.mp4 detect-content split-video | |
real 8m55.310s | |
user 13m46.013s | |
sys 0m51.304s | |
result: all good | |
--------- | |
pip uninstall scenedetect | |
pip install scenedetect | |
time scenedetect -i 014092.mp4 detect-content split-video | |
real 6m52.787s | |
user 10m57.887s | |
sys 0m30.425s | |
Result: all broken | |
--------- | |
time scenedetect -i 014092.mp4 detect-content list-scenes | |
real 2m1.762s | |
user 3m10.816s | |
sys 0m4.113s | |
Result: | |
----------------------------------------------------------------------- | |
| Scene # | Start Frame | Start Time | End Frame | End Time | | |
----------------------------------------------------------------------- | |
| 1 | 0 | 00:00:00.000 | 1275 | 00:00:42.543 | | |
| 2 | 1275 | 00:00:42.543 | 3194 | 00:01:46.573 | | |
| 3 | 3194 | 00:01:46.573 | 3507 | 00:01:57.017 | | |
| 4 | 3507 | 00:01:57.017 | 5107 | 00:02:50.404 | | |
| 5 | 5107 | 00:02:50.404 | 6136 | 00:03:24.738 | | |
| 6 | 6136 | 00:03:24.738 | 10310 | 00:05:44.010 | | |
----------------------------------------------------------------------- | |
--------- | |
time ffmpeg -y -ss 42.543 -i 014092.mp4 -t 24.992 -sn output-05.mp4 | |
real 1m36.028s | |
user 1m52.412s | |
sys 0m25.246s | |
Result: Seems to have cut correctly? | |
--------- | |
vi ~/.local/lib/python3.6/site-packages/scenedetect/video_manager.py # Modifying to print the ffmpeg command | |
time scenedetect -i 014092.mp4 detect-content split-video | |
print command: | |
['ffmpeg', '-v', 'error', '-y', '-ss', '00:01:46.573', '-i', '/mnt/md0/samba/private/bot/gif_pipeline/experiment/014092.mp4', '-c:v', 'libx264', '-preset', 'veryfast', '-crf', '22', '-c:a', 'copy', '-strict', '-2', '-t', '00:00:10.444', '-sn', '014092-Scene-003.mp4'] | |
--------- | |
time ffmpeg -y -ss 42.543 -i 014092.mp4 -c:v libx264 -strict -2 -t 24.992 -sn output-06.mp4 | |
real 1m51.412s | |
user 1m52.299s | |
sys 0m24.275s | |
Result: seems to have worked_ | |
--------- | |
time ffmpeg -y -ss 42.543 -i 014092.mp4 -c:v libx264 -preset veryfast -strict -2 -t 24.992 -sn output-07.mp4 | |
real 0m22.345s | |
user 0m36.594s | |
sys 0m0.481s | |
Result: seems to have worked? | |
--------- | |
time ffmpeg -y -ss 42.543 -i 014092.mp4 -c:v libx264 -preset veryfast -crf 22 -c:a copy -strict -2 -t 24.992 | |
-sn output-08.mp4 | |
real 0m20.465s | |
user 0m36.603s | |
sys 0m0.339s | |
Result: broken | |
--------- | |
time ffmpeg -y -ss 42.543 -i 014092.mp4 -c:v libx264 -preset veryfast -crf 22 -strict -2 -t 24.992 -sn outpu | |
t-09.mp4 | |
real 0m20.576s | |
user 0m37.407s | |
sys 0m0.349s | |
result: seems to have worked | |
--------- | |
time ffmpeg -y -ss 42.543 -i 014092.mp4 -c:v libx264 -preset veryfast -crf 22 -c:a aac -strict -2 -t 24.992 | |
-sn output-10.mp4 | |
real 0m20.781s | |
user 0m37.524s | |
sys 0m0.468s | |
Result: working |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment