PlexPostProc icon indicating copy to clipboard operation
PlexPostProc copied to clipboard

Installing ffmpeg into Plex docker container

Open corzocone opened this issue 1 year ago • 16 comments

Hello, can you please provide instructions on how to install ffmpeg inside a plex docker container? I haven't been able to figure this out on my own. Thanks in advance.

corzocone avatar Apr 28 '23 17:04 corzocone

Here is what I did:

Adding the latest FFMPEG to the container directly, by entering the container:

sudo docker exec -it plex /bin/bash

Then inside the container:

apt update && apt install -y software-properties-common
apt install ffmpeg
exit 

nebhead avatar Apr 28 '23 17:04 nebhead

Thanks!

corzocone avatar Apr 28 '23 18:04 corzocone

Will this automatically include x265? I'm getting following error in plex logs

[Grabber/97b4b22ce3be0bda0c47b219b640e547403d6a4f] Recorder: Postprocessing script '/config/Library/Application Support/Plex Media Server/Scripts/PlexPostProc.sh' exited with error code 2.

corzocone avatar Apr 28 '23 21:04 corzocone

Check your host systems /tmp folder for the log file: /tmp/plex_DVR_post_processing_log

That should give you some more clues of what happened.

As far as x265, you should be able to check the ffmpeg you installed in the container, by entering the container:

sudo docker exec -it plex /bin/bash

Then checking ffmpeg encoders:

ffmpeg -encoders

Or pipe that into a grep command to look for 265.

ffmpeg -encoders | grep 265 

Example:

root@wellington:/# ffmpeg -encoders | grep 265
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
 V..... libx265              libx265 H.265 / HEVC (codec hevc)
 V..... hevc_vaapi           H.265/HEVC (VAAPI) (codec hevc)

nebhead avatar Apr 28 '23 22:04 nebhead

I can't seem to find that log. I have Plex running inside a docker, does that make any difference as to where this log would be? I'm wondering if it might be a permissions issue. Does the script use folders that I need to map in my container?

I do have x265 working, thanks.

Thanks for your help with this.

corzocone avatar Apr 28 '23 22:04 corzocone

Oh sorry! Yes, it should be in the container in your case. So again, enter the container, then cd /tmp. Then you should see plex_DVR_post_processing_log in the directory listing. You can use 'cat plex_DVR_post_processing_log` to view the log. Hopefully that helps!

nebhead avatar Apr 29 '23 04:04 nebhead

Hello, sorry for the delay. I'm not seeing that log following your directions. See below:

`root@openmediavault:~# sudo docker exec -it Plex /bin/bash

root@openmediavault:/# cd /tmp root@openmediavault:/tmp# list bash: list: command not found root@openmediavault:/tmp# ls pms-156c9b3f-9ed7-4e8d-8c79-1f4794df6d56 root@openmediavault:/tmp# cat plex_DVR_post_processing_log cat: plex_DVR_post_processing_log: No such file or directory`

corzocone avatar May 02 '23 16:05 corzocone

Hello, sorry for the delay. I'm not seeing that log following your directions. See below:

`root@openmediavault:~# sudo docker exec -it Plex /bin/bash

root@openmediavault:/# cd /tmp root@openmediavault:/tmp# list bash: list: command not found root@openmediavault:/tmp# ls pms-156c9b3f-9ed7-4e8d-8c79-1f4794df6d56 root@openmediavault:/tmp# cat plex_DVR_post_processing_log cat: plex_DVR_post_processing_log: No such file or directory`

Hmm... Have you rebooted or anything since you ran the PlexPostProc script? It's possible that the /tmp/ folder got flushed by the container during a reboot or restart of the container.

nebhead avatar May 02 '23 18:05 nebhead

Possibly, but I tried recording something new to trigger it again, and still nothing.

I'm having other issues with my Plex install, as well though. EasyAudioEncoder (EAE) is not working, so transcodes are hanging. Not sure if related at all. Plex just updated the other day, so I'm wondering if something broke then. I'll have to dig into =it when I have more time.

Thanks again!

corzocone avatar May 02 '23 19:05 corzocone

Hi, I seem to have the EAE problem fixed.

I still cannot access the log files using your instructions above. Is it possibly because I've set my Plex Transcoder temporary directory to /tmpfs-host to use a ramdisk? Could that also be causing the script to fail?

corzocone avatar May 04 '23 05:05 corzocone

@nebhead following up on my last post. I sure would like to get the script running! Thank you.

corzocone avatar May 15 '23 19:05 corzocone

@nebhead following up on my last post. I sure would like to get the script running! Thank you.

Oh sorry, I thought you had gotten this to work already. Were you still stuck or just needing to find where the logs are?

I do believe the logs should be in the container, but if you changed the /tmp location, then check where you moved the /tmp folder.

nebhead avatar May 15 '23 19:05 nebhead

Everything is working fine after following @nebhead instructions to install ffmpeg into plex container but everytime watchtower updates plex, I have to manualy reinstall ffmpeg. Anyone got a workaround?

emptywill avatar Jun 01 '23 00:06 emptywill

Everything is working fine after following @nebhead instructions to install ffmpeg into plex container but everytime watchtower updates plex, I have to manualy reinstall ffmpeg. Anyone got a workaround?

The only think I could think of is to add a command via docker/portainer so that it auto-installs every time the container is updated/rebuilt. I'm not too sure how to do this, though.

corzocone avatar Jun 01 '23 21:06 corzocone

If you are using the official Plex container, I think it should only require a reboot/restart of the container to do an update. No need to recreate the container for an update. This should preserve the FFMPEG installation. Can watchtower simply do a restart of the container when an update is available?

nebhead avatar Jun 01 '23 22:06 nebhead

Hi @nebhead

Gave up on this last year, but coming back for another try.

My best guess for the reason the script isn't working is due to some permissions issue. Can you think of any specific files/folders I should be looking at?

I'm running Plex inside a docker under openmediavault, which is debian-based. I have a user "dockeruser" that owns all containers. I SSH'd into the server to place the script file into the plex config folder.

I still haven't been able to find plex_DVR_post_processing_log

Thanks again. Really hoping I can get this working (one day).

corzocone avatar Apr 12 '24 01:04 corzocone