Bash scripting 10 – Add text to video
Following on from stripping sound, I have looked up on stack overflow how to add text to a video. The script below is slightly modified, so that the text is added to a single video file.
echo strip sound content from video
echo
append=nosnd # set text to append to filename
for file in *.MP4 # apply to all files ending with MP4
do
filename="${file%.*}"
ffmpeg -i test1.MP4 -vf "drawtext=fontfile=/path/to/font.ttf:text='Torbay Trojans':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" -codec:a copy test1-text.MP4
#ffmpeg -i $file -c copy -an ${filename}_$append.MP4
done
# https://stackoverflow.com/questions/17623676/text-on-video-ffmpeg
This adds “Torbay Trojans” text to the centre of the video. See link above, as the text can be positioned where you want.
Tags
#Bash,#Bashscripting,#BatchProcessing,
Mastodon | Peertube | Join Mastodon |
AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.