this post was submitted on 30 Dec 2023
139 points (96.0% liked)
Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ
54565 readers
440 users here now
⚓ Dedicated to the discussion of digital piracy, including ethical problems and legal advancements.
Rules • Full Version
1. Posts must be related to the discussion of digital piracy
2. Don't request invites, trade, sell, or self-promote
3. Don't request or link to specific pirated titles, including DMs
4. Don't submit low-quality posts, be entitled, or harass others
Loot, Pillage, & Plunder
📜 c/Piracy Wiki (Community Edition):
💰 Please help cover server costs.
Ko-fi | Liberapay |
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Since CRF settings aren't that useful for hitting a specified filesize, you can use the following equation to calculate the bitrate needed to encode a video of a given runtime at a given file size
ie, my copy of Serenity is 01:58:55 long, which is 7135 seconds (see https://www.calculateme.com/time/hours-minutes-seconds/to-seconds), I want it to be 2.5gb, my equation is
You can use any tool, handbrake, ffmpeg, whatever, any codec, and this equation will tell you the average bitrate needed to hit that file size. You would use "vbr" encoding mode instead of crf. I'd recommend enabling 2-pass for x264, not sure if this would be needed/is available for x265 as I'm a bit of a stick in the mud re: video codecs.
Couple notes, I'm using SI units (powers of 10 instead of powers of 2) for the conversion, and am converting from bytes to bits as this is a more common unit to represent bitrates. If your software uses different units for the bitrate for some reason, or you prefer representing file sizes using gibibytes/etc then you'll need to rewrite the equation accordingly
That's a very good answer! Exactly what I needed.
Except don't do that. Hitting an exact target filesize will unnecessarily compromise the quality. You want constant quality or some high motion scenes or high detail scenes (rain or large crowds) will look really bad because the encoder is throwing out quality to hit an exact file size target.
Do a constant quality encode at say Q19. If the file is too big for you, up that to 22 and try again. When you find a q factor that's close to the file size you want, use it for everything.