Skip to main content

Media Library

I wanted to build my own local storage for digital media that I have purchased, such as movies and TV shows. I did have this idea for a long time, but I did not know even where to begin. I got motivated by Jeff Geerling's video and blog post on unsubscribing from various streaming services and building one's own collection. Furthermore, I did not have too much information about this beforehand, so I built this blog post to help any other beginners out there who are interested in building their own local collection. Of course, you can "sail the high seas", but I will not be discussing any of that here.

Pricing

Personally, price is really important for me when I think about pursuing a project or think about investing in a subscription. That is why I will be creating a chart which reflects how much ideally I would be paying for these services. Here is how much streaming services are currently charging (as of March 2023) for the bundle that has HD (1080p) content in it:

NamePrice (Monthly in USD)Plan
Netflix15.492 devices at once, Ad-free
Hulu7.99Ad-supported content
Prime Video8.99Ad-free
Disney Plus7.99Ad-supported content
HBO Max9.99Ad-supported content
Crunchyroll7.99Ad-free

In order to watch the shows you want to watch, you end up paying a good amount. Plus, these companies have proven time and time again, that they will drop and pick up any shows that they want. This is where building your own library comes into play. You get to choose what you want in the library. In addition, you can get the raw quality of the movie (ex. 4k movies). Here is the pricing for the hardware and software I paid for in order to build my own video media library:

NameTypePrice (USD)
LG Electronics Ultra Slim Portable Blu-ray/DVD Writer Optical Drive - BP60NB10Optical Drive109.99
WD 6TB My Book Desktop External Hard Drive - WDBBGB0060HBK-NESNHard Drive$97.75
MakeMKVTranscoder (Converter) Software60
Movies and Shows purchased in hard copy (DVD/Blu-ray)MediaDepends on your content library

If you want to see the size of the output file before buying a DVD or Blu-ray Disk, I would recommend checking out https://thediscdb.com/ or asking in the MakeMKV Forum or subreddit.

There are some movies that are native 4K and some are upscaled to that resolution. I use the following to check what the native resolution of a movie/show is: https://www.blu-ray.com/ and https://thedigitalbits.com/columns/the-4k-uhd-release-list/4k-uhd-list-01. You can also search online for "\"movie_name" tech specs" and see what is stated for "Digital Intermediate". If it says 2K for the intermediate, then it is upscaled. If it says 4K for the Intermediate, then it is native.

Video Conversion

Video Encoding 101

Video encoding is the process of converting RAW video into an output. Digital videos need to be encoded in order to be played on various platforms, as some cannot handle RAW data. Video encoding is sometimes referred to as video compression, and decoding is referred to as decompression. Video encoding involves two main processes: compression and transcoding. Compression significantly decreases the size of the video file, so it is more manageable. This allows the file to be able to load quickly or be uploaded much faster online (because the file is smaller). Transcoding refers to the audio and video conversion from one format to another. It ensures that a video file is compatible with the video player and/or platform it is using. Without transcoding, users would not be able to watch the video file at all.

Codecs 101

A codec is a method for compressing or decompressing data (in this case, a video file) so it can be easily transported to different applications. Choosing the right codec can result in the desired quality, file size, or encode speed. Here are some examples of Codecs: x264, x265, FFmpeg, DivX, and Xvid.

Containers 101

A container combines an encoded audio stream (audio codec), encoded video stream (video codec), and metadata in a single video file. Each container supports a different range of video codecs. Examples of video containers are MP4, MKV, AVI, WMA, MOV, FLV, etc. Usually, you will see these as extensions to video files (ex. Movie.mp4).

Video Resolutions

This is just a chart I wanted to put in here just for comparison of the various resolutions for video.

Resolution TypeCommon NameAspect RatioPixel Size
SD (Standard Definition)480p4:3640 x 480
HD (High Definition)720p16:91280 x 720
Full HD (FHD)1080p16:91920 x 1080
QHD (Quad HD)1440p16:92560 x 1440
2K video1080p1:1.772048 x 1080
4K video or Ultra HD (UHD)4K or 2160p1:1.93840 x 2160
8K video or Full Ultra HD8K or 4320p16∶97680 x 4320

DVD vs. Blu-ray

I never knew the difference between DVD and Blu-ray, other than the name. I made this chart to make it clearer for others in the same position as myself.

DVDBlu-ray
Media typeOptical discHigh-density optical disc
Storage Capacity

4.7GB (single-layer)8.5GB (dual-layer)

25GB (single-layer)50GB (dual-layer)

Laser wavelength650nm (red laser)405nm (blue laser)
Hard coatingNoYes
Data transfer rate (video/audio)10.08 Mbps54.0 Mbps
Max video resolution480p,576p

1080p2160p4k Ultra HD

Video codecsMPEG-2

MPEG-2MPEG-4 AVCSMPTE VC-1

Audio codecs

Linear PCMDolby DigitalDTS Digital Surround

Linear PCMDolby DigitalDolby Digital PlusDolby TrueHDDTS Digital SurroundDTS-HD

Usage

AnimationsMoviesVideos

Data storageHigh-definition video (1080p) High-definition audioStereoscopic 3DPlayStation 3 gamesPlayStation 4 gamesXbox One games

Content protection systemCSS 40-bitAACS-128bit / BD+

H.264 vs. H.265

H.264 and H.264 are popular codecs used to encode video media. I did not know the difference between them as well, so I looked online to see what I could find. Here are some of the differences between them:

H.264H.265
Known asAVC (Advanced Video Coding)HEVC (High Efficiency Video Coding)
Supported container formatsmkv, mp4, qtff, asf, avi, mxf, ps, ts, m2ts, evo, 3gp, f4vmkv, mp4, qtff, asf, avi, mxf, ps, ts, 3gp
Recommended bandwidth for video encoding

480p — 1.5 Mbps720p — 3 mpbs1080p — 6 Mbps4K — 32 mbps

480p — 0.75 Mbps720p — 1.5 mpbs1080p — 4 Mbps4K — 15 mbps

H.264 seems to be used as there is a lot more compatibility with it. However, there is a growth in the use of the H.265 due to it having a smaller footprint, and it is more efficient, thus allowing it to be good for streaming services.

Drive Testing

In order to make sure that the drives you have are internally "good", there are checks you can do to make sure of that. You can kind of think of this as stress testing the system to make sure it is able to function as expected. There are a lot of good recommendations on r/DataHoarder at https://www.reddit.com/r/DataHoarder/wiki/index/#wiki_possible_pages.2Farticles_for_wiki (Check 5.3.1-5.3.4). From my research, they essentially break down to the following tests (some are for Linux and others for Windows):

TestCommand(s)Note
SMART long test

smartctl -A /dev/sdxxsmartctl -t long /dev/sdxx

Device has to be SMART compatible
SMART short testsmartctl -t short /dev/sdxxDevice has to be SMART compatible
badblocksbadblocks -wsv -b 4096 -t 0x55 -o ~/output_file.txt /dev/sdxxbadblocks is a Linux utility to check for bad sectors on a disk drive.
fiosudo fio --filename=/dev/sdxx --name=randwrite --ioengine=sync --iodepth=1 --rw=randrw --rwmixread=50 --rwmixwrite=50 --bs=4k --direct=0 --numjobs=8 --size=300G --runtime=7200 --group_reportingfio spawns a number of threads or processes doing a particular type of I/O action as specified by the user.
h2testwHas GUI, read more: https://3ds.hacks.guide/h2testw-(windows).html
Hard Disk SentinelHas GUI, read more: https://www.hdsentinel.com/

I would also recommend checking out https://github.com/Spearfoot/disk-burnin-and-testing for those who use Linux. Do your own research on these before using them. I have seen people use SMART tests for health checking drives, and the rest of the software for actually stress testing the drive. Everybody has a different preference for how much to stress test their systems. I myself used the following command sudo badblocks -wsv -b 4096 -t 0x55 -o output.txt /dev/sdxx, and it took 23 hours 54 minutes and 51 seconds to complete for a 6 TB hard drive. After this, I encrypted the drive.

MakeMKV (Windows)

In order to set up MakeMKV, there is some setup you have to do to get it to work. Do your own security due diligence for anything listed here. This is what worked for me. Here is the list:

Steps

  1. Connect the Optical Disk to your PC.
  2. Open the MakeMKV software (I have covered my Serial Number for my device)
  1. Use the SDFtool Flasher and the respective bin file to flash the optical drive.
    1. I used the GUI, so I did not have to deal with the command line for this
    2. The bin file will have the optical drive name in the file name (ex. DE_LG_BP60NB10-NB12_1.02-MK.bin)
  1. The Information should look different (if done correctly)
  1. Insert the DVD/Blu-ray disc into the optical drive
    1. Can be done manually by pressing the button on the drive or by clicking the "eject" button on the toolbar
    2. The "Data capacity" field lets you know the size of the output file (although I have covered it, just for covering my own ass)
  1. Click on the optical drive icon
  1. Select the files you want and choose an output folder. Then click on the icon under "Make MKV"
  1. Wait for the process to complete
  1. UHD F.A.Q.: https://forum.makemkv.com/forum/viewtopic.php?f=12\&t=16883
  2. Is my movie native 4k or upscaled 4k?: Google Spreadsheet Link

Post MakeMKV

I was only after the "Raw" output from MakeMKV. However, there are more pathways you can go from here. Here are a couple that I have seen others do.

Playback

Here are some of the media players that I have used to watch digital content: mpv.io and VLC. I have seen mpv.io be recommended time and time again in various channels relating to media storage. I have also heard about MPC-HC be good for MakeMKV output as well.

Handbrake

Handbrake is a video transcoding tool that allows you to covert video to other codecs. This allows you to decrease the size of the file exponentially, while maintaining a good amount of the quality. I have heard people decrease the size of videos by 3-5x using transcoding. There are a lot of presets that handbrake has, which one can use for easy transcoding. I have seen others have their own presets and own methods, which they have worked on over their tenure using Handbrake. In Jeff's video, he uses the HQ 1080p30 Surround preset. For 4k videos, he goes to the "Dimensions" tab, and changes the "Resolution Limit" from 1080p HD to 2160p 4k Ultra HD. I did try to use Handbrake, just to play around with it. It ended up using ALL of my GPU resources. Here are some tips I found (not tested) that have seemed to work for others:

In Handbrake (Windows/Linux):

  • Set "Video" > "Advanced Options" to: -x threads=1
  • Set "Video" > "Advanced Options" to: --encoder-preset=veryslow
  • (combination) Set "Video" > "Advanced Options" to: --encoder-preset=veryslow -x threads=1
  • Set "Video" > "Advanced Options" to: pools=<enter number here>
    • This ends up working for most people

In Windows:

  • Open the "Task Manager" application
  • Click on the "Details" tab and scroll to Handbrake (Handbrake.exe)
  • Right Click on it and select "Set Affinity"
  • Enable or disable any CPU cores you want

In Windows (as well):

  • Open Handbrake > Tools > Preferences
  • Go to the "Advanced" tab and find "Priority Level"
  • From the dropdown, choose "Below Normal" or "Low"
    • Handbrake will be given less CPU when other tasks are being done

NAS

A network attached storage (NAS) is a way to have multiple people on the network be able to access shared resources. There are many companies that are notable in the NAS community: QNAP, Synology, and ASUSTOR. Just a FYI, this can get expensive really fast. With a NAS, you can store your video files in one location, and anybody on the network can access it. This is great for family uses, since any member can view what they want, without "bothering" others. Using something like Jellyfin can make this have a great web user interface for you and others to use.

Stats

As this is an educational blog, here are some stats for media I was able to convert.

TypeDurationFile Size
Movie (4K - Upscaled)1H:43M:27S58.4 GB

Sources