ffmpeg Converting i.e 10GB movie into 2GB

ffmpeg -i input.mkv -c:v libx265 -crf 23 output.mkv


If selecting video and audio is important for us, then we call first the code below to find out on what positions there is video and specific audio.

ffmpeg -i input.mkv

After we find out positions, we declares them (stream in 0:0 is video, stream in 0:1 is audio)

for %%f in (*.mkv) do (
 ffmpeg -i "%%f" -c:v libx265 -crf 23 -map 0:0 -map 0:1 "compressed-%%f.mp4"


ffmpeg add hardcoded subtitles to video

This command converts video to video

  • with hardcoded subtitles
  • with forced font size 30
  • with color yellow

ffmpeg -i video.mp4 -vf "subtitles=subtitle.srt:force_style='Fontsize=30,PrimaryColour=&H00ffff&'" "output.mp4"

And this command converts only sample from 120s to 300s

ffmpeg -ss 120 -t 300 -i video.mp4 -vf "subtitles=subtitle.srt:force_style='Fontsize=32,PrimaryColour=&H00ffff&'" output.mp4

And this is the default command just to add subtitles

ffmpeg -i video.mp4 -vf "subtitles=subtitle.srt" "output.mp4"