ffmpeg = bae

Wazakindjes c01c39c0ff Fix scaling for same-type c0nverts [[==[ 3 weeks ago
.editorconfig d484c05a36 Added editorc0nfig =] 11 months ago
.gitignore 3f39b46967 Repo creation 4 years ago
LICENSE 3f39b46967 Repo creation 4 years ago
README.md 8c55f997a7 Uniform exit c0dds imo tbh, distinguish "constants" from runtime variables, handle unknown arguments and missing values ourselves, also upd00ted readmuh =] 1 year ago
convertem.sh c01c39c0ff Fix scaling for same-type c0nverts [[==[ 3 weeks ago

README.md

This shit is basically just a wrapper around ffmpeg to convert files to various formats, cuz I cbf to remember obscure-ass flags. [[=[=[=[=[=[=

Usage

convertem [-h] [-k|-r] [-o <directory>] [-m] [-S] [-A <vaapi> -a <device>] [-c <hevc8|hevc10|h264>] [-s <time>] [-l <time>] <ico|ogg|mp3|mp4|mkv|mov|mkv> <file[s]>
Processed files are moved into a directory _convertem_orig, which is created inside your current working directory (unless specified otherwise 0fc ;]). By default the output files are stored in the same place as where every original used to be.

Options:

  • -k: keep original file (i.e. don't move to ./_convertem_orig)
  • -m: don't copy (IDv3) metadata, like from WAV to MP3
  • -r: remove original file, or move it to a path specified in an environment variable CONVERTEM_TRASH
  • -o: output to specified directory instead of grabbing the original file's dirname (implies -k, also creates the original directory structure in the destination)
  • -h: show halp

-k and -r are mutually exclusive, should be pretty clear why (implied -k can still be overridden with -r).

Options for non-static files (audi0, vidy0) only:

  • -s: start time (total amount of seconds or hh:mm:ss), skip part of a file
  • -l: length of the chunk to extract (same format)

Options for vidy0 only:

  • -A: try to use hardware acceleration with the specified acceleration type (only vaapi is supported/tested at the moment)
  • -a: use the specified acceleration device (should pr0lly be /dev/dri/renderD128 for VAAPI)
  • -c: use a certain output codec, so you can convert e.g. 10-bit HEVC to 8-bit or just any form of HEVC to good ol' h264 (NOTE: the original input codec is not checked)
  • -S: extract embedded subtitles to a separate file and remove it from the original
    You can either convert to a different vidy0 format (like mp4 to mkv) or keep it as-is without any quality l0ss. ;]
    NOTE: .ass files may be accompanied by attachments for (custom) fonts, these will need to be manually dumped with e.g. ffmpeg -dump_attachment:t "" -i <input file>"

CODEC INFORMATION
When using specific codecs we use specific settings, these should pretty much correspond to "visually lossless" (or "audibly lossless" (?) for audio):"

  • Vorbis (ogg): qscale 10
  • MP3: qscale 0
  • h264/AVC: CRF 19, always 8-bit
  • h265/HEVC 8-bit: CRF 20
  • h265/HEVC 10-bit: CRF 20

HARDWARE ACCELERATION
There are many ways to get it working, but this script has only been tested with intel-media-va-driver(-non-free). This is a pretty good driver with decent support (CPU generation 8 and up (Broadwell)). VAAPI itself is still pretty common so other drivers might work just fine as well.
Read m0ar: https://trac.ffmpeg.org/wiki/Hardware/QuickSync