>>19318891>>19318775I have been tinkering with my script for a while now, at this point it's half bash functions and I'll probably end up making the whole thing into a proper bash script by the end of it, I can post that for you then.
Unfortunately -c copy imports all those yucky timestamps, you kinda want to re-encode it straight away. The main steps should be
yt-dlp -f "(bestvideo+bestaudio/best)" <url-to-video> --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss <start-timestamp> -t <duration-in-seconds>" -o streamclip
that gets you the clip you want in youtube's vp9 encoding. start 10ish seconds before the clip and go 3ish seconds longer to give yourself keyframes to work with
then
ffmpeg -y -i streamclip.webm -c:a copy -c:v libvpx -b:v 10M -crf 5 -vf "crop=in_w/4:in_h/2:3*in_w/4:in_h/2" -ss 00:00:01 -t 999 soundpost-crop.webm
will crop, trim, and almost-losslessly transcode to the vp8 codec. the "crop=..." stuff in there is currently set to crop to bottom right corner since that's usually where the chuuba's avatar is, you'll have to look up ffmpeg's "crop" video filter if you want to play around with it. the -ss sets teh start time and -t is how the long should go.
after that,
ffmpeg -y -i soundpost-crop.webm -c:a copy -c:v libvpx -vf "scale=-1:-1" -b:v 2M -crf 20 soundpost.webm
and mess around with scale, bitrate (-b:v), and quality factor (-crf) to get the video portion below 3mb, 4chan's limit
then
ffmpeg -y -i soundpost.webm -an -c:v copy soundpost-video.webm; ffmpeg -i soundpost.webm -vn -c:a copy soundpost-audio.ogg
upload the "soundpost-audio.ogg" to catbox, url encode the link, and rename the "soundpost-video.webm" to "bae birthday message from gura [sound=blahblah.ogg].webm" or whatever, and you should be good to go
the main problem and the reason the process is so messy rn is encoding to vp8 is fucking painfully slow, on my machine it runs at 0.5x playback speed and I like to fiddle with the cropping and trimming a shit ton, having to wait 2 minutes for a 1 minute soundpost every time I want to adjust the start time by half a second or change the crop slightly makes it fucking suck. so instead I'm transcoding to stuff like mp4 that runs at 4x playback, fiddling with the settings, and then running a final pass of the actual encoding to webm with those settings. also the whole convert to soundpost and upload and rename stuff is fully automated for me and uploads to multiple hosts since soundplayers can support multiple hosts, that way catbox dying won't kill my soundposts