diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-11 15:52:12 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-11 15:52:12 +0100 |
| commit | eb147aa3c7f3bbbd3fba3f256d3366253d5b627f (patch) | |
| tree | a07fffe168822fbfaba7784bfd18687e3dcaa9a9 /.bashrc | |
| parent | b5bea4b45f75919b88b7c985799e15f35b89731b (diff) | |
| download | dotfiles-eb147aa3c7f3bbbd3fba3f256d3366253d5b627f.tar.gz dotfiles-eb147aa3c7f3bbbd3fba3f256d3366253d5b627f.zip | |
bash: Add function for converting video to gif
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to '.bashrc')
| -rw-r--r-- | .bashrc | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -142,6 +142,21 @@ alias random_string="cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head - # Cargo environment. source_maybe "$HOME/.cargo/env" +# Convert the given video into GIF. I have tested this with webM and it appears +# to work fine. This is just a wrapper for ffmpeg, but oh boy it's hard to +# remember anything ffmpeg-related... +# +# It accepts two parameters: scale (defaults to 320); and fps (defaults to 10). +# +# Taken from some random answer from StackOverflow, no longer remember from. If +# you see this and recognize it: thanks! and just give me a ping for +# acknowledging you. +video2gif() { + ffmpeg -y -i "${1}" -vf fps=${3:-10},scale=${2:-320}:-1:flags=lanczos,palettegen "${1}.png" + ffmpeg -i "${1}" -i "${1}.png" -filter_complex "fps=${3:-10},scale=${2:-320}:-1:flags=lanczos[x];[x][1:v]paletteuse" "${1}".gif + rm "${1}.png" +} + ## # RISC-V |
