TG Telegram Group Link
Channel: GeekTips
Back to Bottom
So for video editing just need to pick a container mp4 or mkv. Choose a codec x265 or x264. x265 is smaller but takes a tad more time to encode. To do same as LosslessCut just make multiple Slice (z key). After you have 10 or so SLICEs then do Combine Video Quick.
For making precise cuts (segments) use ENCODE videotoolbox (Mac) or nvenc for Nvidia ..although file sizes are 5x or larger it goes 5x faster...then at end Combine Video Encoding the ENCODE video files and encode and you'll have a small file size.

You can do editing anywhere on your harddisk and the ENCODE cut will be in the same directory as source. You do need to be in ~/datampv/editing though for Combining the SLICEs or ENCODEs.
mpvconf20241119.zip
76 MB
mpv config 2024 Nov 19th 76MiB

mpv config for Mac and Linux. Install instructions

- Allow' single quotes in chapter names for Make Opus Audiobook (also in substitcher).

- Sub-pause added Enable/Disable Listening mode shortcuts for learning foreign languages. By default set it to pause for 5 seconds.

- added pull request version of video_silence_cutter.py for removing silence in substitcher

- Added a few more fonts (115+ currently) 24MB of fonts, 72MB of LUTs
@Geektips
removing emoji....best to just never download it in the first place. With yt-dlp use --restrict-filenames

emoji="\U1f300-\U1f5ff\U1f900-\U1f9ff\U1f600-\U1f64f\U1f680-\U1f6ff\U2600-\U26ff\U2700-\U27bf\U1f1e6-\U1f1ff\U1f191-\U1f251\U1f004\U1f0cf\U1f170-\U1f171\U1f17e-\U1f17f\U1f18e\U3030\U2b50\U2b55\U2934-\U2935\U2b05-\U2b07\U2b1b-\U2b1c\U3297\U3299\U303d\U00a9\U00ae\U2122\U23f3\U24c2\U23e9-\U23ef\U25b6\U23f8-\U23fa"
for f in *.m4a ; do fnew=$(echo "$f" | sed -e "s/[$(printf $emoji)]//g" -e 's/ / /g'); mv "$f" "$fnew"; done


this works but only in zsh and can't put it in a bash script. Supposedly works in bash > 4.x though.

for f in *.m4a ; do fnew=$(echo "$f" | sed -e "s/[$(printf $emoji)]//g" -e 's/  / /g'); mv "$f" "$fnew"; done


this one worked for some emoji but not all

this one I ended up using to get rid of emoji in Transnomino (Mac free app renamer) regex [\p{So}\p{Cs}] and takes out emojis.
find "$PWD" -type f -name "*.epub" -exec epub2txt -f {} \; ; find "$PWD" -type f -name "*.txt" -exec mv {} . \; ; for f in *.txt ; do n=`echo $f | sed 's/[^0-9]*//g'` ; p=`printf "%03d" $n`; new=`echo $f | sed "s/${n}/${p}/"`; mv "$f" "$new"; done

after using calibe with splitepub plugin it'll output an epub for each chapter. Copy that directory with subdirectories which contain the chapter01.epub, chapter02.epub, etc. and run this command. It'll output nicely formatted text chapters that are easily to clean up. Then just batch run edge-tts to make an opus chaptered audiobook.
either brew install titlecase (perl) is the one I currently use. pip3 install titlecase (python) one is just as good.

This (awk) one though is pretty good I refined somewhat. If it's all caps it'll titlecase it but if just some are caps it'll assume they're acronyms and leave them untouched.

005 Of Mice And Men Of The Best
becomes 005 Of Mice and Men of the Best
Notice the Of after the number stays caps but the other of doesn't.

If not numbers for chapters that'll also work.
Lord Of The Rings
Lord of the Rings

brew install gsed 

for Mac and just change gsed to sed on Linux

title="005 Of Mice And Men Of The Best"; newtitle=$(echo "$title" | sed -E -e 's/^([0-9]+)//g' -e 's/:/:/g' -e 's/\|/-/g' -e 's/\//-/g'); num=$(echo "$title" | sed -E 's/(^[0-9]+ )*(.*)/\1/g'); echo -n "$num"; echo -n "$newtitle" | awk 'BEGIN{split("a the to at in of on with and but or",w); for(i in w)nocap[w[i]]}function cap(word){return toupper(substr(word,1,1)) tolower(substr(word,2))}{for(i=1;i<=NF;++i){printf "%s%s",(i==1||i==NF||!(tolower($i) in nocap)?cap($i):tolower($i)),(i==NF?"\n":" ")}}' | gsed -E -e 's/(\s*-\s*)([a-z])/\1\u\2/g' -e 's/(\s*:\s*)([a-z])/\1\u\2/g' -e 's/(^[0-9]+) ([a-z])/\1 \u\2/g'
cat some.vtt | sed -e '/WEBVTT/d' -e '/-->/d' | awk '!seen[$0]++' | awk 1 ORS=' ' > some.txt


This is what I use to get flowing plain text from a vtt subtitle. Then just need to manually add paragraph breaks.

1st one removes WEBVTT from top of file
2nd one deletes timecodes -->
3rd one removes duplicate lines and blank lines
4th one removes new lines for flowing text

for f in *.vtt; do cat "$f" | sed -e '/WEBVTT/d' -e '/-->/d' | awk '!seen[$0]++' | awk 1 ORS=' ' > "${f%.*}".txt ; done
Switched to VSCodium (telemetry ET phone home disable by default. Kinda like Librewolf instead of Firefox)..not quite yet a fan of Zed..can't even do word wrap easily.

VSCode 600MB compared to 354MB for VSCodium. Only two extensions I couldn't find on open-vsx repository.

One is string manipulation useful for Titleize (AP) Style once in awhile and subtitles for editing subs occasionally. Need to have VSCode installed to download them. First uninstall them then right click and download vsix.

codium --install-extension marclipovsky.string-manipulation-0.7.25.vsix


codium --install-extension pepri.subtitles-editor-1.1.7.vsix
Only extensions I use currently in VSCodium.

Harper is working pretty decent for an open-source grammar / spelling checker. Although they got bought out by WordPress recently hopefully will remain a viable option.
I really don't think coreml (Mac Silicon) is worth it. Instead of 2x speed for large-v2 it bumps it 0.3x speed. Mac is pretty much unusable. Think I'm gonna stick with large-v3-turbo for 5x realtime speed and split audio segments into 30 second chunks.
https://alexbeals.com/projects/image-motion/

must use Chrome (I use Iron) only for this and a couple other extensions. Firefox / Librewolf won't work unfortunately.
applied a LUT named alexjordan orange dark look
qpdf --add-attachment test.typ -- test.pdf new.pdf

attaches a typst source to make the PDF so it can be modified. Kinda like LibreOffice Hybrid PDF.
qpdf --list-attachments new.pdf 

test.typ -> 78,0

then just compile a new PDF once you modify the test.typ
typst c test.typ --open

extract attachment by opening PDF with Firefox / Librewolf and clicking on attachment icon then clicking on typst file to save it to harddisk.
mkdir -p splitmd ; for f in *.md ; do awk 'BEGIN { abbrevs["Mr."] = 1; abbrevs["Mrs."] = 1; abbrevs["Ms."] = 1; abbrevs["Dr."] = 1; abbrevs["U.S."] = 1; abbrevs["U.S.A."] = 1; abbrevs["i.e."] = 1; abbrevs["e.g."] = 1; sentence_count = 0; paragraph_sentences = "" } { gsub(/([.!?])\s+/, "\\1\n"); sentence = ""; for (i = 1; i <= NF; i++) { word = $i; if (abbrevs[word] || (i < NF && abbrevs[$i " " $(i+1)])) { sentence = sentence word " " } else if (match(word, /[.!?]$/)) { sentence = sentence word; sentence_count++; paragraph_sentences = (paragraph_sentences == "") ? sentence : paragraph_sentences " " sentence; if (sentence_count % 6 == 0) { printf "%s\n\n", paragraph_sentences; paragraph_sentences = "" } sentence = "" } else { sentence = sentence word " " } } if (paragraph_sentences != "") { printf "%s\n", paragraph_sentences } }' "$f" > splitmd/"$f" ; done


awk script to segment every six sentences into a paragraph. Only breaks a sentence at . ? or ! and not at the listed abbreviations Dr. Mrs. Mr. U.S.A, etc.
We have a baby. Mr. Apple is a great teacher.  We won! Don't think you won or do you? Eat healthy. Chugging in U.S.A. but losing soon. Drink soda for lunch. Never all alone. Drink sitting down. Do you know Mrs. Brown? I certainly do.  Life is great. Give it up already 13th sentence. 14th sentence.


will output
We have a baby. Mr. Apple is a great teacher. We won! Don't think you won or do you? Eat healthy. Chugging in U.S.A. but losing soon.

Drink soda for lunch. Never all alone. Drink sitting down. Do you know Mrs. Brown? I certainly do. Life is great.

Give it up already 13th sentence. 14th sentence.
How is that useful. Say you did a transcription to vtt subs and wish to produce a PDF from the subs.

gsed -i -E 's/(^[0-9]{2}:[0-9]{2}\.[0-9]{3} --> )([0-9]{2}:[0-9]{2}\.[0-9]{3})/00:\100:\2/g' *.vtt

# get rid of duration for pdf chapter titles and add .md extension to rename

for f in *.vtt; do cat "$f" | sed -e '/WEBVTT/d' -e '/-->/d' | awk '!seen[$0]++' | awk 1 ORS=' ' | gsed -E -e 's/(\? )([a-z])/\1\u\2/g' > "${f%.*}".md ; done
HTML Embed Code:
2025/06/30 15:08:09
Back to Top