Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidalgis/convertvideotoimages
Convert a video to a series of png
https://github.com/davidalgis/convertvideotoimages
image mp4 png python remove-background video
Last synced: 6 days ago
JSON representation
Convert a video to a series of png
- Host: GitHub
- URL: https://github.com/davidalgis/convertvideotoimages
- Owner: davidAlgis
- License: mit
- Created: 2024-02-25T14:59:56.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-06T09:47:11.000Z (6 months ago)
- Last Synced: 2024-05-06T10:59:33.649Z (6 months ago)
- Topics: image, mp4, png, python, remove-background, video
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Video to PNG Converter
This Python script converts videos to a series of PNG images, allowing users to specify the frame rate at which images are saved. Additionally, it offers an option to remove the background from each image before saving.
## Installation
To run this script, you'll need to ensure you have the required Python libraries. Install them using the `requirements.txt` file provided in this repository.
## Installation
To run this script, you'll need to ensure you have the required Python libraries. Install them using the `requirements.txt` file provided in this repository.
```
pip install -r requirements.txt
```## Usage
Ensure you have Python 3.6 or newer installed on your system. Clone this repository or download the script and `requirements.txt` file. Then, install the required libraries as mentioned above.
To use the script, run it from the command line with the desired options:
```
python video_to_png.py [options]
```## Options
- `-i`, `--input` : Specify the path to the input video file. If not provided, the script will attempt to use the first video file found in the current directory.
- `-o`, `--output` : Specify the path to the output folder where PNG images will be saved. If not specified, images are saved to a default `output` directory at the root of the program.
- `-f`, `--fps` : Specify the number of frames per second to save. By default, all frames are saved (`-1`). Setting this to a positive number will save frames at the specified rate.
- `-r`, `--remove_bg`: Enable background removal from each image before saving. By default, this feature is disabled.
- `-c`, `--crop` "((left, up), (right, lower))": Crop the image with two corner left up and right down. By default, this feature is disabled.
- `-h`, `--help`: Display help information showing all command-line options.
## Example
To convert a video named `example.mp4` into PNG images, saving every frame, with the background removed, and write them to the `./output_images` directory, you can use the following command:
```
python video_to_png.py -i example.mp4 -o ./output_images -r
```If you want to save images at 10 frames per second without removing backgrounds, you would use:
```
python video_to_png.py -i example.mp4 -o ./output_images -f 10
```If you want to crop images too, you can use this updated command:
```
python video_to_png.py -i example.mp4 -o ./output_images -f 10 -c "((345,342),(865,1660))"
```## Issues
If you encounter any issues or have suggestions for improvements, please submit them to the GitHub issue tracker for this project.