Created
April 8, 2025 11:18
-
-
Save UmairJibran/7bd8b8427b053794b6e16a57028e3fb5 to your computer and use it in GitHub Desktop.
video for random colors via ffmpeg
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
| mkdir -p frames | |
| # Generate 120 solid-color frames (30 seconds @ 4 fps = 0.25s per frame) | |
| for i in {1..120}; do | |
| COLOR=$(openssl rand -hex 3) | |
| FRAME_NUM=$(printf %03d $i) | |
| magick -size 640x480 xc:"#${COLOR}" \ | |
| -gravity center \ | |
| -fill white \ | |
| -pointsize 72 \ | |
| -annotate +0+0 "Frame ${FRAME_NUM}" \ | |
| "frames/frame${FRAME_NUM}.png" | |
| done | |
| # Create video from frames | |
| ffmpeg -framerate 4 -i frames/frame%03d.png -c:v libx264 -pix_fmt yuv420p color_test_video.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment