TG Telegram Group Link
Channel: GeekTips
Back to Bottom
mpvconfig022024LinuxWin.zip
3.4 MB
mpvconfig 02152024 3.4MiB Linux and Windows mainly for opus chaptered audiobooks.
mpvconfigopus.pdf
7 MB
mpv config opus 7MiB 19 pages.

Quick overview of mpv config files and how to install on Mac, Linux and Windows.

Searchable Playlist
Searchable Subtitles
Searchable Chapters
Searchable Menu Commands
Searchable History (IINA mac only has this being searchable)
Sleep Timer

Dual subs for movies. Language learning modes, repeat subs.

Video Editing, Videoclip, WebM, Trimclip

f g (sub size)
t T (move subs up/down)
/ search subs

Hopefully more will get on mpv rather than the other players with audiobooks to enable searching.
@Geektips
Here's the code I use to set metadata based on filenames. However, I came across some audiobooks I wish to make and the files are 001.mp3 002.mp3 003.mp3, etc. The actual chapter names are in the metadata of the file. So one could normally just encode the audiobook and the chapter names will be reflected in the chapter names since metadata is already set.
However I wish to create a chapter number in the metadata of each chapter name. Sure after audiobook.opus is created you can manually edit chapter names but to do it for 100+ chapters is a time sucker. Already did it twice. So one could easily extract chapter names based on metadata but then it's alphabetized...modification date isn't reliable to number them in order. Long story short this is the ghetto code I came up with to do it.
So initially all filenames were 001.mp3 and ultimately want them to be 001 ChapterName.mp3 so this is what the result looks like.
substicher2024Feb20.zip
1.1 MB
Substitcher 2024Feb20 1MiB

changed the menu structure so pretty much unlimited choices now. Instead of Ctrl+C to exit just hit m to Main Menu. Wrote PDF manual but it's on my other computer but that was last month so kinda outdated. Will upload PDF in about a month. Still working on video encoding to quickly place transparent logo, audio visualization, burned-in subs to easily choice sub-color, sub-border color and sub-shadow color.

Max I put for substitcher is 160 .opus and vtt subs.
Substitcher Main Menu to give a quick overview and showing option a)

edit: Forgot to mention almost everything that can run in parallel does so at least 4x faster for those particular operations such as removing silence and hiss or encoding to opus.
Lately ocrmypdf keeps failing when I just wanna compress pdfs so had to do it without fail. Also to clean metadata was using ExifCleaner but didn't realize all metadata can be restored by doing exiftool -pdf-update:all= some.pdf.

qpdf does a decent job of compressing images and the linearize destroys the metadata that was stripped out so it can't be restored.

exiftool --list some.pdf
will show pdf metadata

On Mac (cuz of stupid zsh)

metapdf=$(bash -c 'read -e -p "Input pdf filename to clean metadata and compress: " tmp; echo $tmp') && exiftool -all:all= $metapdf && qpdf --linearize --object-streams=generate $metapdf ${metapdf%.*}_cleaned.pdf

On Linux this should work

read -p "Input pdf filename to clean metadata and compress: " metapdf && exiftool -all:all= $metapdf && qpdf --linearize --object-streams=generate $metapdf ${metapdf%.*}_cleaned.pdf

Another way to compress pdfs is

ps2pdf in.pdf out.pdf
but it's way too slow

On Linux I use MasterPDF Editor to crop pdfs but on Mac not sure what free app there is so resorted to online pdf croppers. Only free one I found that doesn't destroy bookmarks in the process was pdfmonk but gotta use it in Safari.
collage_compressed.pdf
3.9 MB
Photo collage compressed 3.9MiB reduced from original PDF 59MiB. Just wanted a quick photo collage of 6 images per PDF page. This is an example of what it produces.
Make PDF photo collage / montage. Just run script in a directory of jpg images. This one creates photos 2 columns and 3 rows per page. Compresses pdf to small size.

[ ! -d output ] && mkdir output ; montage *.jpg -mode concatenate -tile 2x3 +polaroid -geometry -44-44 -background "#222222" output/montage_%03d.jpg ; img2pdf --imgsize 888x1500 output/*.jpg -o collage.pdf ; gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -dColorImageResolution=150 -sOutputFile=collage_small.pdf collage.pdf && exiftool -all:all= collage_small.pdf && qpdf --linearize --object-streams=generate collage_small.pdf collage_tiny.pdf && rm -f output/* collage_small.pdf collage_small.pdf_original
Scantailor Experimental ..was using Scantailor Advanced but experimental really streamlines some things. On mac just download release.
brew install qt
run it by
./scantailor-experimental

First extract PDF to tiff images
mkdir dump ; nice pdftoppm -tiff -tiffcompression adeflate -scale-to 3508 *.pdf dump/img
Screenshot of Scantailor Experimental

once done outputting final tiff then combine pdf with img2pdf and ocr with ocrmypdf. Then add bookmarks.

mkdir final ; nice img2pdf -S A4 dump/out/*.tif | ocrmypdf -O 2 --jbig2-lossy - final/output_ocr.pdf && rm -r dump/*
Skim opensource PDF reader for Mac. Recently found PDF Marker in app store and love it but can't handle a certain PDF I'm working on with tons of hyperlinks. It does up to a certain point then just doesn't recognize additional links. edit: ok seems it can handle it now for some reason.

Skim drove me nuts cuz it wouldn't by default have TOC (table of contents) outline collapsed. So to rectify that use the hidden preferences which I wasn't aware of. Set it to always be collapsed on PDF open and open PDFs in tabs. In Terminal just do the following:

defaults write net.sourceforge.skim-app.skim SKCollapseTOCSublevels -boolean true

defaults write net.sourceforge.skim-app.skim AppleWindowTabbingMode -string always
Use the following regex to trim PDF outline bookmarks to 60 characters. Keep forgetting it so best to jot it down.

^ "(\d+:\d+)(.{60})(.*?)(" \d+)

"$1$2$4

Then trim digits to 1 decimal point

(" \d+)( \d+)(.)(\d{1})(\d+)

$1$2$3$4

LibreOffice remove double blank lines using extenstion Alt Search & Replace
Search this:
^$\p*
Replace by:
\p
Removing music, instrumentals, bass, drums, etc. I want to re-encode a video without the background instrumental music.

Every online website just wants money and has duration and file size limitations. If you have a semi-fast computer then do it yourself. I tried out a few open source apps Demucs-GUI crashes at end. Simple no options except wav or mp3 output is StemRoller (uses demucs-cx-freeze 24GB RAM) compared to Ultimate Vocal Remover which has many options and uses about half the RAM as StemRoller.
Ultimate Voice Remover for a 5m 24s audio track took 4m 40s to process using CPU only on Mac M1. Once I checked GPU then it took 57s. So GPU is only way to go 5x realtime compared to about 1.2x realtime.

download video only and audio only from youtube using
yt-dlp --list-formats "someyoutubeURL"

download 720p video only
yt-dlp -f 136 "https://www.youtube.com/watch?v=SOMEVIDEO"

download m4a 128k audio only
yt-dlp -f 140 "https://www.youtube.com/watch?v=SOMEVIDEO"

now after removing music from audio just mux audio with original video

ffmpeg -i "video_only.mp4" -i "audio_(Vocals).mp3" -c:v copy -c:a copy -map_metadata 0 -shortest output.mp4
Used to use Normcap (OCR) to capture chapters in audiobooks then copy and paste them. So in Mediainfo it kinda has a text output but still need to parse it. kid3-cli seems to be easiest to parse and just returning Chapter names stripping out all the extra info.

for f in *opus; do kid3-cli -c "get all" "$f" | sed -E -e 's|(\s+CHAPTER[0-9]{3}NAME\s+)||g' -e 's|(CHAPTER[0-9]{3})(\s+)(.*?$)||g' | awk 'NF' ; done
Mac apps currently that I use. Recently cleaned up about 60GB of junk data using

cargo install dua-cli

or you could

brew install dua-cli

Most data hog was stable-diffusion models.

dua i ~

Quit listening to any music, watching any movies ~ 2 years ago. Keep all audiobooks under Music directory.

freac 76MB make audiobooks

KeePassXC 92MB password manager

kid3 83MB edit audiobook metadata

LibreOffice 795MB document editing

LibreWolf 345MB privacy focused browser

LocalSend 58MB sends files on wifi

mpv 57MB media player

PDFsam Basic 103MB merge PDFs

scantailor-experimental 3MB beautify old PDFs

Skim 20MB PDF reader

Stats 13MB menu bar, cpu, gpu, ram,network, etc.

Telegram 254MB only social media I use

Transnomino 2MB file renamer

Ultimate Vocal Remover 1.55GB remove music from vocals

Veracrypt harddisk encryption

Visual Studio Code 572MB code editor
Substitcher July 2024 zip file

added some more parallel options, more Proper Pronouns (1200+), lowercase any subtitle line That Has Titlecase Which Is Annoying. Now use distil-whisper-v3 for 6x realtime speed with flash attention for English only. For multilingual use medium model which is about 4x realtime speed.

Last release was back in February 2024 so hard to remember all the improvements made.
SubStitcher07v2-2024.zip
36 KB
SubStitcher v2 36KiB July 2024 for transcribing audiobooks and stitching up to 160 vttt / srt subtitles into one subtitle. Added preview of lines to be lowercased. Hopefully this is hardly ever necessary.
HTML Embed Code:
2025/07/06 08:29:17
Back to Top