Skip to content

Instantly share code, notes, and snippets.

View fsalehpour's full-sized avatar

Faramarz Salehpour fsalehpour

View GitHub Profile
# create hardsubs for a video from a SRT file using FFMPEG
# https://stackoverflow.com/a/21369850/1887369
ffmpeg -i video.mp4 -vf "subtitles=subs.srt:force_style='Fontname=Times New Roman,Fontsize=24,PrimaryColour=&H0000ff&'" output.mp4
## to take only a section of the video:
ffmpeg -ss 00:02:00 -copyts -i video.mkv -ss 00:02:00 -vf "subtitles=subs.srt:force_style='Fontsize=24,Fontname=Times New Roman'" -to 00:02:30 cut.mp4
# convert the pixel format using the format filter
# https://stackoverflow.com/a/54196619/1887369
@fsalehpour
fsalehpour / ghostscript-tips.sh
Last active June 13, 2022 19:32
Tips to do things with ghostscripts
# Reduce the size of a PDF file
# https://askubuntu.com/a/256449/112818
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output_reduced.pdf input.pdf
# Convert a PDF to grayscale colour
# https://superuser.com/a/164857/989263
gs \
-sOutputFile=output_gray.pdf \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray \