this post was submitted on 22 Jul 2024
77 points (93.3% liked)

Programmer Humor

32024 readers
516 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

[Alt text: GIF from the music video for “Love Shack” by the B-52s. The video depicts people dancing in a convertible, multiple people in suits and dresses dancing (visible from the waist down), martinis, a duck shaking its tail, and two men playing saxophones. The subtitles read:

The Crowdstrike is a kernel-space app that

has no testing process

Crowdstrike! Baby Crowdstrike!

Crowdstrike! Baby Crowdstrike!]

you are viewing a single comment's thread
view the rest of the comments
[–] isaaclyman@lemmy.world 1 points 1 month ago (1 children)

True as that may be, I know how to add subtitles to a GIF from YouTube in 10 minutes or less. I don’t know how to do that to a video.

[–] ChaoticNeutralCzech@feddit.org 0 points 1 month ago* (last edited 1 month ago) (2 children)

GIF from YouTube

YouTube doesn't provide GIFs. It provides videos. Conversion to GIF is an unnecessary step. Use yt-dlp, Aegisub and ffmpeg for a FOSS way of downloading a video, trimming it and burning subtitles into it.

[–] thesmokingman@programming.dev 8 points 1 month ago (2 children)

The correct way to get someone to move to FOSS is to show them how to do it, not tell them it exists. OP already said they can do the YouTube -> captioned gif in 10min so you need to provide a simple tutorial that identifies the tools to use, how to set them up, and how to create a workflow to achieve the goal of some format with captions in under 10min.

Notice how I explained what was wrong and how to do it? That’s what’s missing from most “you need to use FOSS” posts, including yours.

[–] ChaoticNeutralCzech@feddit.org 3 points 1 month ago* (last edited 1 month ago)

I thought the average !programminghumor@lemmy.world user is already FOSSpilled. Of course you don't have to use the FOSS tools but they are convenient enough to be able to make this in 10 minutes.

Anyway, the relevant commands are

yt-dlp -f "bv*[height<=480]+ba" --no-mtime --convert-subs srt --write-sub https://www.youtube.com/watch?v=9SOryJvTAGs
# aegisub needs srt; we don't need above 480p

aegisub "The B-52's - Love Shack (Official Music Video) [9SOryJvTAGs].en.srt"
# now go rewrite appropriate lines in gui, apply style and save as "LoveShack.ass"

ffmpeg -i "The B-52's - Love Shack (Official Music Video) [9SOryJvTAGs].mp4" -filter_complex "[0:v]subtitles=LoveShack.ass[s];[s]crop=w=640[f]" -map [f] -map 0:a -ss 49 -t 21 -acodec aac -vcodec libx265 -crf 20 crowdstrike.mp4
# crf 20 for generously high quality because file size is small anyway

# or for Lemmy upload (no sound, WebM to prevent encoding...
# ...and subsequent ffmpeg timeout errors; my instance limits uploads to 10 MiB)
ffmpeg -i "The B-52's - Love Shack (Official Music Video) [9SOryJvTAGs].mp4" -filter_complex "[0:v]subtitles=LoveShack.ass[s];[s]crop=w=ih/3*4[f]" -map [f] -ss 49.5 -t 21 -vcodec vp9 crowdstrike.webm
# note that Lemmy instances limit videos to 900 frames (usually 30 s) by default

I didn't bother recreating your subtitle and cut timing but I did crop the video to 4:3. The frame rate is doubled and so is the apparent resolution, while the file size is 6x smaller; the Lemmy version is also about 6x smaller but I went for low-bitrate 720p:

[–] pfm@scribe.disroot.org 3 points 1 month ago

I want people like you around me!

[–] isaaclyman@lemmy.world 3 points 1 month ago (1 children)

Please don’t make me work hard for my memes

[–] ChaoticNeutralCzech@feddit.org -2 points 1 month ago* (last edited 1 month ago)

It's really not any harder than what you are currently doing. You'd just use a more reasonable video codec. But you do you, it's not that bad.