https://github.com/13rac1/autovidloop
Trim a video to create a loop by finding the frame least different from the first
https://github.com/13rac1/autovidloop
loop trim video video-processing
Last synced: 3 months ago
JSON representation
Trim a video to create a loop by finding the frame least different from the first
- Host: GitHub
- URL: https://github.com/13rac1/autovidloop
- Owner: 13rac1
- Created: 2019-07-01T09:54:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-03T22:41:56.000Z (over 1 year ago)
- Last Synced: 2025-04-01T18:12:48.386Z (3 months ago)
- Topics: loop, trim, video, video-processing
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Auto Video Looper
Attempt to automatically trim a video to create a loop by finding the video
frame least different from the first frame. The method is bruteforce, so can
take significant processing time on large source files.Works well enough for my needs. YMMV. ¯\\_(ツ)_/¯
## Install
```bash
pip3 install https://github.com/13rac1/autovidloop/archive/master.zip
# TODO: Upload to pip?
```## Usage
```bash
$ autovidloop -h
usage: autovidloop [-h] [--output FILENAME] [--start N] [--skip N] FILENAMEAttempt to automatically trim a video to create a loop by finding the frame least
different from the first frame.positional arguments:
FILENAME a video file readable by FFMPEGoptional arguments:
-h, --help show this help message and exit
--output FILENAME an output filename (default is "loop.mp4")
--start N frame to start processing (default: 1)
--skip N number of frames to skip after the first for diff calculations
(default: 30)
```## Notes
```bash
# Trim a video with ffmpeg
ffmpeg -i input.mp4 -vf select="between(n\,0\,200),setpts=PTS-STARTPTS" \
-c:v libx264 -strict -2 -r 30 -pix_fmt yuv420p output.mp4
```