How can I join all AVI-files with mkvmerge in a folder to one mkv and add a chapter before each merged avi?

Hello,

I’m completely new to mkvtoolnix and looking forward to join all avi-files in a folder to ONE mkv without reencoding an adding a chapter mark at the beginning of each joined avi in the mkv.
On my client I use Windows 10.

Thanks a lot for helping.

Welcome!

With a shell such as bash you can easily do this:

mkvmerge -o out.mkv '[' *.avi ']' --generate-chapters when-appending

Note that mkvmerge itself doesn’t interpret wildcard file names such as *.avi; it uses them verbatim. However, a shell such as bash expands *.avi into individual file names before executing mkvmerge with the actual list of file names. That’s why I specified bash.

You can do similar things with any scripting language such as Python very easily, too.

1 Like

Works like a charm.
Thanks a lot for helping.

You’re quite welcome!

1 Like

One last question: Is it a coincidence ore default that the avi-files attached in alphabetical order (which is exactly what i need)?

As hinted above, it’s up to the shell to expand *.avi into the actual list of file names. mkvmerge handles the files in the order they’re given to it. How the shell orders them is up to it, though. The default for all shells I know is to sort them alphabetically, though there are ways to sort them by other meta data with some shells such as zsh (e.g. by the modification date: from oldest to newest or vice versa).

If alphabetically sorted is what you need, you don’t hav eto do anything further.

1 Like

And another question: Can the original avi-filename be used as chapter name?

You can, yes. Please see the documentation for details.

1 Like

I’m no scripting pro but I guess the following could work:

mkvmerge -o out.mkv '[' *.avi ']' --generate-chapters when-appending --generate-chapters-name-template '<FILE_NAME>'

Works perfect. Thanks again mbunkus.

I’m trying to do a similar thing with mkvpropedit to set the flag-enabled property on subtitle tracks for all files in a directory. When I try the following in GitBash I get a “More than one file name has been given” error.

mkvpropedit ‘[’ files/*.mkv ‘]’ --edit track:3 --set flag-enabled=0

Does mkvpropedit not support changing multiple files like this? If not, is there another way to do this?

Thanks