GeekTips
109 subscribers
586 photos
3 videos
77 files
231 links
Linux Mint, video encoding, ffmpeg, geek tips, regex, pdf manipulation, substitcher, mpv config
Download Telegram
Batch download with yt-dlp

pip3 install yt-dlp

I use it with videomass but believe the command line is a tad better. Especially since it tries to resume 10 times on timeouts (default)

Open source html website and use regrex to strip out front and end of video/audio link as seen in the screenshot.

Once you have your links it'll look like a list of links in the screenshot.

Save this as a text file named videolinks.txt
-a, --batch-file
Batch download
yt-dlp -a videolinks.txt
Another way to do it is to use DownThemAll! extension and just download the html files. Copy them all into a text file and prepend https://www.bitchute.com/video/ and delete the .html text

another way to do this is save the html source in a text file named links.txt then extract the URL to a file named linksextracted.txt

cat links.txt | grep -Eo '(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]' | sed 's/;/<tab>/g' > linksextracted.txt

Or use an online URL extractor

Obviously if there are direct links to the source mp4 video files then just use DownThemAll! to grab all videos on that page. This method is showing how to batch download video links and not links to source video files.
Batch downloading with yt-dlp
King James 1611 in Foliate epub reader (GPL free)
flatpak install flathub com.github.johnfactotum.Foliate

Foliate Settings | Advanced
uncheck Auto-hyphenation (personal preference)
uncheck Reference Preview (annoying)

Foliate Preferences
When a word is selected [Look up in dictionary]
install an offline dictionary
When multiple words are selected [Highlight]
can export annotations to BibTex, HTML, JSON, Markdown, Plain Text
and can import JSON

Interface
uncheck Auto-hide header bar
check Use sidebar

Calibre ebook viewer
when you click C X or V it loads a preview then you must click —> to advance. No way to turn this off.

Xreader (Document Viewer) linux no dark mode for epubs only PDFs. No annotations. But works ok for epubs.
Bible PDF in evince (Document Viewer) on Linux. Showing night mode in Strongs with mouse hovering idolater G1496

CTRL-H highlight but can't export annotations
ALT-P previous page visited
ebook-convert (calibre) crashed my computer twice. Assume you need 16GB or even 32GB to convert a 50MiB epub to PDF. Tried 7 or so online epub to PDF services and all failed except one which uses calibre. Assume they have 16 or 32GB memory on their server. Gave an 627MB PDF. Think it took like 45 mins or more to convert.

Tried many ways to reduce it ocrmypdf, gs (ghostscript), shrinkPDF (shell script) and all crashed computer after 2 hours or so as they're all memory intensive. pdftocairo got it down to 189MB but no links and no TOC. Ultimately the only thing that worked was PDFSAM
java -jar -Xmx4400m /opt/pdfsam-basic/pdfsam-basic-4.3.1.jar
and just compressed it PDF 1.5 and it went relatively quick about 8 minutes and hit 5.5GiB memory and down to 236MB (225MiB). Not gonna do this again as epubs with over a million links should stay epubs.
apple Books app (free) can export annotations to email. Sometimes messes up formatting of table (see very top of screenshot). Can go back to previous location only after indexing is complete (~15 mins on eyephone 10). If you change font size it needs to reindex. Plus apple is evil.
Marvin SxS $5 can export annotations to epub, PDF, HTML, CSV. Favorite thing is the red dot which flashes for one second to show you where in the page the link you just clicked (verse, Strongs, etc.). No need to wait for an index. Quite fast epub reader.

Kybook 3 $5 let me down for this epub...although it's still a great PDF reader.
eBoox (free) works great and best option for free on eyeOS. No need to wait for index. Fast. Can export annotations as text, email, text file, Notes.

Only con is the Strongs links won’t work in table of contents although the two Strongs indexes will Hebrew and Greek. It’s not all that bad as you can still access Strongs from verses by clicking the X.
Screenshot predefined area to capture on Linux. With SimpleScreenRecorder you can simply select an area and it'll only video record that area. There are a quite a few of screenshot apps on Linux. Usually just use
Alt-PrtSc = capture window
PrtSc = capture entire desktop
Shift-PrtSc = capture area select with mouse
custom one Super-PrtSc = Normcap OCR

To define the area each and every time is crazy if you're doing batches. I did it till card #150 then decided better find a better way..have to go to #541. Scrot app to the rescue.

sudo apt install scrot

scrot -a 24,318,538,538

24px
in from the left side
318px down from top of screen
538px width of area to capture
538px height of area to capture

Create a custom Keyboard shortcut. I chose Super+F1. Call it scrot and in the command section put
scrot -a 24,318,538,538 -e 'mv $f ~/Pictures/'
By default it'll capture to your home directory so mv will move it to your Pictures directory each screenshot. Now just hit Next for next card and Super-F1 each time.
To convert HEIC (apple) to jpg on linux
for file in *.heic; do heif-convert $file ${file/%.heic/.jpg}; done
Automatically Truncate (cut out) Silence with Audacity. Select All then choose Effect | Truncate Silence. I set a minimum of 5 seconds. Two areas of silence it replaces them with half a second of silence.

You can batch cut a few at a time and make sure to check Truncate track independently.

For testing purposes I generated silence at beginning and end of file with OcenAudio. Think in Audacity you'd have to install a plugin for that.
Decibel chart so anything 50dB or below seems good for marking it as silence as 60dB is for normal conversation.
Add this part to remove silence from the entire audio (beginning, middle, end) in videomass. Useful for doing hundreds at a time.

-c:a libopus -vbr off -b:a 32k -ar 48000 -af highpass=500,lowpass=1000,afftdn,aformat=channel_layouts=stereo,volume=12dB,"silenceremove=start_periods=1:stop_periods=-1:start_threshold=-50dB:stop_threshold=-50dB:start_silence=1:start_duration=2:stop_duration=5:detection=peak",dynaudnorm

If you only wish to remove silence from beginning of audio put instead start_periods=0

What's the equivalent to detect minimum amount of silence duration of say 5 seconds like you can do in Audacity? stop_duration=5 is.
Silenced removed with videomass...total is 3m 3s
When an audiobook doesn't have chapters and you're too lazy to automatically detect for silent breaks (like for 3 second gaps) with Audacity then use LosslessCut Edit | Segments | Create fixed duration segments. Setting 30 min chapters.
followup to removing silence with ffmpeg
I guess minimum duration of silence seems to work with stop_duration=30 for example. It always removes silence at the beginning though.

Black waveform you can see the 12s is still there and portions 1m 8s (1st part is 14s, 2nd part is 8s as 3rd part was longer than 30s and removed). Also removed the 1m 20s and seemed to remove the end.

Red waveform shows stop_duration=15 seconds and it seems it worked well.

Last thing is I tried start_duration=2 and it did remove one click but missed the other click. So based on this it'll be pretty safe to use these default settings.

stop_duration=30:start_duration=2
Image Upscale 2x, 4x, 8x, etc. Some online services for this. Gimp | Image | Scale and choose Linear | Cubic | NoHalo doesn't matter even if you use a Sharpen filter afterwards. Not even close.

https://github.com/nihui/waifu2x-ncnn-vulkan

./waifu2x-ncnn-vulkan -i ~/Pictures/rainbow.jpg -o ~/Pictures/rainbow4x.jpg -s 4 -n 1

Usage: waifu2x-ncnn-vulkan -i infile -o outfile [options]...

-n noise-level
denoise level (-1/0/1/2/3, default=0)
-s scale upscale ratio (1/2/4/8/16/32, default=2)
-t tile-size >=32 ..if GPU error reduce tile to like 64 or 128, default=auto)

to batch process see here
rainbow.jpg
132.6 KB
rainbow.jpg original image 680x549
rainbow4x.jpg
3.2 MB
rainbow4x.jpg Image Upscaled 4x to 2720x2196

I tried a few online AI image upscaling services and this gives similar results.
rainbowGimp.jpg
1.3 MB
rainbowGimp.jpg Used GIMP to upscale 4x | NoHalo and here's the result...just terrible.