This is an old revision of the document!
Table of Contents
Subtitles
Auto Synchronisation
The following python tool can be used to let it analyse the audio and subtitle and synchronise the subs to generate a new synced file. It works for offsets at the beginning, not for sync issues later in the file.
https://github.com/smacke/ffsubsync
Install on Linux Mint 22+:
pipx install git+https://github.com/smacke/ffsubsync@latest
Usage:
ffs video_file.mkv -i orig_sub.srt -o new_synced_sub.srt
Alternatives
Untested alternative without limitations:
https://github.com/kaegi/alass
Other alternative:
https://snapcraft.io/subsync
https://sc0ty.pl/
https://subsync.online/
https://github.com/sc0ty/subsync?tab=readme-ov-file
Yatse kodi offset
JSON-RPC
Method: Input.ExecuteAction
Parameter: {“action”:“subtitledelayminus”}
or
Parameter: {“action”:“subtitledelayplus”}
Extract subtitles
Extract subtitle with specific metadata title:
for f in *.mkv; do ffmpeg -hide_banner -i "$f" -c copy -map 0:s:m:title:"English [ForcedNarrative]" "${f%.*}.en.forced.srt"; done for f in *.mkv; do ffmpeg -hide_banner -i "$f" -c copy -map 0:s:m:title:"angličtina" "${f%.*}.en.srt"; done #extract 2 at once for f in *.mkv; do ffmpeg -hide_banner -i "$f" -c copy -map 0:s:m:title:"English [ForcedNarrative]" "${f%.*}.en.forced.srt" -c copy -map 0:s:m:title:"angličtina" "${f%.*}.en.srt"; done
Set subtitle to forced
This copies the video and audio stream of an mp4 file, sets the first mov_text subtitle stream to 'forced' and the second to normal:
ffmpeg -i input.mp4 -vcodec copy -acodec copy -map 0:v:0 -map 0:a:0 -map 0:s:0 -c:s mov_text -disposition:s:0 forced -map 0:s:1 -disposition:s:1 0 output.mp4
For mkv files, this probably needs to be srt instead of mov_text.