howto:subtitles
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| howto:subtitles [2025/02/01 23:09] – Wuff | howto:subtitles [2025/07/26 18:41] (current) – Wuff | ||
|---|---|---|---|
| Line 39: | Line 39: | ||
| or | or | ||
| Parameter: | Parameter: | ||
| + | |||
| + | |||
| + | ===== Extract subtitles ===== | ||
| + | Extract subtitle with specific metadata title: | ||
| + | < | ||
| + | for f in *.mkv; do ffmpeg -hide_banner -i " | ||
| + | for f in *.mkv; do ffmpeg -hide_banner -i " | ||
| + | |||
| + | #extract 2 at once | ||
| + | for f in *.mkv; do ffmpeg -hide_banner -i " | ||
| + | </ | ||
| + | |||
| + | ===== Set subtitle to forced ===== | ||
| + | This copies the video and audio stream of an mp4 file, sets the first mov_text subtitle stream to ' | ||
| + | < | ||
| + | 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: | ||
| + | </ | ||
| + | |||
| + | For mkv files, this probably needs to be srt instead of mov_text. | ||
| + | |||
| + | ===== Remove subtitles from mkv files ===== | ||
| + | |||
| + | First, identify the track ids contained in the mkv file: | ||
| + | < | ||
| + | mkvmerge -i videofile.mkv | ||
| + | </ | ||
| + | The output will look something like this: | ||
| + | < | ||
| + | kax i am at 6718 | ||
| + | File ' | ||
| + | Track ID 0: audio (AC3/EAC3) | ||
| + | Track ID 1: subtitles (SubRip/ | ||
| + | Track ID 2: subtitles (SubRip/ | ||
| + | Track ID 3: video (MPEG-4p10/ | ||
| + | Track ID 4: audio (DTS) | ||
| + | Chapters: 17 entries | ||
| + | Tags for track ID 0: 7 entries | ||
| + | Tags for track ID 1: 7 entries | ||
| + | Tags for track ID 2: 7 entries | ||
| + | Tags for track ID 3: 7 entries | ||
| + | Tags for track ID 4: 7 entries | ||
| + | </ | ||
| + | |||
| + | For more detailed information the mkvinfo command can be used: | ||
| + | < | ||
| + | mkvinfo videofile.mkv | ||
| + | </ | ||
| + | |||
| + | To create a new mkv file with the subtitles removed and only keeping the second audio stream, use the following command: | ||
| + | < | ||
| + | mkvmerge -o newvideofile.mkv -a 4 -s 0 videofile.mkv | ||
| + | </ | ||
| + | |||
| + | To extract tracks from an mkv file, use the mkvextract command using the IDs obtained from mkvinfo: | ||
| + | < | ||
| + | mkvextract tracks videofile.mkv 2: | ||
| + | </ | ||
| + | |||
howto/subtitles.1738451378.txt.gz · Last modified: by Wuff