Run FFMPEG in separate Docker container?

Version 1.40.1.8120

I’m kinda stumped. I’ve gotten a post processing script working to run ffmpeg when installed in the same docker container as Plex. Rather than manually installing ffmpeg everytime I update the container, I wanted to try to use a post processing script that calls ffmpeg in a separate container. Should be doable, right?

I’ve spent days on this and still can’t seem to crack the code. The script below runs when I pass a file to it, simulating how Plex would run it. When I try using it from the post-processing script window, it fails after 0.1 seconds and claims success according to the server long.

I saw a reference to a post 3 year ago about adding a >2 somewhere to get more logs, but I don’t know where that would need to be added.

Any thoughts on how to fix? I’ve tried all the usual stuff - chmod, script is in the right spot, etc.

#!/bin/bash

# The input file passed by Plex
INPUT_FILE=$1

# The output file
OUTPUT_FILE="${INPUT_FILE%.*}.mkv"

# The Docker image for ffmpeg
DOCKER_IMAGE="jrottenberg/ffmpeg:4.1-nvidia"

# Run ffmpeg in a Docker container
docker run --rm --gpus all -v "$(dirname "$INPUT_FILE")":/temp -w /temp $DOCKER_IMAGE -i "$INPUT_FILE" -c:v hevc_nvenc -preset slow -crf 24 -c:a copy "$OUTPUT_FILE"

# Check if the conversion was successful
if [ $? -eq 0 ]; then
    # If the conversion was successful, delete the input file
    rm "$INPUT_FILE"
else
    echo "The conversion failed. The input file was not deleted."
fi

Duh. There’s no docker in the plex docker container. Time to try a different approach.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.