3 ms·
This one just add a 5 second title to the video taking the name from the file name #!/bin/bash #Creates a Directory mkdir -p titles #loop for files in folde
by quijoteuniv 6y ago
This one just add a 5 second title to the video taking the name from the file name
#!/bin/bash
#Creates a Directory
mkdir -p titles
#loop for files in folder
for f in .MOV; do
text="${f%.MOV}"
#Uses drawtext
ffmpeg -i "$f" -vf drawtext="fontfile=/usr/share/fonts/opentype/NotoSansCJK-Regular.ttc : \
text=$text : fontcolor=white: fontsize=82: box=1: boxcolor=black@0.5: \
boxborderw=20: x=(w-text_w)/2:y=h-th-40 :enable='between(t,0,5)'" -codec:a copy "./titles/$f"
done
# Other options:
# Bottom center: x=(w-text_w)/2:y=h-th (with 10 px padding: x=(w-text_w)/2:y=h-th-20)
# centered: x=(w-text_w)/2: y=(h-text_h)/2
This is my trim tool to cut beginnings and/or endings of files
#!/bin/bash
mkdir -p trimmed
duration=$(ffmpeg -i "$1" 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,//)
length=$(echo "$duration" | awk '{ split($1, A, ":"); print 3600A[1] + 60*A[2] + A[3] }' )
trim_start="$2"
trim_end=$(echo "$length" - "$3" - "$trim_start" | bc)
ffmpeg -ss "$trim_start" -i "$1" -c copy -map 0 -t "$trim_end" "./trimmed/$1"
# Example
# >trim example.MOV 0.2 10