90.21 Video Subtitles


First extract the text from the video, using for example, the MLHub command transcribe:

ml transcribe openai -f srt orig.mp4 > orig.srt

Or use whisper directly with:

whisper --fp16 False --output_format=srt orig.mp4 > /dev/null

Then process the video to add the subtitles.

ffmpeg -i orig.mp4 -filter_complex \
    "subtitles=orig.srt:force_style='FontName=DejaVu Serif,Fontsize=14,MarginV=0,Alignment=2"
    vcodec libx264 -acodec copy -q:v 0 -q:a 0 orig_sub.mp4

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0