rave/dance/breakbeat/hip-hop/trip-hop
i've been using this to convert btwhttps://github.com/chameleon-ai/webm-for-4chanit's very quick and easy for hitting target filesizes required heregeneral usage:webm_for_4chan.py <yt-URL>webm_for_4chan.py -i input.mp4 -b 2 --music_mode --auto_crop --board wsg -o "output.webm"
>>6156893Author here> -b 2Do you often find that it overshoots in music mode and you have to specify -b? I can do some more tests and make adjustments to the bitrate compensation table if this is a persistent problem. Also "--board wsg" is default, no need to specify."--blackframe" also seeks past the initial black frames as seen in >>6156903 which seems to be very common in music videos.
>>6156913>Do you often find that it overshootsout of the about 50 files i converted so far without that flag it overshot maybe 10 times by a few kb, so i'm just adding it preemptively to avoid needing to re-encode. it's great to have a tool to do this for me so i'm trying to see how fast/efficient i can make it.i just got it to overshoot just now without -b 2, and adding --fast, but that's to be expected from expediting a 2-pass.so on average it's hitting the mark without any help, but -b is a time-saving flag if the source material is garbage quality anyway and don't think it would harm it to have a few more pixels.there were only 2 videos i just couldn't get under 6 and gave up on because the sources were of higher original quality/weren't garbo VHS rips. one was the voodoo ray official video https://www.youtube.com/watch?v=j7vxHOCeiQ4so per your suggestions this is what i'll run for my own example:.\webm_for_4chan.py https://www.youtube.com/watch?v=7mXHV5JaZnw -b 2 --fast --blackframe --music_mode --auto_crop -o "House Corporation - I Know I Can Do It.webm"i've noticed that if i try change the value for -o to a full path or a relative path when specifying a youtube url, i get a file not found and the terminal breaks. i'm running the .py from H:\downloads\ and would prefer to make it go to H:\downloads\out\but i can work around this probably by just running the py from that folder or something.
i'm getting into the homage/homemade part of youtube that aren't real music videos but it will have to do
>>6156931Got Voodoo Ray first try with "--audio_rate 96 --blackframe" but it looked like ass so I redid with "--deadline best". Still looks like ass, but slightly less crunchy ass.I'm wondering if the overshoot is because audio rate in music mode is typically higher than 96k so ffmpeg is really struggling to get 4-5 minute videos into like 1-2MB. Actually for most old music videos I'd be surprised if the true audio quality is over 96k anyway so you may be wasting audio bits with music mode.I'll look into the path issue, that sounds pretty annoying.Also be careful using yt-dlp with youtube, 50 in a day can get you IP banned, they've really ramped up recently on detection.
>>6156981crunchy is par for the thread theme so anything goes>yt-dlp with youtubeye it's happened already but it's always temporary, i sat out the cooldown with a burger and fries. i get banned more often and for longer from this shithole board than i do from yt. i'm fizzling out now anyway might be back later or tomorrowone more thing and i hate to pile this on but i got an 'input file not found' error just by running this.\webm_for_4chan.py https://www.youtube.com/watch?v=Lxx9rTEOo-U -b 2 --fast --blackframe --music_mode --auto_crop -o "Sunset Regime - I've Got The Real Feel.webm"i think it's because the title has an apostrophe in it closing the input filename too early, could be an easy fix
>>6157002Thanks for the data point.Sometimes direct url downloads don't work because it will first use yt-dlp to fetch the file name, then download it, but if yt-dlp fails and falls back to a different file name (like it wanted to download the .mkv but fell back to the .mp4) it will fail.But yeah I'll see if it's something besides that, and the output directory problem is probably a separate issue. I like the feedback though because it makes the experience more seamless for everyone when bugs are fixed.
>>6156821This song gives me the urge to drink some Blackcurrant Tango.
>>6157002I've made some tweaks, you can now specify an output directory, like "-o videos/" and it should encode the video in that directory using the same name.I've also added some stuff for yt-dlp so hopefully you'll get a more informative print if you get a file not found error. Let me know if you have problems or if you still run into the same errors.
>>6157912cool that worksit helps me keep yt dls out of the same folder as converted filesthe only other error i ran into was when i messed up and forgot a double hyphen for --audio_rateunfortunately i don't have the log open anymore. it would say something verbatim like "unknown command: udio rate" which seems like the switch gets truncated due to the missing hyphen? it's user error, i just mentioned it in case that's not intentional.one thing i would like to know, can i pass through -y for overwrite to ffmpeg?again thanks for making this tool, it's the only reason i made this thread and i wouldn't have done this many webms if i didn't have it
>>6157949> one thing i would like to know, can i pass through -y for overwrite to ffmpeg?You're talking about the duplicate filename check? Alright, not a bad idea, so I added it. Just don't shoot yourself in the foot with "-o ./ -y"The other thing is just user error, can't do anything about it and I don't control how python parses arguments.Glad you like the script. Over time I've added a lot of features due to feedback from anons. Everyone seems to use it a little differently and I keep getting surprised at edge cases. Cheers anon, I've been grooving to this thread.
hwaccel test
>>6158039i'm getting extremely fast encodes with h264_nvenc on my 3060Tiinstead of 3-4 minutes per VP9 with my CPU at 100%, with H264 on my GPU it's 6 seconds.would be great to have this option nativeall i did was change every instance of 'libx264' to 'h264_nvenc' in the script and adjusted the preset names and it works way faster on my hardwarehttps://pastebin.com/3uMCemVb875:ffmpeg_args.extend(["-c:v", "h264_nvenc", "-preset", "p1", "-tune", "lossless"])1493:video_codec = ["-c:v", "h264_nvenc", "-preset", 'p4' if args.fast else 'p6']1526:carbon_copy_cmd.extend(['-c:v', 'h264_nvenc', '-preset', 'p4', '-tune', 'hq', '-c:a', 'libopus', '-b:a', '512k', '-sn', carbon_copy_output])
>>6158187My hardware doesn't support that, so I can't test it, but I did add it as an option, so you can now specify "--codec h264_nvenc" and I believe it will work based on my research of the documentation.By the way, if your hardware supports it, you can also specify "--codec vp9_vaapi' for hardware accelerated webm.I recommend webm for music since opus generally performs better than aac at the same bitrate, and youtube usually gives you audio in the form of 128kbps opus.
>>6158487i was testing it last night. vp9_vaapi is fast and it works but it still uses CPU on my setup.h264_nvenc was a couple seconds faster and i can see on my performance graphs the entire encode happened on the GPU.i tested the script it seems to be working perfectlyit seems to fall back to using libx264 if i specify --mp4 alongside --codec h264_nvencand then the encode takes about 10 seconds because it's using my weaker CPUbut if i go with --codec h264_nvenc raw, the second pass encode is literally 2 seconds on my GPUthis is useful for me because my CPU might already be working while my GPU typically sits idleffmpeg seems to support nvidia hardware support out of the box, i didn't compile a special version or anything, and every nvidia GPU made in the past few presidential terms should support H264 encodethanks again for your work
>>6158574Yeah "--mp4" is just a shorthand for "--codec libx264" so they will conflict. I didn't really think about people using both flags so I'll probably add some logic in there to deconflict and make it less surprising.But I'm glad it's working. Always kinda awkward making a commit I can't test.