Skip to content

Instantly share code, notes, and snippets.

@o770
o770 / mpvf.md
Last active January 8, 2025 06:40
Run MPV with optional MPV profiles on a set of files found with GNU Find.

MPVF is a Bash script that runs MPV with optional MPV profiles on a set of files found with GNU Find by including and excluding shell patterns and setting the depth levels in the directory tree. Search patterns and directories are entered on the command line or in the script. File names can also be matched against an optional list of file extensions. With no options entered, the script's defaults are used.

Usage
mpvf {[<mpv profile,...>] [-a <pattern>] [-e <pattern>] [-i <pattern>] [-n <levels>] [-x <levels>] [directory...] | --help | --version}

Options
<mpv profile,...>
Name of the MPV profile to use.

-a, --alt \

@o770
o770 / penc.md
Last active October 2, 2024 08:11
Batch transcoding in FFmpeg to save disk space.

This bash script is a batch processing tool that runs FFmpeg and works like this:

Files and directories are entered on the command line, and user options are entered into variables within the script. Directories are expanded recursively and files are optionally filtered by bitrate and/or video width. Output files are saved in the current working directory. Options include automatic downscaling, test mode, and more. If a key is pressed in the interval between encodings, the script may exit or continue after confirmation. Information and statistics for the input and output files are displayed along with a summary of any warnings and errors when the execution ends. With no arguments entered on the command line, the script usage and current configuration are displayed.

Usage: penc.sh [-t] file|directory...

Dependencies: AWK, GNU Coreutils, GNU Grep, FFmpeg, FFprobe.

Notes
The displayed input file names are always quoted in a format that can be reused as input, so for exa