this post was submitted on 23 Aug 2023
61 points (89.6% liked)

Selfhosted

40183 readers
1032 users here now

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:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. 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.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

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?

top 36 comments
sorted by: hot top controversial new old
[–] Snowplow8861@lemmus.org 36 points 1 year ago (1 children)

So I think you may not know about quick sync, an Intel transcoding acceleration feature of Intel gpus in Intel CPUs.

https://handbrake.fr/docs/en/latest/technical/video-qsv.html

There's information about it for I think plex and handbrake and ffmpeg in general. This is how some people do real time transcoding for media servers. But I'm not an expert. I just hope you can be guided with easier search terms.

[–] AFLYINTOASTER@lemmy.world 18 points 1 year ago

What a great example for the community you are, my guy. I love it.

Speaking up, knowing you don't have the full answer but can at least point in a general direction, is HUGE in a community full of constant and rapid change where the previous years information could already be outdated or even obsolete.

[–] RxBrad@lemmings.world 11 points 1 year ago (1 children)

Intel 7th gen & higher CPUs have Quicksync that does hardware h265 encoding.

You can get an old i5-7500 PC pretty cheap these days. That's what I have, and tDarr converts about an hour of 1080p h264 content to h265 in roughly 10min.

[–] SnailMagnitude@mander.xyz 1 points 1 year ago

so any nuc with a number 7 or more would do the job?

[–] quinkin@lemmy.world 6 points 1 year ago (1 children)

If time is not a consideration just batch up transcodes with your shitty hardware and nice/renice the process out of the way.

[–] SnailMagnitude@mander.xyz 1 points 1 year ago

It seems unreasonable with the hardware, even with nice things.

I run Gentoo, with lots of binaries, on my 2011 iMac just fine but encoding HD video on it feels like abuse.

[–] bigredgiraffe@lemmy.world 6 points 1 year ago* (last edited 1 year ago) (1 children)

As the other person said, NUCs and such are able to do transcodes via Intel QuickSync hardware acceleration, it’s not really possible to transcode 4k in realtime on most CPUs without it.

You will need at least an 8th gen Intel processor to do HVEC which is what h265 uses, more info is in this chart on Wikipedia about which generations support which things. Anecdotally, this has worked extremely well for me for a long time, definitely worth it.

Also be aware if you are doing any virtualization you will need to pass the iGPU through to the guest machine.

[–] RxBrad@lemmings.world 2 points 1 year ago* (last edited 1 year ago) (1 children)

7th gen Intel (Kaby Lake) can encode h265, also. Not just 8th gen.

Source: I encode to h265 almost daily using Quicksync on my i5-7500.

[–] bigredgiraffe@lemmy.world 3 points 1 year ago (1 children)

Yeah that is true, I had mixed results on the quality of the video using the 7th gen ones so I usually recommend at least 8th gen but that may have improved by now.

[–] SnailMagnitude@mander.xyz 1 points 1 year ago (1 children)

Thank you.

I think I will aim for =>8

[–] bigredgiraffe@lemmy.world 1 points 1 year ago

No problem! I actually am still using 8500k still since it was new for what it’s worth, those things are great no complaints.

[–] Afiefh@lemmy.world 4 points 1 year ago

Sorry, you need hardware.

If you are doing a ton of encoding, you could even get specialized hardware like amd alevo (spelling?) card which enables you to encode even AV1.

That being said, what are you doing that requires you to encode h.265 on ancient hardware?

[–] cmnybo@discuss.tchncs.de 3 points 1 year ago (3 children)

If you want real time transcoding, then a hardware encoder would be best. Intel CPUs have had hardware H.265 encode support for the last 8 years. Intel ARC GPUs have a very good video encoder, but they require system that supports resizable BAR.

If you just want to transcode a large number of videos for storage, get a system with loads of CPU cores and run multiple transcodes in parallel. Software encoders produce higher quality video than hardware encoders.

There are cloud GPUs, but that gets very expensive, very fast. You are much better off buying your own hardware if you need to use it for a longer period of time.

[–] SnailMagnitude@mander.xyz 2 points 1 year ago (1 children)

Thanks

What is resizable BAR?

[–] SteveTech@programming.dev 2 points 1 year ago (1 children)

It improves memory access to the GPU, but I don't believe it's required for Intel ARC anymore.

[–] SteveTech@programming.dev 1 points 1 year ago

they require system that supports resizable BAR

I don't think it's required anymore, but it's definitely still recommended.

[–] maiskanzler@feddit.de 1 points 1 year ago

The encoder engine is the same for all ARC GPUs, meaning you can by the lowest end one and it has the same encoding/decoding performance as the top tier one.

[–] Faceman2K23@discuss.tchncs.de 3 points 1 year ago

An intel nuc with an IGPU from the last few generations would do it no problem (even a pentium or i3 from the last few generations would be better than what you have by the sounds of it).

Or you can grab a cheap used quadro p600 or gt1050 (minimum model with hardware H265 NVENC support) and use that for transcoding or run an app like tdarr, unmanic or fileflows to convert your library to a direct streamable format in the background.

Why are you even requiring transcode is also something to look at, you should be trying to get your playback devices to play the raw files directly, that means a solid network infrastructure and properly configured software. If they are physically incapable of playing your 4k media then you need to look at upgrading them.

This all applies whether you are running plex, jellyfin, emby or whatever else.

[–] HarriPotero@lemmy.world 3 points 1 year ago (1 children)

It's hard to beat a GPU in HEVC encoding performance. SoC:s have comparable performance to dGPU:s in that regard. A used zen/zen2 laptop might be a cheap and tiny workhorse for the purpose. I have a zen/vega10 matebook 2020 that does 1080p at around 2.5-3x real-time at high quality presets. No doubt it could do 4k at faster presets.

With the hardware in my arsenal I've found that AMD>Intel>nVidia, at least quality wise. VideoToolbox on Mac is down there with nVidia, and Apple silicon being pretty slow at it compared to software x265 on the same machine.

[–] princessnorah@lemmy.blahaj.zone 2 points 1 year ago* (last edited 1 year ago) (1 children)

Where have you heard that about Apple Silicon? Not that I’m trying to say it’s better than the others, but it is absolutely better than software encoding on the same machine.

Post in thread 'Mac Mini M1 H.265 encoding?' https://forums.macrumors.com/threads/mac-mini-m1-h-265-encoding.2269815/post-29606894

https://www.reddit.com/r/mac/comments/y0t4z6/hardware_accelerated_video_transcoding_apple/irviw29/

[–] HarriPotero@lemmy.world 0 points 1 year ago* (last edited 1 year ago)

Haven't heard anything, just from memory of my own testing. Looking back at my notes I see a 40-50% speed up with VideoToolbox compared to x265 on M1, but at a lot crappier quality.

I haven't tested in quite a while, though. I wrote off doing encoding on the M1, as my AMD cards are a lot faster (and produce better results).

[–] grooving@lemmy.studio 1 points 1 year ago

Try handbrake maybe https://handbrake.fr Might not be exactly what you want but something to look at while you wait for other answers.

If you are actively making 4k videos through, I think it might be time for you to upgrade.

[–] AustralianSimon@lemmy.world 1 points 1 year ago

NUC should be fine. I have unmanic running in a container on it converting anything I add to folders.

[–] dandroid@dandroid.app 1 points 1 year ago* (last edited 1 year ago) (1 children)

I converted all my ripped Blu Rays over the past couple of weeks. I just used ffmpeg. It took a a while to find the right options to keep subtitles and multiple audio channels and such, but eventually I got it all perfect.

I found that using my GPU made the quality absolute shit. It was about 3x faster than using my CPU though.

[–] MolochAlter@lemmy.world 2 points 1 year ago (2 children)

Do you maybe have the command line for it? Looking to do something similar myself.

[–] Nawor3565@lemmy.blahaj.zone 1 points 1 year ago

If you're actually ripping bluerays, I would highly recommend using MakeMKV. It's technically paid software but while it's in beta you can can a free license key from their forums. BluRays can be formatted oddly and include a bunch of crap you probably don't want (preroll ads, etc), so when I tried to rip one with jusy ffmpeg it was a pain, but MakeMKV deals with most of that for you and gets a 1-to-1 copy of the movie files + anything like captions and alternate audip tracks.

[–] dandroid@dandroid.app 1 points 1 year ago (1 children)

I put it in a script, so I'll need to check my server later.

Do we have a remindme bot here?

[–] MolochAlter@lemmy.world 1 points 1 year ago (1 children)

Not as far as i know, consider this my reminder, I guess? 😅

[–] dandroid@dandroid.app 3 points 1 year ago (1 children)

Your reminder worked! Here is the command I used. I put it in a script, and would pass it the file I wanted to convert.

ffmpeg -i "$1" -vcodec libx265 -crf 28 -map 0 -c:s copy "${1%.*}.h265.mkv" > ./convert_logs 2>&1 < /dev/null &

If I called this script convert_to_h265.sh, I would call it with convert_to_h265.sh some_video.mkv

Here is an explanation for the options I used:

ffmpeg is the command
-i "$1" is the input file. In this case, the argument to the script
-vcodec libx265 is specifying the plugin to use as libx265
-crf 28 is specifying the quality/compression rate. I found this one to be pretty acceptable
-map 0 makes it select ALL audio tracks and ALL subtitle tracks
-c:s copy copies subtitle tracks
"${1%.*}.h265.mkv" specifies the output file. In this case, everything up to the last dot, then replace the extension with '.h265.mkv'
> ./convert_logs 2>&1 < /dev/null tells the program to output to a log file instead of writing to your terminal. It also sets the input to nothing, and without that, it won't work in a script for some reason.
& tells the whole thing run in the background so it doesn't hold up your terminal. You can even close your terminal and do other things and check back on it later.

You can monitor the progress with tail -f convert_logs

If you want to get fancy, you can even put this in a loop to run on all the files that end in .mkv in the current directory:

for i in *.mkv; do
       ffmpeg -i "$i" -vcodec libx265 -crf 28 -map 0 -c:s copy "${i%.*}.h265.mkv" > ./convert_logs 2>&1 < /dev/null
done

And if you want to get mega fancy, you can have it run recursively for all files that end in .mkv in the current directory and all files in all child directories.

shopt -s globstar
for i in **/*.mkv; do
        ffmpeg -i "$i" -vcodec libx265 -crf 28 -map 0 -c:s copy "${i%.*}.h265.mkv" > ./convert_logs 2>&1 < /dev/null
done

If you do either of the latter two, I would put it in a script. Let's call the first one convert_all_to_h265.sh and the second one convert_all_to_h265_recursively.sh. Call them with convert_all_to_h265.sh & and convert_all_to_h265_recursively.sh & if you want to run them in the background.

You also might want to play around with the -crf 28 value if you want more compression or more quality. The lower the number, the better the quality. It needs to be a value between 0 and 51.

[–] MolochAlter@lemmy.world 2 points 1 year ago (1 children)

Dude this is the most thorough explanation of a single command line I've ever had!

Thanks for the effort, and the line itself.

[–] dandroid@dandroid.app 2 points 1 year ago

I put a hours of research into this, and I felt like documentation was difficult to understand, so I wanted to pass along what I've learned! I hope it works for you.

[–] riesendulli@discuss.tchncs.de 1 points 1 year ago* (last edited 1 year ago)

Besides new hardware and windows, here is a tool that will you can sink time into. There is a lot of things to lern.

https://github.com/staxrip/staxrip

[–] NathanUp@lemmy.ml 0 points 1 year ago (1 children)

Cloud GPUs are a thing, but they're very expensive.

[–] eager_eagle@lemmy.world 1 points 1 year ago

it depends, they break even if you run them for many hours a day, but for smaller / quicker workloads they can make a lot of sense

[–] HumanPerson@sh.itjust.works -1 points 1 year ago

I would recommend trying to rent a vps for just long enough to transcode and using that. It would be way cheaper than buying new hardware.