this post was submitted on 01 May 2024
55 points (98.2% liked)

Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ

54826 readers
588 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
Ko-fi Liberapay

founded 2 years ago
MODERATORS
 

I have a collection of about ~110 4K Blu-Ray movies that I've ripped and I want to take the time to compress and store them for use on a future Jellyfin server.

I know some very basics about ffmpeg and general codec information, but I have a very specific set of goals in mind I'm hoping someone could point me in the right direction with:

  1. Smaller file size (obviously)
  2. Image quality good enough that I cannot spot the difference, even on a high-end TV or projector
  3. Preserved audio
  4. Preserved HDR metadata

In a perfect world, I would love to be able to convert the proprietary HDR into an open standard, and the Dolby Atmos audio into an open standard, but a good compromise is this.

Assuming that I have the hardware necessary to do the initial encoding, and my server will be powerful enough for transcoding in that format, any tips or pointers?

all 30 comments
sorted by: hot top controversial new old
[–] sxan@midwest.social 22 points 7 months ago (2 children)

Just FYI, despite what media companies would like you to believe, making copies of media you own for your own use is not piracy. It's allowed by law under fair use.

[–] fenndev@leminal.space 12 points 7 months ago (1 children)

Mhm, I'm aware. I just figured the nice folks here would likely have more experience with codecs and such than elsewhere!

(That, and, if I can build my own replacement Disney+, I would definitely want to share with friends.)

[–] sxan@midwest.social 2 points 7 months ago

I'm sure you're right.

[–] Lemmchen@feddit.de 5 points 7 months ago (1 children)

Depending on your jurisdiction. Big asterisk.

[–] sxan@midwest.social 3 points 7 months ago

True, good catch.

[–] shrugal@lemm.ee 14 points 7 months ago (1 children)

Best tip I can give is to use a tool that's made for this task, like Tdarr/FileFlows/Unmanic. They take care of all the complicated issues like encoders, ffmpeg parameters and parallel processing on multiple nodes, so you only have to handle the things you actually care about.

[–] dan@upvote.au 4 points 7 months ago

Unmanic is way easier to understand than Tdarr. I use it to transcode DVR recordings recorded using Plex and a HDHomeRun tuner. Digital TV uses MPEG2 which has pretty large file sizes.

[–] RvTV95XBeo@sh.itjust.works 8 points 7 months ago (1 children)

You're about to embark on a massive journey and I wish you the best of luck :D

Compressing 110 4K movies is going to be a long encode time, but it will be so nice to digitize that collection.

First question: if you already have them ripped and stored, do you even need to re-encode them? If you have a powerful enough Jellyfin server for transcoding, that may be enough.

That said, if you're looking to optimize for space and quality, there's some questions to ask:

  • proprietary (but ubiquitous) HEVC or the emerging open standard AV1? It's going to be a lot easier finding tips/guides for HEVC.

  • Constant Rate Factor (CRF), or Average Bit Rate (ABR). CRF tends to be more straightforward if you have a varied collection of content because it let's the encoder choose settings to deliver consistent quality. 2-pass average bit rate is good if you have a target size or compatibility in mind - great for squeezing out the absolute optimal quality if you're trying to fit on a Blu-Ray disc or meet certain streaming criteria, but 2x the encode time (hence "2-pass") can be a tough sell.

Stick with software encoding, steer clear of hardware solutions like NVENC. They're crazy fast, but inconsistent quality.

There's some guides out there on converting DV to HDR 10+ etc, but I don't have a lot of experience with that process.

[–] fenndev@leminal.space 3 points 7 months ago (1 children)

The issue is storage costs. Currently they (and some Blu-ray shows I ripped) are taking up just over 12TB. I bought all of these movies when I had money to spend on stuff like that, but money is short and times are tough. "Storage is cheap" but my wallet is cheaper right now, aha.

[–] RvTV95XBeo@sh.itjust.works 3 points 7 months ago (1 children)

Look, I definitely get it, but just a note, encoding 100+ 4k HEVC movies is going to take months of time at full PC loads. It's a subtle cost, but depending on your electricity rate, running a 200W PC 24/7 for 3 months straight may hurt your bottom line more than it helps.

If you already have the storage, the cheapest option may be just to keep it. If you're looking to increase the size of your collection it may be about even to save 6 TB via encode and to buy an extra 6TB disc, depending on your setup

[–] jbrains@sh.itjust.works 3 points 7 months ago

I am definitely keeping an eye on my electricity bill right now, since I have Unmanic running full speed and it's about 3 weeks into a 4-month job that might only save 1 TB.

[–] DaGeek247@fedia.io 6 points 7 months ago

I did a comparison trying to find where my personal "good enough" and techinically indistinguishable crf levels were at a little while ago. It may be worth looking into as a start. I've never really touched hdr before though.

Comparing compression levels

[–] authorinthedark@lemmy.sdf.org 5 points 7 months ago* (last edited 7 months ago) (2 children)

oh hey I've actually done this recently so a lot of this is fresh for me. Now I had a slightly different use case than you, I had a bunch of AV1 files that wouldn't run on my pi so I had to convert them to something less GPU intensive. I was finding x265 was indistinguishable for me from AV1, and had a HUGE file size drop, close to a half or even a third. x264 had a larger file size than 265 and looked worse so I don't recommend it. I did not try VP9 once I was satisfied with 265 but you could try it out and see how it compares. My recommendation is to pick one (shorter) file and run a couple of different transforms on it till you're satisfied before trying to transform your entire library

Preserving audio and metadata is trivial, just use -c:a copy for audio and -c:d copy for metadata

EDIT: I feel dishonest not mentioning the important caveats regarding my own experiments. My files were 1080p, so the difference between codecs might be less noticeable at that resolution. It was also anime, which is similarly going to be easier to compress and be less distinct between codecs. This is why I cannot recommend x264 because if you can ruin 1080p anime it'll ruin whatever you're working with. This is why I recommend picking a sample video and spend a day running a couple test transformations on it to see what you like

[–] DaGeek247@fedia.io 3 points 7 months ago (1 children)

Skipping the audio encode from a blu-ray will lose op out on a surprisingly large amount of space, especially with 110 source disks. I checked one of my two hour blu-ray backups. Audio will net you about nine audio tracks (english, french, etc). A single 5.1 448kbs audio track will take about 380MB of space per movie. Multiply that by nine (the number of different tracks in my sample choice) and you'll get 3420MB per disk. That means about 376GB of space is used on audio alone for ops collection. A third of a terabyte. You can save a lot of space by cutting out the languages you don't need, and also by compressing that source audio to ogg or similar.

By running the following ffmpeg command; ffmpeg -i out-audio.ac3 -codec:a libvorbis -qscale:a 3 small-audio.ogv I got my 382MB source audio track down to 200MB. Combine that with only keeping the language you need, and you end up dropping from 376GB down to 22GB total.

You can likely save even more space by skimping on subtitles. They're stored as images, so they take up a chunk of space too.

[–] marci33@feddit.it 1 points 7 months ago (1 children)

Since you're talking about anime, how did you solve the subtitles problem? My pi doesn't transcode fast enough but I haven't found a tdarr extension to do that automatically (nor a command)

[–] authorinthedark@lemmy.sdf.org 2 points 7 months ago

I'm sorry my subtitles worked fine from the beginning so I don't know what to tell you. I've got a pi4 running osmc as my media center if that makes any difference.

[–] reddthat@reddthat.com 5 points 7 months ago (1 children)

If you want to do an open codec, use AV1 codec and Opus for audio.

https://github.com/master-of-zen/Av1an and use aomenc for the av1 codec.

Ffmpeg doesn't have good av1 support.

[–] Lemmchen@feddit.de 2 points 7 months ago* (last edited 7 months ago) (2 children)

With current hardware support I would advise against using AV1 or even H.265.

I'd recommend to experiment with H.264 and low CRF values to see what quality loss and file size OP is comfortable with: https://trac.ffmpeg.org/wiki/Encode/H.264

[–] DaGeek247@fedia.io 12 points 7 months ago (2 children)

God no. X264 is way worse than x265 is way worse than av1 for quality by size.

Yes, everything made in the past 15 years can do x264, but that does not mean it is a good idea. Only do x264 if you have a specific device that needs it. Otherwise, x265 is a better choice for long term storage.

[–] fenndev@leminal.space 5 points 7 months ago (1 children)

AV1 is definitely what I'd like to do. I'm not aiming for maximum compatibility; small file size and high quality encodes are my goal. I can transcode if needed.

[–] Lemmchen@feddit.de 4 points 7 months ago

Keep in mind at least your server should be able to decode whatever you choose in hardware, so AV1 might still not be a good idea depending on your current hardware and upgrade plans.

[–] Lemmchen@feddit.de 2 points 7 months ago* (last edited 7 months ago)

You're right, I forgot about the on-the-fly transcoding abilities of Jellyfin for a moment. But still, the server should be able to handle whatever codec they choose in hardware.

[–] dan@upvote.au 3 points 7 months ago (1 children)

What hardware doesn't support H.265?

[–] Lemmchen@feddit.de -1 points 7 months ago (1 children)

Old smartphones, old CPUs/GPUs, some SBCs.

[–] dan@upvote.au 2 points 7 months ago* (last edited 7 months ago)

How many of those are you streaming video to, though?

Intel iGPUs have supported H265 since 7th gen, which is 8 years old now (released in 2016). Nvidia added support the same year, starting with the GTX1050. Even the Raspberry Pi 4 supports hardware-accelerated H265.

[–] ancoraunamoka@lemmy.dbzer0.com 2 points 7 months ago (1 children)

Are those your own blurays? Then share them before compressing.

Transcoding is hard. There is no way that your transcoding settings are going to be a one size fits all. I am currently encoding the famous iKaos Dragonball release and I did 48 samples before deciding what configuration to use.

You are better off downloading stuff from torrent, especially for newer media. You'll find a community that put 100x your time collectively on transcoding. That will also save from your tremendous electricity costs.

Also look into vmaf for quality metrics. Consider that switching to uncompressed 1080 might bring you close to your goal with very very low effort.

Btw, can you share the title list?

[–] fenndev@leminal.space 1 points 7 months ago* (last edited 7 months ago) (1 children)

Yeah, sure thing.

Abominable
Ad Astra
Aladdin (Live Action)
Aladdin
Alien - Covenant
Alien
Ant-Man and the Wasp
Ant-Man
Aquaman
Arrival
Austin Powers In Goldmember
Austin Powers - International Man of Mystery
Austin Powers - The Spy Who Shagged Me
Avengers - Endgame
Avengers - Infinity War
Baby Driver
Batman and Robin
Batman Forever
Batman
Batman Returns
Big Hero 6
Black Panther
Bohemian Rhapsody
Brave
Captain Amercia - Civil War
Captain America - The First Avenger
Captain America - The Winter Soldier
Captain Marvel (2019)
Cars 2
Cars 3
Cars
Cinderella (Live Action)
Close Encounters of the Third Kind 40th Anniversary Edition
Deadpool 2
Deadpool
Detective Pikachu
Doctor Sleep
Doctor Strange
Everything Everywhere All At Once
Fantastic Beasts - The Crimes of Grindelwald
Finding Dory
Finding Nemo
First Man
From Up on Poppy Hill
Frozen II
Frozen
Gemini Man
Godzilla (1998)
Godzilla - King of the Monsters
Gremlins
Guardians of the Galaxy Vol 1
Guardians of the Galaxy Vol 2
Halloween
Harry Potter and the Chamber of Secrets
Harry Potter and the Deathly Hallows - Part 1
Harry Potter and the Deathly Hallows - Part 2
Harry Potter and the Goblet of Fire
Harry Potter and the Half-Blood Prince
Harry Potter and the Order of the Phoenix
Harry Potter and the Prisoner of Azkaban
Harry Potter and the Sorcerer's Stone
Howl's Moving Castle
Incredibles 2
Incredibles
Inside Out
Interstellar
Iron Man 2
Iron Man 3
Iron Man
IT (2018)
John Wick 3 - Parabellum
John Wick - Chapter 2
John Wick
Joker (2019)
Jumanji (1995)
Jurassic Park III
Jurassic Park
Jurassic Park - The Lost World
Jurassic World - Fallen Kingdom
Jurassic World
Kiki's Delivery Service
Kingsman - The Golden Circle
Kingsman - The Secret Service
Logan
Maleficent - Mistress of Evil
Maleficent
Mary Poppins Returns
Moana
Monsters, Inc
Monsters University
My Neighbor Totoro
Pacific Rim Uprising
Paprika
Ponyo
Ratatouille
Robin Hood
Spider-Man - Homecoming
Spider-Man - Into the Spider-Verse
Spirited Away
Starship Troopers
Star Trek - Beyond
Star Trek - Into Darkness
Star Trek (2009)
Tangled
The Cat Returns
The Expendables 2
The Expendables 3
The Expendables
The Good Dinosaur
The Hulk
The Jungle Book
The Karate Kid (1984)
The Lion King (Live Action)
The Lion King
The Little Mermaid
The Matrix
The Matrix -  Reloaded
The Matrix -  Revolutions
The Predator
The Princess and the Frog
The Secret Life of Pets 2
The Secret World of Arrietty
The Shining
The Wizard of Oz
Thor
Thor - The Dark World
Toy Story 2
Toy Story 3
Toy Story 4
Toy Story
Turning Red
Up
Us
Venom (2018)
Wall-E
Waterworld (2019)
Wonder Woman
Wreck-It Ralph
Zootopia
[–] ancoraunamoka@lemmy.dbzer0.com 1 points 6 months ago

yeah, I would redownload all of those instead of transcoding. They are all available with very good encodes publicly

[–] Coasting0942@reddthat.com 1 points 6 months ago

Consider online file converters. Just pay for a month or two, obviously need a good internet connection.