title: Make A Static Music Video tags: ffmpeg video Often I'll want to make a video with a static image so as to upload some music to youtube. These scripts take an image, resize and crop to full hd, make a 15 second loop of it as an `.mp4`, then concatenate as many copies as necessary to make it long enough, then add the audio. By concatenating with `-c copy`, we save a lot of video encoding time: we only have to encode 15s of video rather than having to encode the entire length of the audio. If we have a short `.mp4` loop, the second script `loop_music_vid` is all we need. # img2loop ``` #!/bin/bash T="${T-15}" I="$1" O="$2" C="${C-libx264}" if [ ! -f "$I" ]; then echo "$I does not exist" exit 1 fi if [ -z "$O" ]; then O="${I%.*}.mp4" fi ffmpeg -loop 1 -i "$I" -c:v "$C" -r 24 -t "$T" -pix_fmt yuv420p "$O" echo "$O" ``` # loop music vid Usage: ```bash loop_music_vid [