Hey everyone, I’m building a new server to run Jellyfin (with a few other services like Pi-hole) and I’m stuck on GPU or CPU transcoding.

My main concern is smooth 4K HDR transcoding for 1 stream. I’ve been reading mixed advice online – some people say a strong CPU with good single-core performance can handle it, while others recommend a dedicated GPU.

Should I focus my budget (~$1000AUD/$658USD) on a good CPU, or spend some of it on a dedicated GPU?

  • narc0tic_bird@lemm.ee
    link
    fedilink
    English
    arrow-up
    28
    ·
    8 months ago

    Like others said an Intel CPU with iGPU, alternatively the cheapest Intel Arc GPU (A380?) supports the latest spec of Intel QSV as well.

  • MangoPenguin
    link
    fedilink
    English
    arrow-up
    24
    ·
    8 months ago

    Intel Quicksync would do it, no need for a dedicated GPU.

  • entropicdrift@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    19
    ·
    8 months ago

    You can easily do smooth 4K HDR transcoding with any modern Intel CPU with integrated graphics.

    I have an Intel N100 and it can probably handle 2-3 4K HDR transcodes at once. Definitely more if they’re being transcoded down to lower resolutions. Encoding is the most intensive part of the process.

    • khi@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 months ago

      I don’t know where you’ve bought your N100 but i think it shouldn’t be able to do that. I have one too and it cant do even one 4k 10bit HDR transcode.

      As i see in the results from the benchmarks we’ve gathered (here: https://gist.github.com/ironicbadger/5da9b321acbe6b6b53070437023b844d), my experience seems to be the common one.

      While de N100 is a great value and low energy processor for a jellyfin server (especially if you direct play everything as is my case), I think if the objective is 4k hdr 10bit it will fall short as in my experience it usually transcodes at 8-9fps.

      • entropicdrift@lemmy.sdf.org
        link
        fedilink
        English
        arrow-up
        11
        ·
        edit-2
        8 months ago

        I use QSV hardware acceleration with Low Power h264 and HEVC encoders enabled, plus VPP tonemapping on Jellyfin. I have Prefer OS Native DXVA or VA-API decoders checked (apparently this is needed for VPP tonemapping) and also Enable Tone mapping checked so it can fallback onto OpenCL if VPP doesn’t work. Thread count set to Auto. Preset is set to medium. h265 encoding CRF of 25, h264 encoding CRF of 23 and I have Throttle transcodes enabled, which seems to increase the number of videos I can have transcoding at once due to not transcoding more than necessary whenever a player has enough buffer for the moment.

        This is on the latest Jellyfin linuxserver.io container with the OpenCL-Intel docker mod.

        Also, not sure if this is a factor but I’ve got 16 GB of single channel RAM on it and I use a USB-mounted SSD for my cache and transcode folders. In the past I ran into bandwidth issues by having my transcodes be on the same drive as my media.

        I get 4K HDR to 4K SDR tonemapping plus 7.1 Dolby TrueHD to 2.0 AAC transcoding at 70-75fps with my setup.

        Transcoding of 4K down to lower resolutions is even faster. 4K HDR to 480p SDR runs at 191fps.

        I took a look at the benchmark script those results are from and compared them to the ffmpeg commands auto-generated by my Jellyfin server for actual transcodes.

        Here’s how the command to transcode a 4K HDR 10 bit HEVC with 7.1 AAC audio to 4K SDR h264 with 2.0 AAC audio looks on my machine:

        /usr/lib/jellyfin-ffmpeg/ffmpeg -analyzeduration 200M -init_hw_device vaapi=va:,kernel_driver=i915,driver=iHD -init_hw_device qsv=qs@va -filter_hw_device qs -hwaccel vaapi -hwaccel_output_format vaapi -autorotate 0 -i file:"/Films/Man of Steel (2013)/Man of Steel (2013) Bluray-2160p Proper.mkv" -autoscale 0 -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -low_power 1 -preset medium -look_ahead 0 -b:v 7616000 -maxrate 7616000 -bufsize 15232000 -g:v:0 72 -keyint_min:v:0 72 -vf "setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709,scale_vaapi=format=nv12:extra_hw_frames=24,hwmap=derive_device=qsv,format=qsv" -codec:a:0 libfdk_aac -ac 2 -ab 384000 -ar 48000 -af "volume=2" -copyts -avoid_negative_ts disabled -max_muxing_queue_size 2048 -f hls -max_delay 5000000 -hls_time 3 -hls_segment_type mpegts -start_number 587 -hls_segment_filename "/transcodes/53a1ea6d1a7a34b888e73230f9ff04e2%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "/transcodes/53a1ea6d1a7a34b888e73230f9ff04e2.m3u8"
        
        

        And here’s the command that benchmark runs for 10-bit HEVC:

        /usr/lib/jellyfin-ffmpeg/ffmpeg -y -hide_banner -benchmark -report -c:v hevc_qsv -i /config/ribblehead_4k_hevc_10bit.mp4 -c:a copy -c:v hevc_qsv -preset fast -global_quality 18 -look_ahead 1 -f null - 2>/dev/null
        

        So I’m gonna go out on a limb and say there’s a major difference in configuration between the two. Setting global_quality to 18 is kind of absurdly high quality for hardware h265 encoding. You can easily get away with 28 for “good enough”. My setting of 25 for the CRF of h265 encoding is already edging into placebo territory for most videos. That’s all without considering the impact of low power mode, extra_hw_frames, etc.

      • Rehwyn@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        8 months ago

        It’s not Jellyfin, but here’s my N100 simultaneously doing two 4K HDR transcodes with tone mapping enabled. Neither stream had buffering.

        So it’s definitely a capable chip, but might be dependent on transcode settings.

        • khi@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          8 months ago

          Yeah after seeing this and another very detail answer it looks line my settings are too demanding and that is causing a slowdown. Since i do direct playing on everything i might just turn them down for the one friend who seems to be always on the weirdest player that needs transcoding. Thanks all!!

    • Rogers@lemmy.ml
      link
      fedilink
      English
      arrow-up
      3
      ·
      8 months ago

      Intel GPUs look like a great value. And AV1 hardware acceleration is a game changer

  • Possibly linux@lemmy.zip
    link
    fedilink
    English
    arrow-up
    16
    ·
    8 months ago

    GPU all the way as it will be more efficient. Keep in mind Intel integrated graphics counts as a GPU

  • Faceman🇦🇺@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    12
    ·
    8 months ago

    One of my miniPCs is just a little N95 and it can easily transcode 4K HDR to 1080p (HDR or tonemapped SDR) to a couple of clients, and with excellent image quality. You could build a nice little server with a modern i3 and 16gigs of ram and it would smash through 4 or 5 high bitrate 4K HDR transcodes just fine.

    Is that one transcoding client local to you? or are you trying to stream over the web? if it’s local, put some of the budget to a new player for that screen perhaps?

    • Possibly linux@lemmy.zip
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 months ago

      I tried that with a cheap minipc I bought and it was CPU limited. The GPU was fine it was the overhead that killed me.

      • Faceman🇦🇺@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        2
        ·
        8 months ago

        Was it an n100? They have a severely limited power budget of 6w compared to the n95 at 25w or so.

        I’m running jellyfin ontop of ubuntu desktop while also playing retro games. That all sits in a proxmox vm with other services running alongside it. It’s perfectly snappy.

          • Faceman🇦🇺@discuss.tchncs.de
            link
            fedilink
            English
            arrow-up
            2
            ·
            8 months ago

            N5095 ? lots of reports of that one not supporting everything it should based on other Jasper Lake chips, CPU getting hit for Decode when it shouldn’t for example. Also HDR to SDR cant be accelerated with VPP on that one as far as I know so the CPU gets smashed. I think you can do it with OpenCL though.

  • AtariDump@lemmy.world
    link
    fedilink
    English
    arrow-up
    9
    ·
    8 months ago

    The easiest and cheapest solution is don’t allow transcoding.

    The easiest way to do that is separate your 720/1080p videos from your 4k videos. Limit 4k access to the users that can play 4k

  • Diplomjodler@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    8 months ago

    I’ve been trying to get this to work for weeks now. No dice, so far. Anybody know any useful guide on setting it up for a docker installation? Or does it only work if you install the.deb? I use Mint, BTW. Server is a Dell with a 9th gen i5.

    • SmallBorg@lemm.ee
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      8 months ago

      I also struggled to get it to work with an Intel Celeron N5100. To get it to work I followed the instructions in the Jellyfin documentation. It seems like there are some additional steps for some versions of Intel CPUs, could it be that yours is affected? After enabling “Low-Power Encoding” it worked as expected.

        • SmallBorg@lemm.ee
          link
          fedilink
          English
          arrow-up
          4
          ·
          8 months ago

          Yes, I have it installed as a Docker container in a Debian 12 machine. My Docker compose file is something like this:

            jellyfin:
              container_name: jellyfin
              image: jellyfin/jellyfin
              group_add:
                - "105" 
                - "44"
                - "102"
              devices:
                - /dev/dri/renderD128:/dev/dri/renderD128
                - /dev/dri/card0:/dev/dri/card0
          

          The group numbers were obtained following Jellyfin’s documentation.

          You also need to configure Jellyfin from Menu > Playback. In “Hardware acceleration” I selected “Intel QuickSync (QSV)”. I have selected all but AV1 (not supported by my CPU) from “Enable hardware decoding from:” and from “Hardware encoding options:” I have enable all 3 of them.

  • tables@kbin.social
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    8 months ago

    I think those miniPC CPUs do a good job transcoding from what I’ve read, the N95 and N100. I already had older hardware set up when I added Jellyfin so I got a cheap nvidia Quadro P400 for the transcoding. If you’re setting up a new system though, I’d guess a Intel iGPU would be more than enough.

    I’ve looked at https://www.elpamsoft.com/?p=Plex-Hardware-Transcoding before for transcoding comparisons.

  • lemmyvore@feddit.nl
    link
    fedilink
    English
    arrow-up
    4
    ·
    8 months ago

    I have no idea what the people who recommend CPU are smoking. The difference between a GPU with hardware support and doing it on the CPU is huge.

  • nutbutter@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 months ago

    My optiplex with i5-6500TE can transcode 4K videos easily if the codec is AVC. HEVC is different story though. Any CPU newer than 10th generation would be more than enough for your needs, I’d say.

  • bbc@l.dongxi.ca
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 months ago

    My current setup:

    • one stream using CPU transcoding, Intel Xeon E2246G
    • six streams using GPU transcoding, Nvidia Tesla P4
  • Pyrosis@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 months ago

    Setups for hardware decoding are based on the underlying OS. An example quite common is docker on Debian or Ubuntu. You will need to pass the appropriate /dev/ directories and at times files into your jellyfin docker container with the device environment variable. Commonly that would be /dev/dri

    It gets more complicated with a vm because you are likely going to be passing the hardware directly into the vm which will prevent other devices outside the vm from using it.

    You can get around this by placing docker directly on the os or placing docker in a Linux container with appropriate permissions and the same devices passed into the Linux container. In this manner system devices and other services will still have access the the video card.

    All this to say it depends on your setup and where you have docker installed how you will pass the hardware into jellyfin. However jellyfin on docker will need you to pass the video card into the container with the device environment variable. Docker will need to see the device to be able to do that.

      • Pyrosis@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        8 months ago

        Nothing but love for that project. I’ve been using docker-ce and docker-compse. I had portainer-ce but just got tired of it. It’s easier for me to just make a compose file and get things working exactly like I want.

  • HumanPerson@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 months ago

    Well it isn’t really CPU vs GPU. It is integrated vs dedicated GPU. A CPU certainly can transcode, but not well. A lot of CPUs have integrated graphics which can handle transcoding quite well. I went with an Intel arc a380 because I know quite a lot of people could hit it under some circumstances. For most people though, I would recommend an Intel CPU with quicksync. What you really should spend your budget on IMO is as much storage as you can.