Hardware encoding in jellyfin docker (portainer)

  • Hi,

    I have just setup jellyfin in docker (raspberry pi 4) and I am able to access it over internet.

    As jellyfin has option to transcode videos for internet, I want to setup hardware encoding using raspberry pi's gpu.

    How to add gpu to docker?

    Without hardware encoding, cpu usage reaches almost 90%.


    Please guide. :)

  • If you are using the linuxserver docker image for jellyfin, they made the setup pretty simple:

    https://github.com/linuxserver…yfin#openmax-raspberry-pi

    It seems that Jellyfin has dropped support for hardware encoding via OMX libraries as Raspberry Pi is migrating to V4L2.

    Jellyfin already has support for V4L2 but many features will not work properly as per their docs.


    Also, Portainer IO has given support to add GPU to a specific environment and then attach it to containers as per need.

    But adding GPU to a environment requires Index number or UUID if GPU.


    Any idea how to find gpu uuid in raspberry pi 4..?

  • Any idea how to find gpu uuid in raspberry pi 4..?

    Don't expect much performance with Pi4.

    It's not a PowerHouse although, running locally Kodi, it works well on FullHD HighBitrate files

    To play 4k files, it stutters.

    And this is locally.

    To stream it via jellyfin (4k) better find another Hardware.


    As for Hardware Acceleration on the Pi via docker, use this flags:

    And this is instructed on the GitHub page

    Code
        devices:
          - /dev/video10:/dev/video10
          - /dev/video11:/dev/video11
          - /dev/video12:/dev/video12
  • Yes, I am planning to buy better hardware next year maybe.

    But for now I am just experimenting with pi.


    On running :

    Code
    ls -a /dev/

    I can see several /dev/video1X , i.e.

    video10, video11...... and so on to video31.


    So I have to add all those devices...?

    (Sorry I am new at this)

  • So I have to add all those devices...?

    Only the ones I posted on #4

  • Ok, thanks.

    One more thing, we do need to specify proper ffmpeg path in jellyfin settings, right??

    IIRC, I only changed this:


    The path to ffmpeg was already there (it's taken care by the container)

  • GPU is not used, CPU usage between 75% to 90%.

    I still fail to understand what you want to achieve.

    What are you doing and what are you expecting?


    If you want to have a base-set to compare this is my CPU% while watching a series episode movie via Internet from my Pi4-8Gb running aarch64 at home (different country) to Italy where I'm currently working:

    Code
    Top - 19:25:48 up 5 days, 24 min,  0 users,  load average: 0.97, 0.54, 0.27
    Tasks: 298 total,   4 running, 291 sleeping,   0 stopped,   3 zombie
    %Cpu(s): 25.3 us, 10.1 sy,  0.0 ni, 62.0 id,  0.0 wa,  0.0 hi,  2.5 si,  0.0 st
    MiB Mem :   7855.9 total,    171.0 free,   2215.8 used,   5469.1 buff/cache
    MiB Swap:      0.0 total,      0.0 free,      0.0 used.   5384.4 avail Mem
    
        PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
     292754 xxxx      20   0  166468  48488  19680 R  94.4   0.6   0:29.24 ffmpeg


    The INFO of the file:


    Again I say, I think you're expecting too much from a simple device, ;)

  • Thanks ^^

    I will change my hardware next year anyway.

  • I'd suggest reading the jellyfin documentation, it is pretty good and explains most, if not all things pretty comprehensible

    The instructions I gave in this thread are the one's recommended from jellyfin/linuxserver for the Pis.

    V4L2 is passed via the "devices" environment to the docker container.

    And, AFAIK, there's no GPU reading/showing like you see in a NVIDIA/RADEON and in Plex, for eg.


    It doesn't mean the GPU isn't beeing used, it just doesn't have a graphic statistic showing.


    anchits123

    A simple test you can try is to deactivate the Hardware Acceleration on jellyfin and see how the CPU% compares to when acceleration via V4L2 is activated.

  • You should start a transcode and check the logs in jellyfin. you Can do something like

    Code
    cat /config/log/FFmpeg.Transcode.find-our-own.log | grep "Stream map" -A2

    This will give an output of how it was transcoded, if it shows hevc or qsv or something, or whatever hwa you are using, it works.


    For me it gives out this:

    Zitat

    Stream mapping:

    Stream #0:0 (hevc) -> setparams:default

    overlay_qsv:default -> Stream #0:0 (h264_qsv)

  • I have found that while I activate hardware encoding, and run command

    Yeah, forgot the vcgencmd. Been some time since I last used it to find values (not only for the clocks but for temps, etc)

    the output is not 0, it shows full 500 MHZ being used.

    Although, it doesn't make much of a difference, CPU usage still reaches 84%.

    It is possible to push the clock a bit higher for CPU/GPU but you'll need a good cooling fan/system on the Pi.

    There are a lot on info on the NET on how to overclock safely, the Pi.


    Although the increase won't make too much of a difference.

    I gave up on using jellyfin/plex/emby, etc for those reasons: the Pi4 doesn't have what it takes for this: streaming via Internet.

    Not fair to say that it's not good, it's just limited.

    If you go for 576p or less videos, it will do it's task but higher, and it wil show fatigue.


    I prefer now to just download the file and play it on the computer when abroad.

    When at home, I use a Pi4 LibreELEC/KODi to play files from the LAN share and, with that setting, I managed to watch really HIGH BITRATE 1080p without hiccups.


    P.S.: Never cared much about stats while running. All my Pis have a cooling form, either passive or active.

  • anchits123

    If you're still around with the Pi4, see this on how to have Jellyfin via WAN with low CPU consumption:

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!