avtools is a command-line tool developed using Swift, designed to perform various operations on audio and video files. It leverages Swift's ArgumentParser for handling command-line parsing and AVFoundation for processing media tasks.
The avtools CLI is an educational program created to demonstrate how to utilize AVFoundation capabilities from the terminal. It allows developers to learn how to manipulate audio and video files using Swift and AVFoundation.
avtools supports a wide range of operations on audio and video files, including:
- Converting images to video
- Overlaying sound on a video
- Overlaying text on a video
- Changing the speed of a video
- Generating images from a video
- Extracting audio from a video
- Merging multiple videos
- Splitting a video
- Extracting video without audio
- Rotating a video
- Trimming a video
- Cropping a video
- Overlaying an image on a video
To use avtools, you need to have Swift installed on your system. Clone the repository and build the project using Swift Package Manager (SPM).
git clone https://github.com/skyfe79/avtools.git
cd avtools
swift buildAfter building the project, you can run avtools from the command line. Here are some examples of how to use the various commands:
swift run avtools images-to-video --images-folder ./assets/images --duration 1.5 --output iv2.movswift run avtools overlay-sound --input ./assets/video.mov --sound ./assets/bgm.mp3 --output video_with_sound.movswift run avtools overlay-text --input ./assets/video.mov --output ot3.mov --text 'Hello World' --color '#FF5733FF'swift run avtools speed --input ./assets/video.mov --output s1.mov --speed 3.0swift run avtools generate-images --input ./assets/video.mov --output images --times 1.0 2.0 3.0swift run avtools extract-audio --input ./assets/video.mov --output only_audio.m4aswift run avtools merge --input ./assets/splits --output merged2.movswift run avtools split --input ./assets/video.mov --output splitted_videos --duration 1.0swift run avtools extract-video --input ./assets/video.mov --output only_video.movswift run avtools rotate --input ./assets/video.mov --output rv.mov --angle 180swift run avtools trim --input ./assets/video.mov --output t2.mov --start 2 --end 4swift run avtools crop --input ./assets/video.mov --output c.mov --crop-rect "0 0 100 100"swift run avtools overlay-image --input ./assets/video.mov --image ./assets/cat.png --start 1.0 --duration 2.0 --output video_with_overlay.movFor more detailed information on each command and its options, refer to the help provided by the tool itself using the --help flag.