Pluto is a library of scripts for working with media files. This library provides various functionalities such as resizing images, creating video from images or documents, and encoding files into differnt formats.
Sometimes you need a quick way to work with media files. For example:
- Creating a slideshow video from a set of images
- Converting image and video file into browser-friendly formats
- Generating responsive images for a website scaled to various sizes
If you find yourself working with media files often, it may be helpful to have a library to automate your workflows.
To use the library, follow the prerequisites below and run from your terminal.
Before using this library, make sure you have the following software installed on your machine:
- FFmpeg: FFmpeg is a command-line tool used for handling multimedia data. It can be downloaded from the official FFmpeg website: https://ffmpeg.org/
- ImageMagick: ImageMagick is a software suite used to create, edit, and compose bitmap images. You can download ImageMagick from the official website: https://imagemagick.org/
To get started, check out the table of contents below and follow these steps:
-
Decide which 🪄 command 💫 you'd like to apply to your media files
-
Store your media files in the
assets
directory in this repo -
Run the name of the command from your terminal like so:
sh index.sh <command> <file1> <file2> <option1>
-
Check the
assets
directory for the created file
- Convert multiple images to video
- Convert image to video
- Convert image to WebP
- Convert PDF to video
- Convert video to GIF
- Convert video to MP4
- Convert video or audio to OGG
- Convert video to WebM
- Edit two images and/or videos to display next to each other, horizontally
- Resize an image
- Extract clip from a video
- Extract frames from a video
- Modify video speed
This command can encode multiple image files into an MP4 video file. Pass in the desired transition (you can find all the available options in the FFmpeg documentation), duration, and files you'd like to join.
Usage:
sh index.sh multiple-images-to-video hblur 12 assets/image1.png assets/image2.png assets/image3.png assets/image4.png
This command can encode an image file into an MP4 video file. Pass in the desired frame rate and duration. Frame rate will default to 24 frames per second and duration will default to 10 seconds.
Usage:
sh index.sh image-to-video assets/image.png 24 10
This command can encode image files into a WebP file format.
Usage:
sh index.sh webp assets/image.png
This command allows you to turn a PDF with multiple pages into a slideshow video with an audio track.
Usage:
sh index.sh pdf-to-mp4 assets/document.pd4 audio.mp3
This command will convert a video file into a GIF file format.
Usage:
sh index.sh gif assets/video.mp4
This command can encode GIF or other video files into an MP4 file format.
Usage:
sh index.sh mp4 assets/example.gif
This command can encode GIF or other video files into an OGG file format.
Usage:
sh index.sh ogg assets/example.gif
This command can encode GIF or other video files into a WebM file format.
Usage:
sh index.sh webm assets/example.gif
This command will stack two images or videos next to each other, horizontally.
Usage:
sh index.sh hstack assets/image.png assets/image2.png
This command will resize an image to a desired scale. Pass in a file and the scale you want to resize the image into as a decimal, e.g. 0.5 for for 50%.
Usage:
sh index.sh resize assets/image.png 0.5
This command will extract a clip from the video using timestamps. The command requires a start and end timestamp following this format: HH:MM:SS.
Usage:
sh index.sh extract-clip assets/video.mp4 00:00:05 00:00:20
This command will extract N number of frames from a video. Pass in a video file and the frames per second as a decimal, e.g. 1 for an image every 1 second, 2 for 2 images every 1 second, 0.25 for an image every 4 seconds.
Usage:
sh index.sh video-to-image assets/video.mp4 0.5
This command will speed up or slow down a video. Pass in a video file and the speed as a decimal, e.g. 2 to slow down the video, 0.5 to double the speed of the video.
Usage:
sh index.sh modify-video-speed assets/video.mp4 0.5
Feel free to explore these scripts and open any issues if there's something you'd like to see added, or open a pull request to add new scripts.