a personal project to make an ffmpeg wrapper that trims videos, sets target file size
ddmpeg -i <input> -o <output> [-r <range>] [-s <size>] [-m <1[,...]>] [-d]
flag | description | usage |
---|---|---|
input or i |
specify input file | -i infile.mp4 |
output or o |
specify output file | -o outfile.mp4 |
trim or t |
specify trim range. must contain a dash, remove one argument to specify the start/end of the video | -t 2m40s:3m |
size or s |
specify target size of video | -s 4m (4 MB) |
merge or m |
merge audio tracks into one track, can optionally specify weights for each track. All unlisted tracks assume 1 as the weight. |
-m or -m 2,3 |
- Trim video to only include 3min to 3min 30sec
ddmpeg -i in.mp4 -o out.mp4 -t 3m:3m30s
- Trim video to include everything after 4mins 34.3secs
ddmpeg -i in.mp4 -o out.mp4 -t 4m34.3s:
- Trim video to only include the first 30 seconds
ddmpeg -i in.mp4 -o out.mp4 -t :30s
- Merge audio tracks with equal weights
ddmpeg -i in.mp4 -o out.mp4 -m 1
- Merge audio tracks, with the second track being louder than the first
ddmpeg -i in.mp4 -o out.mp4 -m 1,5
- Try to shoot for a 30MB video
ddmpeg -i in.mp4 -o out.mp4 -s 30m
- Share your Valorant clip!
- Your clipping software captures 5 minutes, but you only want the last 30 seconds.
- The first audio stream has your desktop sounds, and the second audio stream has your microphone sounds.
- Your microphone was pretty loud, so you want to make sure that has less weight when we mix the streams.
- You're going to share this on Discord, so you can't let it go over 100MB
ddmpeg -i in.mp4 -o out.mp4 -t 4m30s: -m 3,1 -s 75m
- install deno
- clone this repo
- https:
git clone https://github.com/deanveloper/ddmpeg
- ssh:
[email protected]:deanveloper/ddmpeg.git
- https:
deno compile --allow-read --allow-run main.ts
cp
the newly created binary somewhere in your PATH (ie/usr/local/bin
on *nix)