A="$1"
if [ -z "$2" ]; then
O="${A%.png}.mp4"
fi
L="${L-60}"
ffmpeg -loop 1 -i "$A" -t "$L" -r 24 -pix_fmt yuv420p -vf scale=1920:1080 "$O"
If I want a static picture for audio so as to upload to youtube, I'll make a 60 second clip
using this, say loop.mp4. Then I create a file catlist containing
file 'loop.mp4'
file 'loop.mp4'
...
file 'loop.mp4'
repeated once per minute of the intended duration. Say 120 lines for 2 hours of video. I do
ffmpeg -f concat -i catlist -c:v copy 120m.mp4
This is very quick compared to re-encoding.
Suppose the audio is audio.wav.
Then I can do:
ffmpeg -i 120m.mp4 -i audio.wav -c:v copy -shortest output.mp4
and this will produce the desired .mp4 file. Hopefully this is good enough to upload to youtube, and I presume youtube re-encodes it anyway. (As I write this I've not tried it... I'll know in about half an hour.)
If the audio is already AAC (i.e. .m4a), the we don't need to re-encode it.
This script tells ffmpeg to copy the audio if it's an .m4a.
V="$1"
A="$2"
O="$3"
if [ ! -f "$V" ]; then echo "no video"; exit 1; fi
if [ ! -f "$A" ]; then echo "no audio"; exit 1; fi
if [[ "$A" =~ \.m4a$ ]]; then B=(-c:a copy); else B=(); fi
echo ffmpeg -i "$V" -i "$A" -map 0:0 -map 1:0 -c:v copy "${B[@]}" -shortest "$O"