Closed tykisson closed 6 years ago
I'm getting the exact same issue!
have you chmod 777 the folder?
Yes, I have, but the DVR recordings that are being created by Plex are not getting the correct permissions for the script to run them.
can you add this to the top of your script and post the output? You may need to change the location of where the log file saves.
logfile=/usr/home/plex/bin/log.out
exec > $logfile 2>&1
and then manually run the command as the plex user?
switch from login user using su plex
also as plex user can you run ls -la <directory>
and post the output so the permissions can be checked?
Ok, so when the script is run manually it appears to work - I get " success", but the resulting mkv file doesn't actually work - VLC and Plex both refuse to open it. (VLC says: "Your input can't be opened: VLC is unable to open the MRL 'file:///home/andrew/Videos/Plex/Movies/Hancock%20%281970%29/Hancock%20%281970%29.mkv'. Check the log for details.)
The permissions in the folder that movies are going into look like this (Hancock is the offair recording that I'm trying to convert here for an example: drwxrwxrwx 5 andrew multimedia 4096 May 19 22:43 . drwxrwxrwx 5 andrew andrew 4096 May 15 22:31 .. -rwxrwxrwx 1 andrew multimedia 376394340 Apr 12 03:45 'Dracula (1931).mp4' drwxrwxrwx 2 andrew multimedia 4096 May 19 22:43 .grab drwxr-xr-x 2 plex plex 4096 May 19 22:43 'Hancock (2008)'
Are you using the handbrake or ffmpeg branch?
The ffmpeg one.
dumb question... i'm trying to rule things out. Can you play in vlc before converting it?
No, not a dumb question. I just recorded another test recording, and no, I can't! The Mpeg2 seems to be something VLC doesn't like. Plex will open it though.
Interestingly/confusingly, when I run the script manually on this new recording the conversion fails:
sudo su plex '/home/andrew/PlexPostProc/PlexPostProc.sh' '/home/andrew/Videos/Plex/TV Shows/ABC News/Season 2018/ABC News - 2018-05-19 23 00 00 - Episode 05-19.ts' /home/andrew/PlexPostProc/PlexPostProc.sh: line 40: /home/andrew: Is a directory
Starting Transcoding: Converting to H.264 w/ffmpeg @720p
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu2) configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 [mp3 @ 0x555fa7ac9220] Header missing Input #0, mpegts, from '/home/andrew/Videos/Plex/TV Shows/ABC News/Season 2018/ABC News - 2018-05-19 23 00 00 - Episode 05-19.ts': Duration: 00:00:39.56, start: 1.400000, bitrate: 6881 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1024x576 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:10x101: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s Stream #0:20x102: Subtitle: dvb_teletext ([6][0][0][0] / 0x0006) Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (dvb_teletext (libzvbi_teletextdec) -> ass (ssa)) Press [q] to stop, [?] for help [ssa @ 0x555fa7acb740] Only SUBTITLE_ASS type supported. Subtitle encoding failed Conversion failed! ERROR # 1 : Failed to convert using ffmepg"
Could you attempt to run it on a file that's not a recording?
also would it be possible for you to add this to the top of the script? This echos out all of the execution helps let me see everything it's trying to do/or not do. please do this for the ABC recoding that failed
you may need to change the file directory.
logfile=/usr/home/plex/bin/log.out
exec > $logfile 2>&1
Just out of curiosity what OS are you running?
ubuntu 18.04. Will have a go at that now.
Just ran it on an mp4 that wasn't recorded through plex's dvr. I'm getting the same problem, neither VLC or Plex can open the converted file. (Plex gives an Error code: s1001 (Network))
Not sure if this helps but my script is running as root:root (not part of the plex group or even my own user group).
interesting... shouldn't matter as long as the final file has the correct permissions. - rw -rw -rw
long shot but there was a another issue that i helped with debugging for this script and you needed to call the full path of ffmpeg to get it to run properly. new line would be
/usr/local/bin/ffmpeg -i "$FILENAME" -s hd720 -c:v libx264 -preset veryfast -vf yadif -c:a copy "$TEMPFILENAME"
Here's the log output for a failed transcode:
Starting Transcoding: Converting to H.264 w/ffmpeg @720p
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu2) configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 [mp3 @ 0x55b58b6dd220] Header missing Input #0, mpegts, from '/home/andrew/Videos/Plex/TV Shows/ABC News/Season 2018/ABC News - 2018-05-19 23 00 00 - Episode 05-19.ts': Duration: 00:00:39.56, start: 1.400000, bitrate: 6881 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1024x576 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:10x101: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s Stream #0:20x102: Subtitle: dvb_teletext ([6][0][0][0] / 0x0006) Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:1 -> #0:1 (copy) Stream #0:2 -> #0:2 (dvb_teletext (libzvbi_teletextdec) -> ass (ssa)) Press [q] to stop, [?] for help [ssa @ 0x55b58b6df740] Only SUBTITLE_ASS type supported. Subtitle encoding failed Conversion failed! ERROR # 1 : Failed to convert using ffmepg
I think this may have your answer. It looks like it's failing with the subtitle transcode. I assume they can be ignored
https://stackoverflow.com/questions/12131789/how-to-disable-subtitles-decoding-in-ffmpeg
Putting the full path in seems to help, but I'm still running into a wall with this subtitle problem. I'm not up on the usage for ffmpeg - would you be able to help me parse what they're saying to do at that link you posted calederer?
I would try this:
/usr/local/bin/ffmpeg -i "$FILENAME" -s hd720 -c:v libx264 -preset veryfast -vf yadif -c:a copy -map 0:0 -map 0:1 "$TEMPFILENAME"
Thanks. Ok, I've tried that.
Plex will open the resulting file, but VLC cannot. Also, the script fails to auto run in plex after recording finishes everytime, its only running manually.
getting closer then... what directory do you have the script located in? Can you export the log from plex when it tries to run the script? https://support.plex.tv/articles/200250417-plex-media-server-log-files/
The script is just sitting in my user's home directory (/home/andrew/PlexPostProc/PlexPostProc.sh) Here's an excerpt from one of the many many logs plex has kindly made. I hope its relevant, I found this part was referencing the script and the latest record I had tested.
May 20, 2018 01:02:01.449 [0x7ff209ffe700] DEBUG - Completed: [127.0.0.1:47902] 200 GET /media/subscriptions/scheduled (7 live) GZIP 12ms 3379 bytes (pipelined: 4)
May 20, 2018 01:02:03.239 [0x7ff2073ff700] DEBUG - Jobs: '/home/andrew/PlexPostProc/PlexPostProc.sh' exit code for process 29421 is 1 (failure)
May 20, 2018 01:02:03.240 [0x7ff1ed3fc700] ERROR - DVR:Recorder: Postprocessing script '/home/andrew/PlexPostProc/PlexPostProc.sh' exited with error code 1.
May 20, 2018 01:02:03.240 [0x7ff1ed3fc700] DEBUG - DVR:Grabber: Scheduling 'rage: Guest Programmer - Courtney Barnett' for assimilation.
May 20, 2018 01:02:03.247 [0x7ff1f1bfd700] DEBUG - DVR:Subscription: Failed to resolve subscription for episode 'grandparentGuid: com.gracenote.eyeq://show/rage%3A%20Guest%20Programmer grandparentTitle: rage: Guest Programmer guid: com.gracenote.eyeq://episode/rage%3A%20Guest%20Programmer/2018-05-19 23:48:00 originallyAvailableAt: 2018-05-19 parentIndex: 2018 title: Courtney Barnett type: 4' to library item
May 20, 2018 01:02:03.248 [0x7ff1f1bfd700] DEBUG - DVR:Grabber: Postprocessing, we're going to put rage: Guest Programmer - Courtney Barnett
in /home/andrew/Videos/Plex/TV Shows/rage Guest Programmer/Season 2018/rage Guest Programmer - 2018-05-19 23 48 00 - Courtney Barnett.ts
May 20, 2018 01:02:03.248 [0x7ff1f1bfd700] DEBUG - DVR:Grabber: Moving "/home/andrew/Videos/Plex/TV Shows/.grab/28cdafb6b5e8a661d4b28be4b93bd47ff521ee6f/rage Guest Programmer - 2018-05-19 23 48 00 - Courtney Barnett.ts" to "/home/andrew/Videos/Plex/TV Shows/rage Guest Programmer/Season 2018/rage Guest Programmer - 2018-05-19 23 48 00 - Courtney Barnett.ts"
May 20, 2018 01:02:03.253 [0x7ff1f1bfd700] DEBUG - DVR:Subscription: Failed to resolve subscription for episode 'grandparentGuid: com.gracenote.eyeq://show/rage%3A%20Guest%20Programmer grandparentTitle: rage: Guest Programmer guid: com.gracenote.eyeq://episode/rage%3A%20Guest%20Programmer/2018-05-19 23:48:00 originallyAvailableAt: 2018-05-19 parentIndex: 2018 title: Courtney Barnett type: 4' to library item
May 20, 2018 01:02:03.258 [0x7ff1f1bfd700] DEBUG - Added new metadata item (rage: Guest Programmer) with ID 16542
May 20, 2018 01:02:03.258 [0x7ff1f1bfd700] DEBUG - Doing expensive tags write for 'rage: Guest Programmer' because something changed.
May 20, 2018 01:02:03.286 [0x7ff1ed3fc700] DEBUG - HubCache: Expiring '1/home.ondeck/hubs/12/en' because of event plex.event.item.created.
May 20, 2018 01:02:03.286 [0x7ff1ed3fc700] DEBUG - HubCache: Expiring '1/home.television.recent/hubs/12/en' because of event plex.event.item.created.
May 20, 2018 01:02:03.292 [0x7ff20a7ff700] DEBUG - Auth: authenticated user 1 as ajcrow
May 20, 2018 01:02:03.292 [0x7ff1f77ff700] DEBUG - Request: [127.0.0.1:47902 (Loopback)] GET /library/sections/1/all?type=2&includeCollections=1 (7 live) Page 0--1 GZIP Signed-in Token (ajcrow)
May 20, 2018 01:02:03.293 [0x7ff1f77ff700] DEBUG - Setting container serialization range to [0, -1] (total=-1)
May 20, 2018 01:02:03.295 [0x7ff209ffe700] DEBUG - Auth: authenticated user 1 as ajcrow
May 20, 2018 01:02:03.295 [0x7ff1e2bfe700] DEBUG - Request: [127.0.0.1:47896 (Loopback)] GET /library/sections/1/firstCharacter?type=2&includeCollections=1 (6 live) GZIP Signed-in Token (ajcrow)
May 20, 2018 01:02:03.307 [0x7ff1f1bfd700] DEBUG - Doing expensive tags write for 'rage: Guest Programmer' because something changed.
May 20, 2018 01:02:03.309 [0x7ff1f1bfd700] DEBUG - Updating metadata item (save) (rage: Guest Programmer) with ID 16542
May 20, 2018 01:02:03.311 [0x7ff1f1bfd700] DEBUG - Added new metadata item () with ID 16543
May 20, 2018 01:02:03.311 [0x7ff1f1bfd700] DEBUG - Updating metadata item (save) () with ID 16543
May 20, 2018 01:02:03.343 [0x7ff1f1bfd700] DEBUG - Added new metadata item (Courtney Barnett) with ID 16544
May 20, 2018 01:02:03.344 [0x7ff1f1bfd700] DEBUG - Doing expensive tags write for 'Courtney Barnett' because something changed.
May 20, 2018 01:02:03.349 [0x7ff1f1bfd700] DEBUG - Updating metadata item (save) (Courtney Barnett) with ID 16544
May 20, 2018 01:02:03.364 [0x7ff209ffe700] DEBUG - Completed: [127.0.0.1:47896] 200 GET /library/sections/1/firstCharacter?type=2&includeCollections=1 (6 live) GZIP 69ms 730 bytes (pipelined: 3)
May 20, 2018 01:02:03.374 [0x7ff1f77ff700] DEBUG - Setting container serialization range to [0, -1] (total=15)
May 20, 2018 01:02:03.377 [0x7ff209ffe700] DEBUG - Completed: [127.0.0.1:47902] 200 GET /library/sections/1/all?type=2&includeCollections=1 (6 live) GZIP Page 0--1 84ms 745 bytes (pipelined: 5)
May 20, 2018 01:02:03.381 [0x7ff1edbfd700] DEBUG - Media Analyzer: Performing on-the-fly analysis on 1 item.
May 20, 2018 01:02:03.382 [0x7ff1edbfd700] DEBUG - Job running: '/usr/lib/plexmediaserver/Plex Media Scanner' '--analyze' '--log-file-suffix' ' Analysis' '--item' '16544'
May 20, 2018 01:02:03.386 [0x7ff1edbfd700] DEBUG - Jobs: Starting child process with pid 29426
May 20, 2018 01:02:04.397 [0x7ff20a7ff700] DEBUG - Auth: authenticated user 1 as ajcrow
So i think i had this problem too at one point. I believe its and combination of Bash, the shebang at the top of the script, and the location of the file. I am by no means an expert on any of this but here's my thoughts
execute echo &PATH
you'll get something like /usr/local/bin:/usr/bin:/bin:/usr/sbin:/
copy the script to one of these directories and chmod 777
remap plex to that location
if that doesn't work you may what to change the shebang at the top of the script to #!/bin/bash or #!usr/bin/bash.
if you change the shebang manually run it to make sure it works correctly before trying it thru plex.
I know i made some tweaks to the script to get it to run on ubuntu but i won't have access to my home network for a month to able to see what i did.
Ok, I moved the script to /usr/local/sbin, chmoded it, and tried changing the top of the script to say #!usr/bin/bash, but that just gives me: '/usr/local/sbin/PlexPostProc.sh' '/home/andrew/Videos/Plex/TV Shows/Insight/Season 2018/Insight - 2018-05-20 12 00 00 - Weddings Dollars & Dowries.ts' bash: /usr/local/sbin/PlexPostProc.sh: /usr/bin/bash: bad interpreter: No such file or directory
I changed it back to saying #!/bin/bash like it did originally and that lets the script run manually, but the automatic transcodes by plex are still failing.
So i'm out of ideas a this point. Again i suggest having a log file created for debugging using
logfile=/usr/home/plex/bin/log.out
exec > $logfile 2>&1
This will tell us 2 things. No log file = Plex can't execute script and it's permissions issue Log file and plex fails = will tell us exactly where the script fails when plex executes it
Alrighty, here's what we get from that log file: **** Starting Transcoding: Converting to H.264 w/ffmpeg @720p
/usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libavformat.so.57) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libavformat.so.57) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libavformat.so.57) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libbluray.so.2) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libbluray.so.2) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/librsvg-2.so.2) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/librsvg-2.so.2) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/librsvg-2.so.2) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/librsvg-2.so.2) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16) /usr/bin/ffmpeg: /usr/lib/plexmediaserver/libxml2.so.2: no version information available (required by /usr/lib/x86_64-linux-gnu/libcroco-0.6.so.3) ERROR # 1 : Failed to convert using ffmepg
ugh. So more issue with FFMPEG. Did some searching around maybe this will shed some light https://askubuntu.com/questions/41835/libxml2-so-2-no-version-information-available
I'm going to close this as a possible FFMPEG issue. Thanks!
i'm missing something dumb here. When Plex runs the script it fails, when I run the script as my login user I get a permission denied on cleanup.
the containing folder of the .ts file is set to plex:plex and I added my login user to the plex group and still permission denied.
any help is much appreciated!