Skip to content

Instantly share code, notes, and snippets.

View jordanbCS's full-sized avatar

Jordan B jordanbCS

  • Simon Fraser University
  • Vancouver, Canada
View GitHub Profile
@jordanbCS
jordanbCS / pdfocr.sh
Created June 24, 2020 21:29
OCR command for turning image pdfs into OCR'd pdfs
convert -density 300 -compress lzw -units 2 "input.pdf" "output.tif";tesseract "output.tif" "input_with_OCR.pdf" pdf; rm output.tif
lynx --dump "http://pastebin.com/raw/3n2UhZr7" > vidipedia_latest.txt;
youtube-dl -ct -i --batch-file='vidipedia_latest.txt'
# Majority credit to the dozens of programmers talking through the problem on StackExchange and elsewhere
# Library vidstabdetect was a pain so I suggest a precompiled ffmpeg binary having it for your installation.
#1. build transform #2. apply transform #3. make side by side #4. extract audio from original then add it back in (side by side wouldn't know which audio to use)
ffmpeg_sd -i [Input]combined_segments.mp4 -vf vidstabdetect=stepsize=1:shakiness=7:accuracy=8:result=transforms.trf -f null -;ffmpeg -i [Input]combined_segments.mp4 -vf vidstabtransform=smoothing=9:input="transforms.trf" stabilized_[Input]combined_segments.mp4;ffmpeg -i [Input]combined_segments.mp4 -i stabilized_[Input]combined_segments.mp4 -filter_complex "[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]" -map [vid] -c:v libx264 -crf 23 -preset veryfast [output]stabilized_[Input]combined_segments.mp4;ffmpeg -i stabilized_[Input]combined_segments.mp4 audio_copy.wav;ffmpeg -i [output]stabilized_[Input]combined_segments.mp4 -i audio_cop