wnielson / Plex-Remote-Transcoder

A distributed transcoding backend for Plex
MIT License
640 stars 59 forks source link

Remote Transcoder has errors trying to play a file on remote server, works fine with local transcoder as a target #42

Open alexholliz opened 7 years ago

alexholliz commented 7 years ago

I've attached the logs I pulled from plex when attempting to play a file that requires transcoding with a remote transcoder. This works fine on the local transcoder, (adding localhost with prt add_host) so it must be a missing dependency on my ubuntu server or something. plex failed transcode.txt

wnielson commented 7 years ago

This looks like a cross-platform issue. The server on OS X is passing environmental variables to the Ubuntu machine that are incorrect for that platform.

From your logs:

Sep 06, 2016 01:46:51.315   DEBUG   Job running: FFMPEG_EXTERNAL_LIBS='/Users/Alex/Library/Application\ Support/Plex\ Media\ Server/Codecs/6209f91-1114-darwin-x86_64/' XDG_CACHE_HOME='/Users/Alex/Library/Caches/PlexMediaServer/' XDG_DATA_HOME='/Applications/Plex Media Server.app/Contents/Resources/' X_PLEX_TOKEN='xxxxxxxxxxxxxxxxxxxx' '/Applications/Plex Media Server.app/Contents/MacOS/Plex Transcoder' '-codec:0' 'mpeg4' '-codec:#0x01' 'mp3_at' '-i' '/Volumes/Shares/Media/Videos/TV Shows/America\'s Test Kitchen/Season 9/America\'s Test Kitchen - S09E09 - Bringing Home Italian Favorites.avi' '-filter_complex' '[0:0]scale=w=min(720\,iw):h=min(480\,ih):force_original_aspect_ratio=decrease[0]' '-map' '[0]' '-codec:0' 'libx264' '-crf:0' '16' '-pix_fmt:0' 'yuv420p' '-maxrate:0' '2250k' '-bufsize:0' '4500k' '-r:0' '29.969999999999999' '-preset:0' 'veryfast' '-x264opts:0' 'subme=2:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none' '-force_key_frames:0' 'expr:gte(t,0+n_forced*7)' '-map' '0:#0x01' '-codec:1' 'aac_at' '-ar:1' '48000' '-channel_layout:1' 'stereo' '-b:1' '256k' '-f' 'dash' '-use_timeline' '0' '-min_seg_duration' '7000000' '-skip_to_segment' '1' '-time_delta' '0.0625' '-avoid_negative_ts' 'disabled' '-map_metadata' '-1' '-map_chapters' '-1' '-movflags' '+faststart' 'dash' '-start_at_zero' '-copyts' '-vsync' 'cfr' '-y' '-nostats' '-loglevel' 'quiet' '-loglevel_plex' 'error' '-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/pb2mcpr7yde/progress'

You can see the paths for FFMPEG_EXTERNAL_LIBS, XDG_CACHE_HOME, XDG_DATA_HOME, etc. are all wrong. We currently don't have a mechanism to translate paths from one platform to another, so this is something that we'll have to look into.

alexholliz commented 7 years ago

Of course! Duh. So right now your Master and Slave both need to be the same platform, or at the very least have the same paths to the external libraries. Is that right?

wnielson commented 7 years ago

@alexholliz For now, yes, master and slave need to be the same platform. Obviously we'd love to get this working between machines running on different platforms. If you look at the prt.log on the slave machine, you should see some information about the command that is used to launch the transcoder. If you're feeling up to it, you can patch PRT on the Ubuntu machine to remap the paths since most paths should be constants for the given platform (with the media path being the main exception).

To help get started, I just created a wiki page here with the paths used on various platforms.

alexholliz commented 7 years ago

I'll give that a go and report back

wnielson commented 7 years ago

@alexholliz Great! Also, feel free to update the wiki page with the paths that you're seeing on OS X. I've added the ones that I could get from the log file that you posted earlier.

alexholliz commented 7 years ago

I was actually pretty confused on how to statically set the FFMPEG libraries on the ubuntu machine, any idea where I should look for that?

wnielson commented 7 years ago

The paths are set as environmental variables. The best place to go about remapping these is in the build_env method. What I would do is loop over items in os.environ, look for variables that need to be remapped (such as FFMPEG_EXTERNAL_LIBS) and remap them.

alexholliz commented 7 years ago

I also noticed that I don't have a prt.log on my ubuntu machine. Is there somewhere I should look for that specifically? mlocate couldn't find it.

wnielson commented 7 years ago

Should be set to /tmp/prt.log by default.