Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save laranea/276805402737a2dfc8674175252ef331 to your computer and use it in GitHub Desktop.
Save laranea/276805402737a2dfc8674175252ef331 to your computer and use it in GitHub Desktop.
Remove hard subtitles from video file || Integrate subtitles into a video file || Generate .srt file from a video file.

Download FFmpeg for Windows

Steps

  • Download FFmpeg
  • Extract it and save it to C drive ( choose any location - it's optional )
  • Set environment variable - copy the location of bin folder which is inside the extracted file and set the location on system path variable.
  • Done!

Remove Hard Subtitles

Let's say you have a english video file name demo.mkv and it has horrible subtitile problem like chines or a language that you can't understand , than you can simply remove subtitle usign ffmpeg framework. We are talking about built-in subtitiles not .srt file. To do so , follow the following steps :

  • Install FFmepg on your pc and set path variable if needed.
  • Go to your file location and open command prompt or terminal there.
  • After that run the following command - ffmpeg -i video.mkv -vcodec copy -acodec copy -sn video-no-subs.mkv

Integrate Hard Subtitle

Now if any case you want to integrate a srt file on a video player. Then follow below step -

  • Download desire subtitle (language) from online
  • let's assume demo.mkv and downloaded file named sub.srt
  • put both file in one location and open terminal from that location and run following command
  • First convert the subtitles to .ass format: ffmpeg -i sub.srt subs.ass
  • To mux subtitles into a video file run - ffmpeg -i demo.mkv -i sub.ass -codec copy -map 0 -map 1 output.mkv

Extract Subtitile for Video file

Now in these case , a video file with an embeded subtitile and you want to make it srt file or other work a soft subtitile file. We cas do it by following command

  • ffmpeg -i demo.mkv -map 0:s:0 sub.srt

That's it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment