Skip to main content
Media

Media #

Warning: This post hasn't been updated for over a year. The information may be out of date.

dwebp #

Online manual: dwebp(1) — Arch manual pages

Credit: How to Convert WebP to PNG in Linux

dwebp pic.webp -o pic.png

Batch:

for f in *.webp;  do dwebp "$f" -o "${f%.webp}".png; done

convert (imagemagick) #

Online manual: convert(1) - Linux man page

Convert SVG #

Original size: (credit)

convert -background none pic.svg pic.png

Given PPI: (credit)

Reference: ImageMagick - Command-line Options #density

convert -density 300 pic.svg pic.png

Trim transparent part of png #

Credit: ubuntu - how to cut transparent part from photo with command or shell script - Stack Overflow

Need to read:

convert -fuzz 25% -trim +repage pic.png pic-trim.png

Batch trim:

for f in *.png;  do convert -fuzz 25% -trim +repage "$f" "${f%.png}-trim".png; done

yt-dlp #

# list all available formats
yt-dlp --list-formats "https://www.youtube.com/watch?v=..."

# download best audio + best video
# if has ffmpeg, then will merge automatically
yt-dlp --format ba+bv "https://www.youtube.com/watch?v=..."
yt-dlp --format ba+614 "https://www.youtube.com/watch?v=..."

# download best mp4/m4a or convert to mp4
# requires ffmpeg
# source: https://old.reddit.com/r/youtubedl/comments/otjtex/
yt-dlp --format-sort res,ext:mp4:m4a --recode mp4 "https://www.youtube.com/watch?v=..."

# download & split chapters & rename chapters
# requires ffmpeg
# sources:
# https://old.reddit.com/r/youtubedl/comments/101n1qe/
# https://geekingfrog.com/blog/post/yt-dlp-accurate-chapters
yt-dlp --format ba+bv --split-chapters --force-keyframes-at-cut --output "chapter:%(section_number)s %(section_title)s.%(ext)s" "https://www.youtube.com/watch?v=..."

According to pukkandan’s comment in yt-dlp/yt-dlp Issue #6595, the ffmpeg command is:

ffmpeg -y -loglevel "repeat+info" -i "file:video.f248.webm" -i "file:video.f251.webm" -c copy -map "0:v:0" -map "1:a:0" -movflags "+faststart" "file:video.temp.mkv"

Also see: ffmpeg.