howto:merge-video
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| howto:merge-video [2024/03/04 21:28] – Wuff | howto:merge-video [2025/12/07 03:54] (current) – Wuff | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Merge/ | ====== Merge/ | ||
| + | |||
| + | GUI tool for mkv files. Older version is in default debian/ | ||
| + | < | ||
| + | sudo wget -O / | ||
| + | |||
| + | cat <<EOF | sudo tee / | ||
| + | deb [arch=amd64 signed-by=/ | ||
| + | deb-src [arch=amd64 signed-by=/ | ||
| + | EOF | ||
| + | sudo apt update | ||
| + | sudo apt install mkvtoolnix mkvtoolnix-gui | ||
| + | </ | ||
| + | |||
| + | {{.: | ||
| MPG/MPEG files: | MPG/MPEG files: | ||
| Line 80: | Line 94: | ||
| output=" | output=" | ||
| - | sort -n -o $TMPFILE" | + | sort -V -o $TMPFILE" |
| echo "The following files will be merged in this order:" | echo "The following files will be merged in this order:" | ||
| Line 121: | Line 135: | ||
| alternative merge script with chapters, inspired by https:// | alternative merge script with chapters, inspired by https:// | ||
| - | < | + | < |
| #!/bin/bash | #!/bin/bash | ||
| # | # | ||
| Line 204: | Line 218: | ||
| echo;read -rsn1 -p "Press any key to continue . . ."; | echo;read -rsn1 -p "Press any key to continue . . ."; | ||
| </ | </ | ||
| + | |||
| + | Notes re subtitles: | ||
| + | note: mp4 format does not support ass or srt subtitles, but mov_text subtitles. ffmpeg can convert them. formatting from ass subtitles will be lost. | ||
| + | |||
| + | Embed srt subtitle file into mp4 as additional user-controllable track: | ||
| + | < | ||
| + | |||
| + | set metadata of first subtitle stream to english: | ||
| + | < | ||
| + | ffmpeg -i infile.mp4 -i infile.ass -c copy -c:s mov_text -metadata: | ||
| </ | </ | ||
| + | |||
| + | extract subtitle from video: | ||
| + | < | ||
| + | |||
| + | Multiple subs require mapping, otherwise first sub will be overwritten | ||
| + | First add another input: -i input2.srt. Second, map that as 2nd stream: -map 2:0. Finally, select encoder for 2nd subtitle stream (the same as the first one): -c:s srt. The complete example\ < | ||
| + | |||
| + | convert srt to ass or ass to srt: | ||
| + | < | ||
| + | ffmpeg -i input.ass input.srt | ||
| + | </ | ||
| + | |||
| + | Remove audio from a video file: | ||
| + | < | ||
| + | ffmpeg -i input_file -c copy -an output_file | ||
| + | |||
| + | # remove all but a specific language audio streams | ||
| + | ffmpeg -i input_file -map 0 -map -0:a -map 0: | ||
| + | # loop to remove all but turkish audio streams: | ||
| + | for f in *.mkv; do ffmpeg -hide_banner -i " | ||
| + | |||
| + | |||
| + | </ | ||
| + | |||
| + | |||
howto/merge-video.1709587715.txt.gz · Last modified: by Wuff