Skip to content

Instantly share code, notes, and snippets.

@shinchiro
Created December 14, 2016 04:03
Show Gist options
  • Save shinchiro/d483748458d82e296d46e5590494c71d to your computer and use it in GitHub Desktop.
Save shinchiro/d483748458d82e296d46e5590494c71d to your computer and use it in GitHub Desktop.
How to hardsub subtitle with FFmpeg
::
:: This demonstrate on how to hardsub embeded subtitle and downscale video to 360p with only FFmpeg. Ensure FFmpeg is compiled with --enable-libass
ffmpeg -hide_banner -i "D:\oh\test\input.mkv" -vf "subtitles='D\:\\oh\\test\\input.mkv'",scale=-1:360:flags=spline -c:v libx264 -preset ultrafast output.mp4
::Character ':', '\' need to be escaped if present in input's path
:: Escape both characters with sed.
echo "D\:\\oh\\test\\input.mkv" | sed "s,\\,\\\\,g;s,:,\\:,g" >>name
set /p modified=< name
del name
echo %modified%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment