Magic Ffmpeg Calls - Gists · GitHub
Maybe your like
Skip to content Search Gists Search Gists All gists Back to GitHub Sign in Sign up Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }}
cknd/ffmpeg calls Last active March 25, 2025 17:30 Show Gist options
Raw multi_ffmpeg.sh This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment You can’t perform that action at this time.
Instantly share code, notes, and snippets.
- Download ZIP
- Star (0) You must be signed in to star a gist
- Fork (0) You must be signed in to fork a gist
- Embed Select an option
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/cknd/c61f841040884759e54ef4a9cc398604.js"></script> - Save cknd/c61f841040884759e54ef4a9cc398604 to your computer and use it in GitHub Desktop.
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/cknd/c61f841040884759e54ef4a9cc398604.js"></script> Save cknd/c61f841040884759e54ef4a9cc398604 to your computer and use it in GitHub Desktop. Download ZIP magic ffmpeg calls Raw ffmpeg calls This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters| # pack a bunch of images into a nice-looking gif running at 5 fps (with rescaling and a proper color palette) |
| ffmpeg -f image2 -r 5 -i %*.png -vf "scale=450:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" out.gif |
| # convert section of video to gif (with palette, rescale and slowdown) |
| ffmpeg -ss 00:00:43 -to 00:00:49.5 -i input.mp4 -r 15 -vf "scale=300:-1,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse,setpts=2.0*PTS" out.gif |
| # shrink a video (half the size and _slightly_ lower quality) |
| ffmpeg -i input.mp4 -vf scale="iw/2:ih/2" -crf 30 output.mp4 |
| #!/usr/bin/env bash |
| # Re-compress a whole folder of videos to some maximum size |
| # |
| # Usage: |
| # ./multi_ffmpeg.sh /path/to/folder/of/videos |
| # |
| # Output is written to new folder /path/to/folder/of/videos_encoded |
| # |
| set -e |
| MAX_PIXELS=1440 # max pixels on the longest side of the video. larger videos will be shrunk, smaller ones stay small. |
| CRF=22 # bigger number = more compression. https://trac.ffmpeg.org/wiki/Encode/H.264#a1.ChooseaCRFvalue |
| INPUT_DIR="$1" |
| [ -z "$INPUT_DIR" ] && { echo "Usage: $0 /path/to/folder"; exit 1; } |
| OUTPUT_DIR="${INPUT_DIR}_encoded" |
| mkdir -p "$OUTPUT_DIR" |
| for file in "$INPUT_DIR"/*; do |
| [ -f "$file" ] || continue |
| base="$(basename "$file")" |
| base_no_ext="${base%.*}" |
| out="$OUTPUT_DIR/${base_no_ext}.mp4" |
| echo "Processing $file -> $out" |
| # re-encode with |
| # - scale of the largest side <= MAX_PIXELS |
| # - pixel format yuv420p because not every player understands yuv444 |
| # - something something for audio |
| ffmpeg -i "$file" \ |
| -vf "scale='if(gte(iw,ih),min(iw,$MAX_PIXELS),-2)':'if(gte(ih,iw),min(ih,$MAX_PIXELS),-2)'" \ |
| -c:v libx264 \ |
| -pix_fmt yuv420p \ |
| -crf $CRF \ |
| -c:a aac -b:a 128k \ |
| -y "$out" |
| done |
| echo "All done! Encoded files are in: $OUTPUT_DIR" |
Tag » Color Palette Ffmpeg
-
(FFmpeg) How To Generate A Color Palette From A Video And Apply ...
-
Generate Color Palette From An Image For FFmpeg - Stack Overflow
-
How Can I Extract A 327-color Palette From A Digital Video?
-
How Can I Limit The Number Of Colors Used In A GIF File While ...
-
Palettegen - FFmpeg
-
Colorspace - FFmpeg Wiki
-
How To Create GIFs With FFmpeg - Medium
-
Mp4 To Gif Without Losing Color Info : R/ffmpeg - Reddit
-
How To Make A GIF From A Video Using FFmpeg - Bannerbear
-
More Ffmpeg Tips - BIT-101
-
Great Image Quality! Definitely Better A Lot Than Ffmpeg With Palette ...
-
[FFmpeg-user] How To Associate A Palette To DVD Subtitle ?
-
Weird Question About Retro 16-color Video - VideoHelp Forum