Skip to content

Instantly share code, notes, and snippets.

@mrandrewandrade
Last active March 16, 2024 17:32
Show Gist options
  • Save mrandrewandrade/018b5d68bc5890d16aa0a371442f6a43 to your computer and use it in GitHub Desktop.
Save mrandrewandrade/018b5d68bc5890d16aa0a371442f6a43 to your computer and use it in GitHub Desktop.
Commonly used command line

Video Editing

Cut a video 8 seconds to 21 seconds

ffmpeg -ss 00:00:08 -to 00:00:21 -i input.mp4 -c copy output.mp4

Convert mp4 to gif

ffmpeg -t 20 -i input.mp4 -vf "fps=10,scale=350:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif

Remove a word from a folder

mmv -r 'ABC DEF *' '#1'

Combine images into a pdf

convert $(ls -v *.jpg) foobar.pdf

Compine MP4s

Put all the files into a single folder

$ ls > mylist.txt

Edit the file using VIM to look like: file '/path/to/file1' file '/path/to/file2' file '/path/to/file3'

$ ffmpeg -f concat -i mylist.txt -c copy output.mp4

Convert webp to png recursively

install parallel and webp: sudo aptitude install parallel webp

find . -name "*.webp" -print0 | parallel -0 dwebp {} -o {.}.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment