Batch ffmpeg conversion

Question:

I’m looking to batch draw text using ffmpeg on a directory of mp4s. Basically, take the mp4s from the old directory and drop the newly minted mp4s in the new directory. In this case, there are 20 chunks (0 to 19, chunk_x.mp4). I haven’t been able to implement the existing solutions on stack.

ffmpeg -i old/chunk_9.mp4 -vf 
"drawtext=fontfile=Arial.ttf: text='%{frame_num}': start_number=1: x=(w-tw)/2: y=h-(2*lh): 
fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5" 
-c:a copy new/chunk_9.mp4
Asked By: spazznolo

||

Answers:

You dont need python. You can just do a for loop in bash:

for i in {1..20}
do

ffmpeg -i old/chunk_${i}.mp4 -vf 
"drawtext=fontfile=Arial.ttf: text='%{frame_num}': start_number=1: x=(w-tw)/2: y=h-(2*lh): 
fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5" 
-c:a copy new/chunk_${i}.mp4

done
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.