Skip to content

Commit

Permalink
Add the elsubs.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi-kr-2100 committed Nov 16, 2022
1 parent bf46a2f commit d3baab8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions elsubs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

mkdir -p $1 $1/$1-FRAMES $1/$1-FRAMES/top $1/$1-FRAMES/bottom
yt-dlp -o $1/$1.video -f bestvideo[height=480] http://youtube.com/watch?v=$1
ffmpeg -i $1/$1.video -vf fps=0.5 $1/$1-FRAMES/frame_%05d.jpeg

for f in $1/$1-FRAMES/frame_*; do convert $f -crop 854x35+0+375 -threshold 55% -negate $1/$1-FRAMES/top/`basename $f`; done
for f in $1/$1-FRAMES/frame_*; do convert $f -crop 854x25+0+410 -threshold 55% -negate $1/$1-FRAMES/bottom/`basename $f`; done

ls -d -1 $1/$1-FRAMES/top/*.jpeg | tesseract - - -l $2 -c page_separator="" | cat > $1/$1.top.txt
ls -d -1 $1/$1-FRAMES/bottom/*.jpeg | tesseract - - -l eng -c page_separator="" | cat > $1/$1.bottom.txt

0 comments on commit d3baab8

Please sign in to comment.