0% found this document useful (0 votes)
47 views1 page

How To Extract Hardcoded Subtitles From Video Files

This tutorial provides a step-by-step guide to extract hardcoded subtitles from video files using ffmpeg. It includes scripts for cropping the video, embedding timestamps, and creating image files from the video. Additionally, it offers tips for organizing the extracted images effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

How To Extract Hardcoded Subtitles From Video Files

This tutorial provides a step-by-step guide to extract hardcoded subtitles from video files using ffmpeg. It includes scripts for cropping the video, embedding timestamps, and creating image files from the video. Additionally, it offers tips for organizing the extracted images effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Tutorial - How to Extract Hardcoded Subtitles from Video Files.

Finally, here is a simple way to extract hardcoded subtitles from video files for
free.
It will help to have basic knowledge about ffmpeg.
You will need to be patient if your video file has a lot of hardcoded subtitles.
You can try this tutorial on a short video clip that has hardcoded subtitles to see
how it works. A lot of movie trailers have hardcoded subtitles.

Part 1 - Here is is the ffmpeg script to crop the video.mp4 file used in this
tutorial. Please adjust parameters according to your video file and note the file
extension

ffmpeg -i video.mp4 -filter:v "crop=1850:250:0:830" -c:a copy video-cropped.mp4

Part 2 - This is the ffmpeg script to embed timestamps in video-cropped.mp4

ffmpeg -i video-cropped.mp4 -vf "drawtext='timestamp: %{pts \: hms}': x=0: y=40:


fontsize=36:fontcolor=black: box=1: boxcolor=white" -c:a copy video-cropped-
timestamps.mp4

Editted on 6th, May, 2022:


As most hardcoded subtitles are in white, it makes sense for the timestamps to have
the same color.
I got better results with white fonts and no box during the OCR process.
The script for this is as shown below:

ffmpeg -i video-cropped.mp4 -vf "drawtext='timestamp: %{pts \: hms}': x=20: y=40:


fontsize=40:fontcolor=white" -c:a copy video-cropped-timestamps.mp4

Part 3 - This is the ffmpeg script to create image files from video file video-
cropped-timestamps.mp4
ffmpeg -i video-cropped-timestamps.mp4 -start_number 1 -vf fps=1/2 video-%04d.jpg

Tip:
I find using Adobe Bridge (Free but you need Adobe ID) very helpful to mark images
that you want to keep that have the first subtitles. Just label them with red mark
by hitting "6" and then sort by label.
Then copy all the images and paste them into subfolder "Images No Duplicates".

Thank you for watching this video and please subscribe to my channel and if you
like it, then you know what to do.
I will reply to all comments in case you need help.

You might also like