Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Path to FFMPEG No Longer Updatable in 10.8.13 #899

Closed
1 task done
a-priestley opened this issue May 16, 2024 · 21 comments
Closed
1 task done

[BUG] Path to FFMPEG No Longer Updatable in 10.8.13 #899

a-priestley opened this issue May 16, 2024 · 21 comments

Comments

@a-priestley
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Name of mod

jellyfin-rffmpeg

Name of base container

jellyfin

Current Behavior

As of 10.8.13, this mod is no longer usable due to the inability for users to manually set the path to the ffmpeg binary.

See here

Expected Behavior

The way by which the mod operates may have to change. Setting the value in encoding.xml followed by a restart does not seem to work either. Possibly due to:

Note too that the --ffmpeg flag may or may not change this for you, depending on what version you originally installed; while you should change it to match, you may still need to update the XML file as well.

Note that in the run script of docker-jellyfin, the flag mentioned above is hard coded, possibly overwriting the value entered into the .xml:

#!/usr/bin/with-contenv bash
# shellcheck shell=bash

export \
    JELLYFIN_DATA_DIR="/config/data" \
    JELLYFIN_CONFIG_DIR="/config" \
    JELLYFIN_LOG_DIR="/config/log" \
    JELLYFIN_CACHE_DIR="/config/cache" \
    JELLYFIN_WEB_DIR="/usr/share/jellyfin/web"

exec \
    s6-notifyoncheck -d -n 300 -w 1000 \
        s6-setuidgid abc /usr/bin/jellyfin \
        --ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg

Steps To Reproduce

  1. Running with the following docker-compose.yml service:
services:
  jellyfin:
    image: lscr.io/linuxserver/jellyfin:arm64v8-10.8.13
    network_mode: host
    container_name: jellyfin
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - JELLYFIN_PublishedServerUrl=192.168.0.120
      - DOCKER_MODS=linuxserver/mods:jellyfin-rffmpeg
      - RFFMPEG_USER=jellyfin
      - RFFMPEG_HOST=100.64.0.1
      - RFFMPEG_HOST_MAC="50:eb:f6:7d:e9:f7"
      - RFFMPEG_WOL=native
      - FFMPEGDIR=/usr/local/bin/wol_rffmpeg/ffmpeg
      - WOL_NATIVE_HOST=192.168.2.101
      - WOL_NATIVE_PORT=9999
      - WOL_WAIT=10
    volumes:
      - ${PATH_TO_CONFIG}/jellyfin:/config
      - /shares/docker-data/jellyfin/data/subtitles:/config/data/data/subtitles
      - /shares/docker-data/jellyfin/transcodes:/config/data/transcodes
      - /shares/media:/data
    restart:
      unless-stopped
  1. Login as administrator
  2. Navigate to dashboard > playback > transcoding
  3. The FFmpeg path is no longer an editable field
  4. Note that the following fields in /config/encoding.xml are already set:
...
  <EncoderAppPath>/usr/local/bin/wol_rffmpeg/ffmpeg</EncoderAppPath>
  <EncoderAppPathDisplay>/usr/lib/jellyfin-ffmpeg/ffmpeg</EncoderAppPathDisplay>
...
  1. Restart the service. Observe that the specified path is still not used, and jellyfin uses the default binary to transcode media.

Environment

- OS: Alpine Raspberry PI
- How docker service was installed: `docker-compose` installed via `apk`

CPU architecture

arm64

Docker creation

See above.

Container logs

...
[custom-init] No custom files found, skipping...
[21:49:44] [INF] [1] Main: Jellyfin version: 10.9.1
[21:49:44] [INF] [1] Main: Environment Variables: ["[JELLYFIN_WEB_DIR, /usr/share/jellyfin/web]", "[JELLYFIN_DATA_DIR, /config/data]", "[JELLYFIN_LOG_DIR, /config/log]", "[JELLYFIN_PublishedServerUrl, 192.168.0.120]", "[JELLYFIN_CACHE_DIR, /config/cache]", "[JELLYFIN_CONFIG_DIR, /config]"]
[21:49:44] [INF] [1] Main: Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll", "--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg"]
[21:49:44] [INF] [1] Main: Operating system: Ubuntu 22.04.4 LTS
[21:49:44] [INF] [1] Main: Architecture: Arm64
[21:49:44] [INF] [1] Main: 64-Bit Process: True
[21:49:44] [INF] [1] Main: User Interactive: True
[21:49:44] [INF] [1] Main: Processor count: 4
[21:49:44] [INF] [1] Main: Program data path: /config/data
[21:49:44] [INF] [1] Main: Log directory path: /config/log
[21:49:44] [INF] [1] Main: Config directory path: /config
[21:49:44] [INF] [1] Main: Cache path: /config/cache
[21:49:44] [INF] [1] Main: Web resources path: /usr/share/jellyfin/web
[21:49:44] [INF] [1] Main: Application directory: /usr/lib/jellyfin/bin/
...
[21:50:06] [INF] [1] [21:50:05] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available filters: ["overlay_opencl", "overlay_rkrga", "scale_opencl", "scale_rkrga", "tonemap_opencl", "vpp_rkrga", "zscale", "alphasrc"]
[21:50:05] [WRN] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Filter: scale_cuda with option Output format (default "same") is not available
[21:50:05] [WRN] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Filter: tonemap_cuda with option GPU accelerated HDR to SDR tonemapping is not available
[21:50:06] [WRN] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Filter: overlay_vaapi with option Action to take when encountering EOF from secondary input is not available
[21:50:06] [WRN] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Filter: overlay_vulkan with option Action to take when encountering EOF from secondary input is not available
[21:50:06] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Available hwaccel types: ["drm", "opencl", "rkmpp"]
[21:50:06] [INF] [1] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: FFmpeg: /usr/lib/jellyfin-ffmpeg/ffmpeg
...
@aptalca
Copy link
Member

aptalca commented May 16, 2024

@junkman690

@junkman690
Copy link

junkman690 commented May 17, 2024

Jellyfin not picking up the path correctly from the xml seems like a Jellyfin bug which has popped up across RPM and Free-BSD builds, however its been completely removed in 10.9 https://jellyfin.org/posts/jellyfin-release-10.9.0#transcoding--ffmpeg. Agree the mod will need to change from relying on end user changes to setting the --ffmpeg flag from an environment variable. I have changed my setup since creating this mod and no longer actively use it. I will see if I can find some time to update but happy for someone else to take that on in the meantime.

@a-priestley
Copy link
Author

I can make the needed changes. Are there any good examples for altering the run script? My initial thought is to edit the --ffmpeg flag based on environment variables. Default to /usr/local/bin/rffmpeg. If wol is needed you can assign the variable to change.

@a-priestley
Copy link
Author

I've added the svc directory with the following script with chmod +x:

#!/usr/bin/with-contenv bash
# shellcheck shell=bash

export \
    JELLYFIN_DATA_DIR="/config/data" \
    JELLYFIN_CONFIG_DIR="/config" \
    JELLYFIN_LOG_DIR="/config/log" \
    JELLYFIN_CACHE_DIR="/config/cache" \
    JELLYFIN_WEB_DIR="/usr/share/jellyfin/web"

exec \
    s6-notifyoncheck -d -n 300 -w 1000 \
        s6-setuidgid abc /usr/bin/jellyfin \
        --ffmpeg=/usr/local/bin/rffmpeg/wol_rffmpeg/ffmpeg

I've hard coded the flag here to test on my environment with the type file containing "longrun", but it hasn't worked. I still see the default path in my jellyfin logs.

Is the svc script supposed to overwrite the main jellyfin run script, or does anything additional need to be done?

@thespad
Copy link
Member

thespad commented May 18, 2024

If you want a mod to overwrite the built-in init files you need to place them in exactly the same locations so that when the mod is unpacked it replaced them.

@a-priestley
Copy link
Author

If you want a mod to overwrite the built-in init files you need to place them in exactly the same locations so that when the mod is unpacked it replaced them.

Thank you! Working now.

I suppose I can import FFMPEGDIR into this script so that it can be manually set. At the same time, it might be better to remove the flag entirely from the main linuxserver/jellyfin container? I think this variable is supposed to set the path in the official release, and the flag is overwritting it.

@thespad
Copy link
Member

thespad commented May 18, 2024

According to the 10.9 release notes

The --ffmpeg command-line flag is now the primary method of setting FFmpeg paths, and configuration of the FFmpeg paths via encoding.xml is now deprecated. All official packaging will revert to defaults unless explicitly set before upgrade.

@a-priestley
Copy link
Author

Do docker env vars get imported into the run script by default? Can't seem to get mine to take:

#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [ -z "$RFFMPEG_PATH" ]
then
    RFFMPEG_PATH=/usr/local/bin/ffmpeg
fi

export \
    JELLYFIN_DATA_DIR="/config/data" \
    JELLYFIN_CONFIG_DIR="/config" \
    JELLYFIN_LOG_DIR="/config/log" \
    JELLYFIN_CACHE_DIR="/config/cache" \
    JELLYFIN_WEB_DIR="/usr/share/jellyfin/web"

exec \
    s6-notifyoncheck -d -n 300 -w 1000 \
        s6-setuidgid abc /usr/bin/jellyfin \
        --ffmpeg="$RFFMPEG_PATH"

By the way this is my first time editing one of these. If there's a better way, let me know.

@a-priestley
Copy link
Author

Disregard the bit about the variable. I must have forgotten to write after editing my yaml.

Second question still valid! :)

@aptalca
Copy link
Member

aptalca commented May 18, 2024

Maybe we should add that var to the jellyfin image as an unlisted one and this mod can just set it. No need to override the whole service file

@thespad
Copy link
Member

thespad commented May 18, 2024

If we're going to do that we probably also want to add an -f check for the supplied path to make sure they're pointing to a file that actually exists.

And it'll need to be documented by the mod because there are two different RFFMPEG binaries to pick from.

@a-priestley
Copy link
Author

a-priestley commented May 18, 2024

Maybe we should add that var to the jellyfin image as an unlisted one and this mod can just set it. No need to override the whole service file

I agree with this. The readme for this mod will need to be updated to reflect it as well.

If we're going to do that we probably also want to add an -f check for the supplied path to make sure they're pointing to a file that actually exists.

And it'll need to be documented by the mod because there are two different RFFMPEG binaries to pick from.

This also makes sense. Like this:

#!/usr/bin/with-contenv bash
# shellcheck shell=bash

if [[ -z "$FFMPEG_PATH" || ! -f "$FFMPEG_PATH" ]]
then
    FFMPEG_PATH=/usr/lib/jellyfin-ffmpeg/ffmpeg
fi

export \
    JELLYFIN_DATA_DIR="/config/data" \
    JELLYFIN_CONFIG_DIR="/config" \
    JELLYFIN_LOG_DIR="/config/log" \
    JELLYFIN_CACHE_DIR="/config/cache" \
    JELLYFIN_WEB_DIR="/usr/share/jellyfin/web"

exec \
    s6-notifyoncheck -d -n 300 -w 1000 \
        s6-setuidgid abc /usr/bin/jellyfin \
        --ffmpeg="$FFMPEG_PATH"

This would be for the main jellyfin image, and the mod readme would simply need to be updated to reflect this, with the two options available.

@thespad
Copy link
Member

thespad commented May 18, 2024

Happy side effect from linuxserver/docker-jellyfin#248 and linuxserver/docker-jellyfin#249 is that I realised we never added the proper health endpoint check to the nightly branch.

@a-priestley
Copy link
Author

a-priestley commented May 18, 2024

#900 @thespad imo this shouldn't be completed before yours are, but the mod doesn't currently work right now anyway.

@junkman690
Copy link

I was thinking on this last night, only the wol path needs to be configured and adding an additional check that if the wol env var isn't set to native or API it just kicks off rffmpeg. Readme would still need to be updated to reflect as well.

@a-priestley
Copy link
Author

I think users would still want the option of providing a custom path even if they were using the mod for flexibility reasons.
Maybe we could check the var and set it to normal rffmpeg if not set?

@junkman690
Copy link

Agree ability to set a custom is good, but looks like that's being added to the main container. The wol version is only a minor shell script, and might make it easier to use only having it specified rather than giving two different possible paths in the readme.

My original thought was to just sed the run script to change the -ffmpeg flag but giving it as an option in the main container give more flexibility.

@junkman690
Copy link

Actually, re-reading the wol script it already accommodates just running rffmpeg if API or native isn't set.

@thespad
Copy link
Member

thespad commented May 18, 2024

Both Jellyfin branch PRs have merged now, providing the option of passing a FFMPEG_PATH to the service. In your case probably via the mod.

@thespad
Copy link
Member

thespad commented May 18, 2024

Just be wary of anyone still running old versions who will still be pulling the mod and try not to break things for them.

@thespad
Copy link
Member

thespad commented May 20, 2024

This should now be resolved by #901

@thespad thespad closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants