---
title: Mass batch processing on the CLI
date: 2022-03-19
---

> This post is day 4 of me taking part in the
> [#100DaysToOffload](https://100daystooffload.com/) challenge.

Some time ago, I needed to process a lot of video files with vlc. This is
usually pretty easy to do, `for file in *.mp4 ; do ffmpeg ... ; done` is about
all you need in most cases. However, sometimes the files you are trying to
process are in different folders. And sometimes you want to process some files
in a folder but not others. That's the exact situation I was in, and I was
wondering if I needed to find some graphical application with batch processing
capabilities so I can queue up all the processing I need.

After a bit of thinking though, I realized I could do this very easily with a
simple shell script! That shell script lives in my [mark-list](https://github.com/SeriousBug/mark-list)
repository.

The idea is simple, you use the command to mark a bunch of files. Every file you
mark is saved into a file for later use.

```bash
$ mark-list my-video.mp4  # Choose a file
Marked 1 file.
$ mark-list *.webm  # Choose many files
Marked 3 files.
$ cd Downloadsr
$ mark-list last.mpg  # You can go to other directories and keep marking
```

You can mark a single file, or a bunch of files, or even navigate to other
directories and mark files there.

Once you are done marking, you can recall what you marked with the same tool:

```bash
$ mark-list --list
/home/kaan/my-video.mp4
/home/kaan/part-1.webm
/home/kaan/part-2.webm
/home/kaan/part-3.webm
/home/kaan/Downloads/last.mpg
```

You can then use this in the command line. For example, I was trying to convert everything to `mkv` files.

```bash
for file in `mark-list --list` ; do ffmpeg -i "${file}" "${file}.mkv" ; done
```

It works! After you are done with it, you then need to clear out your marks:

```
mark-list --clear
```

Hopefully this will be useful for someone else as well. It does make it a lot
easier to just queue up a lot of videos, and convert all of them overnight.
