Skip to content

Instantly share code, notes, and snippets.

@fsalehpour
Created March 7, 2022 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fsalehpour/bcaeb077d65546d632638d9af2dc2036 to your computer and use it in GitHub Desktop.
Save fsalehpour/bcaeb077d65546d632638d9af2dc2036 to your computer and use it in GitHub Desktop.
ffmpeg tips
# 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
ffmpeg -i in_file -filter:v "format=yuv420p" out_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment