{"id":25952486,"url":"https://github.com/awkrail/shutoh","last_synced_at":"2025-03-04T14:52:06.908Z","repository":{"id":264774850,"uuid":"866941986","full_name":"awkrail/shutoh","owner":"awkrail","description":"Yet another shot detector implemented in C++, which aims a fast alternative with PySceneDetect.","archived":false,"fork":false,"pushed_at":"2025-02-24T11:03:42.000Z","size":10213,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T12:22:56.534Z","etag":null,"topics":["image-processing","scene-detection","scene-recognition","shot-detection","video","video-analysis","video-processing"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awkrail.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-03T06:54:54.000Z","updated_at":"2025-02-24T11:03:45.000Z","dependencies_parsed_at":"2024-12-24T11:21:09.902Z","dependency_job_id":"f0055e4e-a463-40fc-a7cc-fc4f1e451ac0","html_url":"https://github.com/awkrail/shutoh","commit_stats":null,"previous_names":["awkrail/scene_detector","awkrail/shutoh"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awkrail%2Fshutoh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awkrail%2Fshutoh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awkrail%2Fshutoh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awkrail%2Fshutoh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awkrail","download_url":"https://codeload.github.com/awkrail/shutoh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241868432,"owners_count":20033822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-processing","scene-detection","scene-recognition","shot-detection","video","video-analysis","video-processing"],"created_at":"2025-03-04T14:52:06.214Z","updated_at":"2025-03-04T14:52:06.903Z","avatar_url":"https://github.com/awkrail.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shutoh\n\n[![Build](https://github.com/awkrail/shutoh/actions/workflows/build.yml/badge.svg)](https://github.com/awkrail/shutoh/actions/workflows/build.yml)\n[![Python build](https://github.com/awkrail/shutoh/actions/workflows/python-build.yml/badge.svg)](https://github.com/awkrail/shutoh/actions/workflows/python-build.yml)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\n\nShutoh (手刀, meaning karate chop in Japanese) is a fast and efficient scene detection tool implemented in C++20.\nInspired by [PySceneDetect](https://github.com/Breakthrough/PySceneDetect), Shutoh aims to provide a powerful and flexible alternative with enhanced performance. The key features of Shutoh is threefold:\n- **Fast**: Shutoh leverages the speed of C++ for faster processing compared to PySceneDetect.\n- **Compatibility**: Designed to produce outputs comparable to PySceneDetect as much as possible.\n- **Flexible**: Supports both rule-based and machine-learning-based approaches.\n\n## Installation\n\n### Build from Source\nEnsure that FFmpeg, OpenCV, and CMake are installed.\n```\nsudo apt install libopencv-dev ffmpeg cmake\n```\nTo build `shutoh` with `cmake`, run:\n```shell\ncmake -S . -B build\ncmake --build build\nsudo make install\n```\n\n## Quick Start (Command Line)\nI focus on three commands: `split-video`, `list-scenes`, and `save-images`.\nSplit an input video into cuts:\n```\n./build/shutoh_cli -i video/input.mp4 -c split-video\n```\nSave scenes as csv file:\n```\n./build/shutoh_cli -i video/input.mp4 -c list-scenes\n```\n\n## API\n### Python\nInstall `libshutoh` by running:\n```\npip install git+https://github.com/awkrail/shutoh.git\n```\nTo detect scenes with `ContentDetector()`, run the following code:\n```python\nfrom libshutoh import detect, ContentDetector\ndetector = ContentDetector.initialize_detector()\nscenes = detect('video/input.mp4', detector)\n```\n\n### C++\nThe simpletest code is as follow:\n```cpp\n#include \"shutoh/video_stream.hpp\"\n#include \"shutoh/frame_timecode.hpp\"\n#include \"shutoh/scene_manager.hpp\"\n#include \"shutoh/frame_timecode_pair.hpp\"\n#include \"shutoh/detector/content_detector.hpp\"\n\nint main() {\n    VideoStream video = VideoStream::initialize_video_stream(\"video/input.mp4\").value();\n    auto detector = ContentDetector::initialize_detector();\n    SceneManager scene_manager = SceneManager(detector);\n    scene_manager.detect_scenes(video);\n    std::vector\u003cFrameTimeCodePair\u003e scene_list = scene_manager.get_scene_list().value();\n\n    for (auto\u0026 scene : scene_list) {\n        const FrameTimeCode start = std::get\u003c0\u003e(scene);\n        const FrameTimeCode end = std::get\u003c1\u003e(scene);\n        std::cout \u003c\u003c \"Start Time: \" \u003c\u003c start.to_string() \u003c\u003c \" Frame: \" \u003c\u003c start.get_frame_num()\n        \u003c\u003c \" / End Time: \" \u003c\u003c end.to_string() \u003c\u003c \" Frame: \" \u003c\u003c end.get_frame_num() \u003c\u003c std::endl; \n    }\n}\n```\nTo compile the code, run the following g++ command (replace `-I` and `-L` with your directory):\n```\ng++ -std=c++20 -I/path/to/shutoh/include -I/usr/include/opencv4 main.cpp -L/path/to/shutoh/build -lopencv_core -lopencv_videoio -lfmt -Wl,-rpath,/path/to/build -lshutoh_lib\n```\nOr you can use for example FetchContent:\n```cmake\ninclude(FetchContent)\nFetchContent_Declare(\n  shutoh\n  GIT_REPOSITORY https://github.com/awkrail/shutoh.git\n  GIT_TAG main\n)\nFetchContent_MakeAvailable(shutoh)\ntarget_link_libraries(YOUR_LIBRARY PUBLIC shutoh OTHER_LIBRARIES)\n```\n\n## Tests\nRun test using `ctest`:\n```shell\ncd build\nctest\n```\n\n## Contribution\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## LICENSE\nMIT License\n\n## Contact\nTaichi Nishimura ([taichitary@gmail.com](taichitary@gmail.com))\nCopyright (C) 2024-2025 Taichi Nishimura.\nAll rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawkrail%2Fshutoh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawkrail%2Fshutoh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawkrail%2Fshutoh/lists"}