Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tetrax-10/batch-preview-generator
Generates preview videos and GIFs from videos using FFmpeg CLI in batch
https://github.com/tetrax-10/batch-preview-generator
batch-processing cli ffmpeg gif gif-creator inno-setup preview preview-generator python-cli thumbnail-generator thumbnails video-preview
Last synced: 3 months ago
JSON representation
Generates preview videos and GIFs from videos using FFmpeg CLI in batch
- Host: GitHub
- URL: https://github.com/tetrax-10/batch-preview-generator
- Owner: Tetrax-10
- License: mit
- Created: 2023-12-20T21:31:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-16T09:36:23.000Z (4 months ago)
- Last Synced: 2024-10-19T00:27:04.011Z (4 months ago)
- Topics: batch-processing, cli, ffmpeg, gif, gif-creator, inno-setup, preview, preview-generator, python-cli, thumbnail-generator, thumbnails, video-preview
- Language: Python
- Homepage:
- Size: 18 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Batch Preview Generator
**Generates preview videos and GIFs from videos using FFmpeg CLI in batch.**
## Installation
Download and install the [Latest version](https://github.com/Tetrax-10/batch-preview-generator/releases/latest) from the releases page. Done 🎉.
If you dont have [FFmpeg](https://ffmpeg.org/) installed then download the [FFmpeg included version](https://github.com/Tetrax-10/batch-preview-generator/releases/latest) or download FFmpeg from [here](https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z).
## Demo
**[PSY - GANGNAM STYLE](https://www.youtube.com/watch?v=9bZkp7q19f0) music video to this 15 seconds preview 👇**
![demo preview](https://raw.githubusercontent.com/Tetrax-10/batch-preview-generator/main/assets/demo.gif)
**Run `preview` in terminal without any arguments (flags) to initiate interactive prompts.**
![demo preview](https://raw.githubusercontent.com/Tetrax-10/batch-preview-generator/main/assets/demo.png)
**Note:** This Screenshot reflects initial release and new changes may not be represented.## CLI docs
You can use this as a CLI by just giving a valid argument(s).
The above **Gangnam Style** gif can be created with this command.
```powershell
preview -p "Gangnam Style.mp4" -s 15 -sk 7.0 -sp -g
```### Arguments
args
Full args
Description
Default
Type
-p
--path
Path of the video or folder for batch processing
CWD
string
-o
--out
Output folder for generated previews
CWD
string
-r
--resolution
Preview video resolution
360
int
-s
--segments
No. of segments in a preview video
10 (check code)
int
-sd
--sduration
Duration of a segment
1.0 (0.1 - n.n)
float
-sk
--skip
Skips the first n seconds of a video, mainly used to skip intros and filler. For movies, set this value higher according to the intro duration
20
float
-sp
--samepath
When passing this argument, the output folder is set to the input folder. when using this the --out path should be relative
present or not
-a
--audio
Previews will be generated with audio
present or not
-g
--gif
Previews will be generated in the GIF format (takes more time & space)
present or not
-f
--fps
Preview video FPS
mp4:24/gif:10
int
-q
--quality
Preview video quality (low, normal, high)
normal
string
-c
--compression
Preview video compression modes:
fast but low quality output and bigger file size.
slow gives good quality and reasonable size but little slower.
veryslow gives best quality and least file size but its very slow.
slow
string
-cli
--cli
Run as a CLI without changing default arguments. If no arguments are provided, the program will act in prompt mode. To prevent that, you can use this flag
present or not
-cuda
--cuda
Uses cuda cores for fast processing (Nvidia GPUs only)
present or not
-v
--version
Prints version info
present or not
-h
--help
Lists all commands with its description
present or not
If you want to run this as a CLI without providing or changing default arguments then just run
```sh
preview -cli
```## FAQ
### 1. What are segments `-s`, `--segments`?
Segments are small videos extracted from the input video with a duration specified by `--sduration`. For example, if you set `--segments` to **10** and `--sduration` to **2**, each segment will be **2** seconds long. Therefore, the total duration of the preview will be **20** seconds, as **10** segments each contribute **2** seconds.
### 2. From which part of the video are the segments extracted?
Let's say you set `--segments` to **3** and `--sduration` to **5**. In this scenario, the input video is evenly split into **3** parts, and the first **5** seconds from each part are extracted for previews. Subsequently, these segments are concatenated and converted into a single video or gif. Thus the resulting preview will be of **5x3 = 15 seconds**.
The red parts are extracted for previews
![segments](https://raw.githubusercontent.com/Tetrax-10/batch-preview-generator/main/assets/segments.png)
## Development
##### Environment setup
```sh
git clone https://github.com/Tetrax-10/batch-preview-generator.git
cd batch-preview-generator
pip install -r requirements.txt
```##### Run
```sh
python preview.py
```##### Build executable
```sh
pyinstaller preview.spec
```Make sure to add your "dist" folder to the PATH so that when you run preview, it refers to your "dist" executable. Additionally, also ensure that the path of the installed "preview.exe" is removed during development.
The installer is compiled with the [Inno Setup Compiler](https://jrsoftware.org/isdl.php), and there's no need to perform this step during the development of Batch Preview Generator, as it is only used for distribution
### Known bugs
1. When this program is installed and uninstalled it leaves this string ";;" in PATH environmental variable, it's not an issue as it doesn't affect the env vars but its a bloat, So please help me fix this as I'm not good with Inno Setup Compiler
### Assist required
1. Help me implement H/W acceleration for Radeon graphics as I don't have an AMD gpu.
2. Help me to build/test executable for `linux` and `mac os`.
3. Help me fix the `known bugs`.### Support
Like This Tool? Gimme Some ❤️ by Liking this Repository.