Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Batch ffmpeg conversion

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading