Transcoding anything >720p is painful.
I run ancient hardware for desktop/laptop >10yrs old apple stuff running linux. I consume media mainly via rpi4 or android.
What’s a minimum level system capable of trans-coding 4k video to x265 in at the very least real time? Is there a tiny trans-coding device out there somewhere?
Would a NUC do? How old or new to churn out 4k x265
Can I avoid hardware? Are cloud gpu’s a thing?
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.
Rules:
Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.
No spam posting.
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.
Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
No trolling.
Resources:
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
What are you transcoding from, and what is your reason for wanting to do this? It might not be worth th effort. Lossy to lossy transcoding is already not ideal, and hardware encorders end up trading either size or quality in exchange for speed. I’ve played with NVENC h.265 a lot and found the end results weren’t really any smaller than what x264 gives me for similar quality, so I just use x265 and deel with the slower encodes.
It may be cheaper to just buy more storage.
Seconded, depending on what your goals are with transcoding, you might want to reconsider your strategy.
Hardware encoding (with a GPU) is mostly useful for realtime transcoding applications like streaming video. There are definitely some caviats that come with the realtime performance, and you’ll find that NVENC encoded video is almost always inferior to the slower equivalent software encoded variants.
So let’s talk codecs: While h.265 might seem like the holy grail, it is way more computationally intensive than h.264 is. In some cases the difference in encoding time will even be as high as 3-5x. Not really worth it if all you’re gaining is a slightly lower filesize.
Your results will vary by the media you’re encoding, by your encoder quality settings, tuning and encoding speed. As a rule of thumb: slower encoding speeds equal more efficiently compressed video (a.k.a. relatively higher quality for lower file size).
Handbrake is my choice of software for encoding video. It includes pretty much everything you could ever want if you’re not looking for niche codecs and exotic video formats.
I find myself mostly using x264 because it is relatively fast and still provides awesome results. My encoding speed is always set to “slow” or “superslow” (not much difference for my setup). I usually set the quality by making use of the preview function in handbrake, which transcodes just a short section of the video which I use for pixel peeping and checking for any major artifacts that would ruin the content. The resulting file also provides an estimate for how large the final transcoded file will be. If you’re happy with the quality setting, you can opt to mess with the encoder tuning. There are different presets for film, animated content and such. I usually do use film tuning if transcoding live-action media.
All this generally leaves me with pretty compact file sizes for 1080p media. And transcoding usually happens at a rate of 60-75 fps depending on the resolution. Going up from “slow” to “medium” improves fps by about 25% and increases file size by about 10%. The ideal balance is up to you.
Advanced tips: try using VMAF (objective video quality analysis algorithm developed by Netflix) to score and compare your different encoding settings. VMAF is neatly integrated into FFMetrics, which is a GUI for FFMpeg and a couple of video analysis algorithms. I also use MPV (open source media player) with FFMpeg command line arguments for playing videos synchronized in a 2x1 or 2x2 matrix. This helps compare the results for quality.
I don’t have anything that can play 4k h264 aside from my phone.
My Rpi4 plays 4k h265 beautifully, so I like h265. Space efficient is just a bonus.
mpv & ffmpeg have been my go to’s for a decade or so…but mpv on the Rpi4 can’t yet manage 4k 2160p afaik, so Kodi it is at the moment.
I investigated AV1 for a bit, which frankly does seem like the future because it can encode to significantly smaller file size vs. 264 and 265. I don’t have a hardware encoder for it (though they exist in the new Intel GPUs), and software encodes are relatively slow even on capable hardware (e.g. Ryzen 7000).
But it’s not worth it at all. The detriments of lossy to lossy + the sheer cost of time (and electricity) to make the change are not worth it. 2TB SSDs are cheaper than 1TB was a year ago, and 8TB mechanical drives for slow storage are even cheaper still. And it isn’t showing any signs of getting more expensive, nor should it.