Reputation: 675
I'm wanting to get FFMPEG to export my podcast audio to a file I can upload to youtube that is visually interesting.
currently I am using the following piece of code, which I don't fully grasp:
ffmpeg -i E04_ProphetsPrey.wav -filter_complex \
" [0:a]showfreqs=mode=line:ascale=log:fscale=rlog:s=1280x518,pad=1280:720[vs]; \
[0:a]showfreqs=mode=line:ascale=log:fscale=rlog:s=1x1[ss]; \
[0:a]showwaves=s=1280x202:mode=p2p[sw]; \
[vs][ss]overlay=w[bg]; \
[bg][sw]overlay=0:H-h,drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontcolor=white:x=10:y=10:text='\"Rated80s Prophets Prey\" by Comics On Film'[out]" \
-map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy -threads 0 output.mkv
what I would like to do is set a (branded) background image, and have showfreqs render over it on the top half and showwaves render over it on the bottom half.
Is that possible, and if so could you provide me a detailed example?
(I'm on arch linux)
Upvotes: 3
Views: 2688
Reputation: 133973
ffmpeg -i music.mp3 -loop 1 -i image.jpg -filter_complex \
"[0:a]showfreqs=mode=line:ascale=log:fscale=log:s=1280x518[sf]; \
[0:a]showwaves=s=1280x202:mode=p2p[sw]; \
[sf][sw]vstack[fg]; \
[1:v]scale=1280:-1,crop=iw:720[bg]; \
[bg][fg]overlay=shortest=1:format=auto,format=yuv420p,drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontcolor=white:x=10:y=10:text='\"Rated80s Prophets Prey\" by Comics On Film'[out]" \
-map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a libopus output.mkv
vstack vertically stacks the two effects. It is easier and usually faster than using overlay to do so.
The example background image was oversized, so scale and crop made the image 1280x720.
The vstacked effects are then layered above the background using the overlay filter, format filter makes a more pixel format compatible with non-FFmpeg based players (you can remove it if just uploading to YouTube), and finally drawtext makes the text.
If you get [overlay] Unable to parse option value "auto"
your version is too old and you should upgrade. See the FFmpeg Download page for links.
Upvotes: 12