media-toc is an application to build a table of contents from a media file or to split a media file into chapters.
You might also be interested in media-toc-player: a media player with a table of contents.
gst-plugins-good
1.14 or above.flac
, wave
, opus
, vorbis
or mp3
files:
one file per chapter.The following functions are bound to one or multiple key accelerators:
Function | keys |
---|---|
Open media dialog | Control + O |
Quit the application | Control + Q |
Play/Pause (and open media dialog when no media is loaded) | Space or Play |
Step forward | Right |
Step back | Left |
Go to next chapter | Down or Next |
Go to the beginning of current chapter or previous chapter | Up or Prev |
Zoom the waveform in | Z |
Zoom the waveform out | Shitf + Z |
Close the info bar | Escape |
Add a chapter at current position | + |
Remove the chapter at current position | - |
Toggle show/hide chapters list | L |
Toggle repeat current chapter | R |
Show the Display perspective | F5 |
Show the Streams perspective | F6 |
Show the Export perspective | F7 |
Show the Split perspective | F8 |
Open the about dialog | Control + A |
+
icon
under the tree view at the bottom right of the window. The end of the chapter will match the end
of the media. This will change automatically if you add new chapters.+
button next to the waveform to zoom in. You can then seek around
current sample by clicking on the waveform. You can also play the media in current time frame by
right clicking at the starting position. Use the zoom, left click and right click until you reach
the position for the chapter to add.+
icon under the tree view at the bottom right of the window.You can export a table of contents to the mkvmerge simple chapter format
which is a text file.
This file will be stored in the same folder as the original media and will be automatically loaded
next time you open this media.
mkvmerge text format
.Export
. When the export is complete, a new file with the same name as your media and
with a txt
extension will be created in the media's folder.Currently, this is only possible if the input streams are compatible with Matroska containers.
Warning: this also requires gst-plugins-good
1.14
or above.
Matroska Container
.Export
. When the export is complete, a new file with the same name as your media and
ending with .toc.mkv
will be created in the media's folder.flac
, wave
, opus
, vorbis
or mp3
.Split
. When the split is complete, audio files will be created in the media's folder.
The files are named after the artist, media title, chapter number and chapter title.mkvmerge
to add the toc to an existing Matrsoka mediaExporting the table of contents to a Matroska container requires gst-plugins-good
1.14
or above. If you use an ealier version, follow these instructions:
mkvtoolnix
using your package manager.mkvmerge simple chapter format
(see this how-to).cd
to the directory where your Matroska file is located.Issue the following command (where media is the name of your mkv file without the extension):
mkvmerge --chapters _media_.txt -o output_file.mkv _media_.mkv
The file output_file.mkv
will now contain the media with the chapters you defined.
media-toc is developed in Rust and uses the following technologies:
$ curl https://sh.rustup.rs -sSf | sh
Select the stable
toolchain. See the full documentation
here.
It is convenient to have Rust's tools in the path. On linux, you might want to add this
in your .bashrc
:
export PATH=$PATH:~/.cargo/bin
Rust dependencies are handled by Cargo. You will also need the following packages installed on your OS:
sudo dnf install gcc gtk3-devel glib2-devel gstreamer1-devel \
gstreamer1-plugins-base-devel gstreamer1-plugins-{good,bad-free,ugly-free} \
gstreamer1-libav
sudo apt-get install gcc libgtk-3-dev libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-{good,bad,ugly} \
gstreamer1.0-gtk3 gstreamer1.0-libav
Note: the mac I used to test these instructions is pretty old. It's stucked on an old version of the OS and doesn't get precompiled packages from homebrew. Please fill an issue if you run into any problem.
Install homebrew.
Install git
from homebrew:
brew install git
Install Rust toolchain manager and select the stable
toolchain.
Add Rust tools in the PATH
:
echo "export PATH=\$PATH:$HOME/.cargo/bin" >> $HOME/.bashrc
source $HOME/.bashrc
Install dependencies:
brew install gtk+3 gstreamer adwaita-icon-theme
brew install --with-libvorbis --with-opus --with-theora gst-plugins-base
brew install --with-flac --with-gtk+3 --with-libpng --with-taglib gst-plugins-good
brew install --with-srt gst-plugins-bad
brew install --with-libmpeg2 --with-x264 gst-plugins-ugly
Use the following command to build and generate locales:
PATH="/usr/local/opt/gettext/bin:$PATH" cargo build --release --features=gettext
Please note that I don't have any Windows box at hand ATM. These instructions might be out of date. If you figure out a proper set of dependencies, please submit a PR.
MSYS2: follow this guide.
Install the development toolchain, GTK and GStreamer
Note: for a 32bits system, use mingw-w64-i686-...
pacman --noconfirm -S mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gtk3 mingw-w64-x86_64-gstreamer
pacman --noconfirm -S mingw-w64-x86_64-gst-plugins-{base,good,bad,ugly} mingw-w64-x86_64-gst-libav
If you want the application to be localized (currently only in French or Spanish), also install:
pacman --noconfirm -S gettext-devel
Launch the rustup installer.
When asked for the default host triple, select x86_64-pc-windows-gnu
(or
i686-pc-windows-gnu
for a 32bits system), then select stable
.
From a MSYS2 MinGW 32 or 64 shell
add cargo to the PATH
:
echo 'PATH=$PATH:/c/Users/'$USER'/.cargo/bin' >> /home/$USER/.bashrc
Restart the MSYS2 MinGW 32 or 64 shell before using cargo
.
This will retrieve the last release.
git clone --branch v0.7.0 https://github.com/fengalin/media-toc
cd media-toc
Use Cargo (from the root of the project):
cargo run --release
If you want the application to be localized (currently only in French or Spanish),
compile with gettext
support:
cargo run --release --features=gettext
On XDG compliant systems, you can install the application executable and related files (icons, translations and desktop file) for current user by executing the following command (from the root of the project):
bash target/install
You can uninstall with:
bash target/uninstall
This might be caused by the hardware acceleration which is enabled by default. In some cases, the application will detect the issue and disable it automatically (a restart is required). But in other cases, you may have to disable it by hand. First check that hardware acceleration is indeed the issue:
cargo run -- --disable-gl
If it solves the problem, you can permanently disable hardware acceleration by editing the configuration file. The configuration location depends on the operating system:
OS | Configuration location |
---|---|
Linux based | ~/.config/media-toc/config.ron |
macOS | /Users/user/Library/Preferences/org.fengalin.media-toc/config.ron |
Windows | C:\Users\user\AppData\Roaming\fengalin\media-toc\config\config.ron |
Open the configuration file and replace the following line:
is_gl_disabled: false,
with:
is_gl_disabled: true,
media-toc is currently available in English, French and Spanish. The user
locale should be automatically detected when the application is compiled with
the gettext
feature. If you want to use the English version or if you want
to submit logs, you can discard the translations using the following command:
LC_MESSAGES=C cargo run --release