Sungray 6 Posted June 10, 2022 Share Posted June 10, 2022 (edited) I've noticed Emby uses a lot of GPU memory while transcoding. It basically prevents me to use the GPU for anything else - if I do, Emby will not be able to enable hardware transcoding due to insufficient GPU memory. Also greatly limits the number of simultaneous transcoding streams since each stream requires it's own amount of memory. I've done a little test, running the same movie on Plex and then on Emby from the same single client (chrome) and compare memory usage. I'd love to see improvements in this area, it's a big advantage for Plex in my opinion. In practice, using Plex I can usually have three simultaneous streams of 4k HEVC HDR10 video files. On Emby, only one. Edited June 10, 2022 by Sungray Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 10, 2022 Author Share Posted June 10, 2022 (edited) Here's another test. Starting three Plex streams of the same video file, and starting two Emby streams of the same video file, the second one started transcoding using CPU which is not shown here.. Edited June 10, 2022 by Sungray Link to comment Share on other sites More sharing options...
Luke 37335 Posted June 10, 2022 Share Posted June 10, 2022 Hi there, let's look at an example: Thanks. Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 10, 2022 Author Share Posted June 10, 2022 (edited) 17 minutes ago, Luke said: Hi there, let's look at an example: Thanks. Hello Luke, Thanks. Do you need a log file? I did not include one, considering everything works fine and as expected. I am not sure what you are asking, sorry about that. I think the initial post is clear, described in details and with a visual explanation of the issue. If you want me to explain in other words I will try to do so. Regardless, here's a log of the transcoding, that is the same file used for the examples above. That is just an example, the high memory usage issue exists for any transcoding, roughly twice as much as Plex. Memory used depends on the file of course, sometimes it's more, sometimes less. ffmpeg-transcode-ef1b9cd7-b001-4e55-b59f-01a73ade49f6_1.txt Edited June 10, 2022 by Sungray Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 10, 2022 Author Share Posted June 10, 2022 Here's also the full server logs.embyserver.txt Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 12, 2022 Share Posted June 12, 2022 To make this a valid comparison, we'll first need to look at what each server is doing exactly and then compare. One thing I can see is that there's a very high output bitrate set for Emby (71 MBit). Can you try to reduce this first? Also, could you please provide a log from the other software, so we can be sure that it's doing the same? Thanks Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 12, 2022 Author Share Posted June 12, 2022 54 minutes ago, softworkz said: To make this a valid comparison, we'll first need to look at what each server is doing exactly and then compare. One thing I can see is that there's a very high output bitrate set for Emby (71 MBit). Can you try to reduce this first? Also, could you please provide a log from the other software, so we can be sure that it's doing the same? Thanks Thanks softworkz. I'm not sure this will achieve what you're asking, but here's another session for the same file, with hopefully a lower output bitrate (from external network, global limit 9mbps). If not please tell me how you want the bitrate reduced. ffmpeg-transcode-ff9a9b00-85d3-4196-bf97-a3b42ebf12c8_1.txt I've tried playing with transcoder settings but the settings did not have any effect on the memory usage (H.264 encoding preset, H.264 encoding CRF). Reducing the quality during playback doesn't affect memory either.  Now for Plex, here's the transcoder log, same small memory footprint. Plex Transcoder Statistics.log Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 12, 2022 Share Posted June 12, 2022 Thanks. The Plex log is showing a different scenario. Even a different source file as it seems. But I can't see details. There must be another Pl log which shows an ffmpeg command line (just not ffmpeg.exe but something like "...transcoder.exe".) Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 12, 2022 Author Share Posted June 12, 2022 The source file is actually the same, same filename. Scenario is identical to me, just starting the same movie from chrome webui for both plex and emby, both will default to highest quality on LAN. Whatever the output bitrate is, the memory footprint doesn't change for both servers. Sorry, I cannot find  any command line related to ffmpeg or transcoder executable. Debug is enabled, only two other log files are appended during playback but nothing interesting there. Plex Transcoder Statistics.log com.plexapp.system.log 2022-06-13 00:41:23,529 (1523eef6fb38) :  DEBUG (runtime:717) - Handling request GET /system/:/prefs 2022-06-13 00:41:23,530 (1523eef6fb38) :  DEBUG (runtime:49) - Received packed state data (80 bytes) 2022-06-13 00:41:23,531 (1523eef6fb38) :  DEBUG (runtime:814) - Found route matching /system/:/prefs 2022-06-13 00:41:23,535 (1523eef6fb38) :  DEBUG (runtime:88) - Sending packed state data (99 bytes) 2022-06-13 00:41:23,535 (1523eef6fb38) :  DEBUG (runtime:924) - Response: [200] MediaContainer, 418 bytes  Plex Media Server.log Jun 13, 2022 00:40:00.788 [0x14e2e2c05b38] WARN - QueryParser: Invalid field 'sectionID' found, ignoring. Jun 13, 2022 00:40:00.788 [0x14e2e2c05b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:40:00.788 [0x14e2e2c05b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:40:00.788 [0x14e2e2a94b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:40:00.788 [0x14e2e2a94b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:40:00.789 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:40:00.789 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:40:00.813 [0x14e2e2c05b38] WARN - QueryParser: Invalid field 'sectionID' found, ignoring. Jun 13, 2022 00:40:00.813 [0x14e2e2c05b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:40:00.813 [0x14e2e2c05b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:40:32.286 [0x14e2e3330b38] WARN - [Transcode/e3d5tlhq5v4j5xmsracagje1] Transcode runner appears to have died. Jun 13, 2022 00:40:32.305 [0x14e2e2724b38] WARN - [Transcode/e3d5tlhq5v4j5xmsracagje1] Transcode runner appears to have died. Jun 13, 2022 00:41:19.563 [0x14e2e27beb38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.563 [0x14e2e27beb38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.564 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'sectionID' found, ignoring. Jun 13, 2022 00:41:19.564 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.564 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.566 [0x14e2e2a94b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.566 [0x14e2e2a94b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.589 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'sectionID' found, ignoring. Jun 13, 2022 00:41:19.589 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.589 [0x14e2e3330b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring. Jun 13, 2022 00:41:19.682 [0x14e2e261fb38] WARN - [Transcode/9li0tav6s1ws64akkcw2eeax] Transcode runner appears to have died. Jun 13, 2022 00:41:19.684 [0x14e2e2724b38] WARN - [Transcode/9li0tav6s1ws64akkcw2eeax] Transcode runner appears to have died. Jun 13, 2022 00:41:24.564 [0x14e2e2429b38] WARN - QueryParser: Invalid field 'contentDirectoryID' found, ignoring. Jun 13, 2022 00:41:24.564 [0x14e2e2429b38] WARN - QueryParser: Invalid field 'pinnedContentDirectoryID' found, ignoring.  Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 12, 2022 Share Posted June 12, 2022 I don't know how that logfile is supposed to be named, but its content should be something like this: Spoiler [Transcode] Job running: set "EAE_ROOT=\\?\C:\Users\Administrator\AppData\Local\Plex Media Server\Cache\Transcode\Sessions\EasyAudioEncoder" & set "FFMPEG_EXTERNAL_LIBS=\\\\?\\C\:\\Users\\Administrator\\AppData\\Local\\Plex\ Media\ Server\\Codecs\\367b3d4-3673-windows-x86\\" & set "X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxx" & "C:\Program Files (x86)\Plex\Plex Media Server\Plex Transcoder.exe" -codec:#0x01 hevc -hwaccel:#0x01 nvdec -hwaccel_fallback_threshold:#0x01 10 -hwaccel_device:#0x01 cuda -codec:#0x02 eac3_eae -eae_prefix:#0x02 wxv6h2h53tm1162x3w0meva8_ -analyzeduration 20000000 -probesize 20000000 -i F:\Featured\dolby-vision-art-(www.demolandia.net).mp4 -filter_complex [0:#0x01]scale=w=2276:h=1280[0];[0]format=pix_fmts=yuv420p|nv12[1] -map [1] -codec:0 h264_nvenc -b:0 33900k -maxrate:0 45200k -bufsize:0 90400k -forced-idr:0 1 -r:0 60 -force_key_frames:0 expr:gte(t,n_forced*1) -filter_complex "[0:#0x02] aresample=async=1:ocl='stereo':rematrix_maxval=0.000000dB:osr=48000[2]" -map [2] -codec:1 aac_mf -b:1 256k -f dash -seg_duration 1 -init_seg_name init-stream$RepresentationID$.m4s -media_seg_name chunk-stream$RepresentationID$-$Number%05d$.m4s -window_size 5 -delete_removed false -skip_to_segment 1 -time_delta 0.0625 -manifest_name http://127.0.0.1:32400/video/:/transcode/session/wxv6h2h53tm1162x3w0meva8/5aec73ea-e00b-4b67-834c-13c87c78d7b8/manifest?X-Plex-Http-Pipeline=infinite -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 dash -start_at_zero -copyts -vsync cfr -init_hw_device cuda=cuda: -filter_hw_device cuda -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/wxv6h2h53tm1162x3w0meva8/5aec73ea-e00b-4b67-834c-13c87c78d7b8/progress  Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 12, 2022 Share Posted June 12, 2022 (edited) Â Â The key to understand what's happening and what makes the difference is in comparing the ffmpeg commands in both cases. Edited June 13, 2022 by softworkz Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 13, 2022 Author Share Posted June 13, 2022 Okay found it, thank you. Â Spoiler Jun 13, 2022 08:22:20.912 [0x14ff17f24b38] DEBUG - Request came in with unrecognized domain / IP 'plex.example.com' in header Host; treating as non-local Jun 13, 2022 08:22:20.913 [0x14ff191a0b38] DEBUG - Request: [172.18.0.5:54690 (Allowed Network (Subnet))] GET /video/:/transcode/universal/start.mpd?hasMDE=1&path=%2Flibrary%2Fmetadata%2F10623&mediaIndex=0&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=700&location=wan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=1&mediaBufferSize=102400&session=ca4cgvoaddm2iqh19kumrp58&subtitles=burn&Accept-Language=en (7 live) GZIP Signed-in Token (User) (Chrome) Jun 13, 2022 08:22:20.913 [0x14ff191a0b38] DEBUG - [Transcode] Found session GUID of ca4cgvoaddm2iqh19kumrp58 in session start. Jun 13, 2022 08:22:20.915 [0x14ff191a0b38] DEBUG - [Transcode] TranscodeUniversalRequest: adapting profile with augmentation data: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.height&value=1280&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&audioCodec=aac&protocol=dash) Jun 13, 2022 08:22:20.915 [0x14ff191a0b38] DEBUG - [Transcode] TranscodeUniversalRequest: using augmented profile Web Jun 13, 2022 08:22:20.915 [0x14ff191a0b38] DEBUG - [Transcode] Downloading document http://127.0.0.1:32400/library/metadata/10623?checkFiles=1&includeBandwidths=1&offset=-1&X-Plex-Incomplete-Segments=1&X-Plex-Session-Identifier=0khdxxvegr3qssgwetfl3zgf Jun 13, 2022 08:22:20.920 [0x14ff1766bb38] DEBUG - [Transcode/w6spi31dgr43xwl7kawsu93s] Cleaning directory for session w6spi31dgr43xwl7kawsu93s (/transcode/Transcode/Sessions/plex-transcode-w6spi31dgr43xwl7kawsu93s-3392daa5-c728-4f5a-a8b0-fb0bb60cdf99) Jun 13, 2022 08:22:20.920 [0x14ff1920eb38] WARN - [Transcode/w6spi31dgr43xwl7kawsu93s] Transcode runner appears to have died. Jun 13, 2022 08:22:20.920 [0x14ff1920eb38] DEBUG - [Transcode/w6spi31dgr43xwl7kawsu93s] Session was stopped. Jun 13, 2022 08:22:20.920 [0x14ff17f24b38] DEBUG - Completed: [172.18.0.5:54642] 404 GET /video/:/transcode/universal/session/w6spi31dgr43xwl7kawsu93s/1/16.m4s (7 live) GZIP 901ms 379 bytes (pipelined: 1) Jun 13, 2022 08:22:20.938 [0x14ff191a0b38] DEBUG - [Transcode] We're going to try to auto-select an audio stream for account 1. Jun 13, 2022 08:22:20.938 [0x14ff191a0b38] DEBUG - [Transcode] Selecting best audio stream for part ID 22894 (autoselect: 1 language: en) Jun 13, 2022 08:22:20.938 [0x14ff191a0b38] DEBUG - [Transcode] Audio Stream: 78106, Subtitle Stream: 78107 Jun 13, 2022 08:22:20.940 [0x14ff191a0b38] DEBUG - [Transcode] Found session GUID of ca4cgvoaddm2iqh19kumrp58 in session start. Jun 13, 2022 08:22:20.940 [0x14ff191a0b38] DEBUG - [Transcode] Cleaning directory for session ca4cgvoaddm2iqh19kumrp58 () Jun 13, 2022 08:22:20.940 [0x14ff191a0b38] DEBUG - [Transcode] Starting a transcode session ca4cgvoaddm2iqh19kumrp58 at offset -1.0 (state=3) Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: using hardware decode accelerator nvdec Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: zero-copy support present Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: not using zero-copy because subtitle burning is required Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] [Universal] Using local file path instead of URL: /data/Movies/The Contractor (2022)/The.Contractor.2022.2160p.UHD.BluRay.HDR.DTS-HD.MA.5.1.x265-SPHD.mkv Jun 13, 2022 08:22:20.943 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: final decoder: nvdec, final encoder: nvenc Jun 13, 2022 08:22:20.944 [0x14ff191a0b38] DEBUG - [Transcode/JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/config/Library/Application\ Support/Plex\ Media\ Server/Codecs/994f4ee-4302-linux-x86_64/' X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxx "/usr/lib/plexmediaserver/Plex Transcoder" -codec:0 hevc -hwaccel:0 nvdec -hwaccel_fallback_threshold:0 10 -threads:0 1 -hwaccel_device:0 cuda -codec:1 dca -analyzeduration 20000000 -probesize 20000000 -i "/data/Movies/The Contractor (2022)/The.Contractor.2022.2160p.UHD.BluRay.HDR.DTS-HD.MA.5.1.x265-SPHD.mkv" -filter_complex "[0:2]scale=3840:1604[0];[0:0][0]overlay[1];[1]scale=w=3064:h=1280:force_divisible_by=4[2];[2]format=p010,tonemap=mobius[3];[3]format=pix_fmts=yuv420p|nv12[4]" -map "[4]" -metadata:s:0 language=eng -codec:0 h264_nvenc -b:0 20000k -forced-idr:0 1 -r:0 23.975999999999999 -force_key_frames:0 "expr:gte(t,n_forced*1)" -filter_complex "[0:1] aresample=async=1:ocl='stereo':rematrix_maxval=60.000000dB:osr=48000[5]" -map "[5]" -metadata:s:1 language=eng -codec:1 aac -b:1 256k -f dash -seg_duration 1 -dash_segment_type mp4 -init_seg_name 'init-stream$RepresentationID$.m4s' -media_seg_name 'chunk-stream$RepresentationID$-$Number%05d$.m4s' -window_size 5 -delete_removed false -skip_to_segment 1 -time_delta 0.0625 -manifest_name "http://127.0.0.1:32400/video/:/transcode/session/ca4cgvoaddm2iqh19kumrp58/bb762519-7b8a-4da8-8525-bc63f08f6f99/manifest?X-Plex-Http-Pipeline=infinite" -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 dash -start_at_zero -copyts -vsync cfr -init_hw_device cuda=cuda: -filter_hw_device cuda -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/ca4cgvoaddm2iqh19kumrp58/bb762519-7b8a-4da8-8525-bc63f08f6f99/progress Jun 13, 2022 08:22:20.944 [0x14ff191a0b38] DEBUG - [Transcode/JobRunner] Jobs: Starting child process with pid 1236 Â Link to comment Share on other sites More sharing options...
Luke 37335 Posted June 13, 2022 Share Posted June 13, 2022 9 hours ago, Sungray said: Okay found it, thank you. Â Â Hide contents Jun 13, 2022 08:22:20.912 [0x14ff17f24b38] DEBUG - Request came in with unrecognized domain / IP 'plex.example.com' in header Host; treating as non-local Jun 13, 2022 08:22:20.913 [0x14ff191a0b38] DEBUG - Request: [172.18.0.5:54690 (Allowed Network (Subnet))] GET /video/:/transcode/universal/start.mpd?hasMDE=1&path=%2Flibrary%2Fmetadata%2F10623&mediaIndex=0&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=700&location=wan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=1&mediaBufferSize=102400&session=ca4cgvoaddm2iqh19kumrp58&subtitles=burn&Accept-Language=en (7 live) GZIP Signed-in Token (User) (Chrome) Jun 13, 2022 08:22:20.913 [0x14ff191a0b38] DEBUG - [Transcode] Found session GUID of ca4cgvoaddm2iqh19kumrp58 in session start. Jun 13, 2022 08:22:20.915 [0x14ff191a0b38] DEBUG - [Transcode] TranscodeUniversalRequest: adapting profile with augmentation data: add-limitation(scope=videoCodec&scopeName=*&type=upperBound&name=video.height&value=1280&replace=true)+append-transcode-target-codec(type=videoProfile&context=streaming&audioCodec=aac&protocol=dash) Jun 13, 2022 08:22:20.915 [0x14ff191a0b38] DEBUG - [Transcode] TranscodeUniversalRequest: using augmented profile Web Jun 13, 2022 08:22:20.915 [0x14ff191a0b38] DEBUG - [Transcode] Downloading document http://127.0.0.1:32400/library/metadata/10623?checkFiles=1&includeBandwidths=1&offset=-1&X-Plex-Incomplete-Segments=1&X-Plex-Session-Identifier=0khdxxvegr3qssgwetfl3zgf Jun 13, 2022 08:22:20.920 [0x14ff1766bb38] DEBUG - [Transcode/w6spi31dgr43xwl7kawsu93s] Cleaning directory for session w6spi31dgr43xwl7kawsu93s (/transcode/Transcode/Sessions/plex-transcode-w6spi31dgr43xwl7kawsu93s-3392daa5-c728-4f5a-a8b0-fb0bb60cdf99) Jun 13, 2022 08:22:20.920 [0x14ff1920eb38] WARN - [Transcode/w6spi31dgr43xwl7kawsu93s] Transcode runner appears to have died. Jun 13, 2022 08:22:20.920 [0x14ff1920eb38] DEBUG - [Transcode/w6spi31dgr43xwl7kawsu93s] Session was stopped. Jun 13, 2022 08:22:20.920 [0x14ff17f24b38] DEBUG - Completed: [172.18.0.5:54642] 404 GET /video/:/transcode/universal/session/w6spi31dgr43xwl7kawsu93s/1/16.m4s (7 live) GZIP 901ms 379 bytes (pipelined: 1) Jun 13, 2022 08:22:20.938 [0x14ff191a0b38] DEBUG - [Transcode] We're going to try to auto-select an audio stream for account 1. Jun 13, 2022 08:22:20.938 [0x14ff191a0b38] DEBUG - [Transcode] Selecting best audio stream for part ID 22894 (autoselect: 1 language: en) Jun 13, 2022 08:22:20.938 [0x14ff191a0b38] DEBUG - [Transcode] Audio Stream: 78106, Subtitle Stream: 78107 Jun 13, 2022 08:22:20.940 [0x14ff191a0b38] DEBUG - [Transcode] Found session GUID of ca4cgvoaddm2iqh19kumrp58 in session start. Jun 13, 2022 08:22:20.940 [0x14ff191a0b38] DEBUG - [Transcode] Cleaning directory for session ca4cgvoaddm2iqh19kumrp58 () Jun 13, 2022 08:22:20.940 [0x14ff191a0b38] DEBUG - [Transcode] Starting a transcode session ca4cgvoaddm2iqh19kumrp58 at offset -1.0 (state=3) Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: using hardware decode accelerator nvdec Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: zero-copy support present Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: not using zero-copy because subtitle burning is required Jun 13, 2022 08:22:20.942 [0x14ff191a0b38] DEBUG - [Transcode] [Universal] Using local file path instead of URL: /data/Movies/The Contractor (2022)/The.Contractor.2022.2160p.UHD.BluRay.HDR.DTS-HD.MA.5.1.x265-SPHD.mkv Jun 13, 2022 08:22:20.943 [0x14ff191a0b38] DEBUG - [Transcode] TPU: hardware transcoding: final decoder: nvdec, final encoder: nvenc Jun 13, 2022 08:22:20.944 [0x14ff191a0b38] DEBUG - [Transcode/JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/config/Library/Application\ Support/Plex\ Media\ Server/Codecs/994f4ee-4302-linux-x86_64/' X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxx "/usr/lib/plexmediaserver/Plex Transcoder" -codec:0 hevc -hwaccel:0 nvdec -hwaccel_fallback_threshold:0 10 -threads:0 1 -hwaccel_device:0 cuda -codec:1 dca -analyzeduration 20000000 -probesize 20000000 -i "/data/Movies/The Contractor (2022)/The.Contractor.2022.2160p.UHD.BluRay.HDR.DTS-HD.MA.5.1.x265-SPHD.mkv" -filter_complex "[0:2]scale=3840:1604[0];[0:0][0]overlay[1];[1]scale=w=3064:h=1280:force_divisible_by=4[2];[2]format=p010,tonemap=mobius[3];[3]format=pix_fmts=yuv420p|nv12[4]" -map "[4]" -metadata:s:0 language=eng -codec:0 h264_nvenc -b:0 20000k -forced-idr:0 1 -r:0 23.975999999999999 -force_key_frames:0 "expr:gte(t,n_forced*1)" -filter_complex "[0:1] aresample=async=1:ocl='stereo':rematrix_maxval=60.000000dB:osr=48000[5]" -map "[5]" -metadata:s:1 language=eng -codec:1 aac -b:1 256k -f dash -seg_duration 1 -dash_segment_type mp4 -init_seg_name 'init-stream$RepresentationID$.m4s' -media_seg_name 'chunk-stream$RepresentationID$-$Number%05d$.m4s' -window_size 5 -delete_removed false -skip_to_segment 1 -time_delta 0.0625 -manifest_name "http://127.0.0.1:32400/video/:/transcode/session/ca4cgvoaddm2iqh19kumrp58/bb762519-7b8a-4da8-8525-bc63f08f6f99/manifest?X-Plex-Http-Pipeline=infinite" -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 dash -start_at_zero -copyts -vsync cfr -init_hw_device cuda=cuda: -filter_hw_device cuda -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/ca4cgvoaddm2iqh19kumrp58/bb762519-7b8a-4da8-8525-bc63f08f6f99/progress Jun 13, 2022 08:22:20.944 [0x14ff191a0b38] DEBUG - [Transcode/JobRunner] Jobs: Starting child process with pid 1236 Â Hi, can you please attach the complete log file? Thanks. Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 13, 2022 Share Posted June 13, 2022 @Sungray - Complete logs as attachment are always preferable. Could you please install the Diagnostics plugin, and after restart, please go to "Diagnostic Options" and scroll down to the find/replace section for ffmpeg commands: Find: setsar@f2=sar=sar,setparams@f3=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,tonemap_cuda@f4=tonemap=hable:format=yuv420p:param=1:desat=0.2,setparams@f5=color_primaries=bt709:color_trc=bt709:colorspace=bt709 Replace setparams@f3=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,tonemap_cuda@f4=tonemap=hable:format=yuv420p:param=1:desat=0.2 Even when it might not play or not play properly, just watch whether this has an effect on memory usage. Thanks Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 13, 2022 Author Share Posted June 13, 2022 Here's the complete plex log, sorry about that. Plex Media Server.log I'll check that now @softworkz, thanks. Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 13, 2022 Author Share Posted June 13, 2022 2 hours ago, softworkz said: @Sungray - Complete logs as attachment are always preferable. Could you please install the Diagnostics plugin, and after restart, please go to "Diagnostic Options" and scroll down to the find/replace section for ffmpeg commands: Find: setsar@f2=sar=sar,setparams@f3=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,tonemap_cuda@f4=tonemap=hable:format=yuv420p:param=1:desat=0.2,setparams@f5=color_primaries=bt709:color_trc=bt709:colorspace=bt709 Replace setparams@f3=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,tonemap_cuda@f4=tonemap=hable:format=yuv420p:param=1:desat=0.2 Even when it might not play or not play properly, just watch whether this has an effect on memory usage. Thanks Looks like that had no effect on the memory footprint. Replacement seems to have worked in the logs. ffmpeg-transcode-79b0d8cb-f3c6-4a17-9f2d-3392d09451ba_1.txt Spoiler >>>>>>  DIAGNOSTIC OPTIONS ACTIVE !!! Warning CommandLineOptions.SearchText: Original:  Actual: setsar@f2=sar=sar,setparams@f3=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,tonemap_cuda@f4=tonemap=hable:format=yuv420p:param=1:desat=0.2,setparams@f5=color_primaries=bt709:color_trc=bt709:colorspace=bt709 Warning CommandLineOptions.ReplaceText: Original:  Actual: setparams@f3=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,tonemap_cuda@f4=tonemap=hable:format=yuv420p:param=1:desat=0.2  Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 13, 2022 Author Share Posted June 13, 2022 Btw, is that something only I am experiencing, or is it a global behavior ? Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 13, 2022 Share Posted June 13, 2022 Thanks for the Pl log. It seems that they are doing subtitle overlay and tone mapping in software, while Emby is doing it in hardware. (hw subtitle overlay will be enabled in one of our next betas).  I wonder why, because they can actually do it in hw. Maybe they aren't doing hw tone mapping because of the subtitle overlay. You could find out by playing without subtitle selection and see how much memory they'll use in that case (and look at their log for 'tonemap_cuda').  What I can confirm is that memory usage is generally high with Nvidia hw acceleration. I just compared our ffmpeg with the stock ffmpeg on Windows when doing a simple transcode with color conversion (no tone mapping, no scaling), e.g.: ffmpeg.exe -y -copyts -start_at_zero -f matroska,webm -c:v:0 hevc -hwaccel:v:0 cuda -hwaccel_device:v:0 0 -hwaccel_output_format:v:0 cuda -i INPUT_4k_10bit_HEVC.mkv -filter_complex "[0:1]scale_cuda@f1=format=yuv420p,setsar@f2=sar=sar[f2_out0]" -map [f2_out0] -map 0:0 -sn -c:v:0 h264_nvenc -b:v:0 4137772 -g:v:0 72 -maxrate:v:0 4137772 -bufsize:v:0 8275544 -keyint_min:v:0 72 -profile:v:0 high -c:a:0 copy out.mkv stock ffmpeg 5..0 => 1.7 GB Nvidia memory => 6.13x transcoding speed emby-ffmpeg 2022-06-12 => 1.4 GB Nvidia memory => 6.36x transcoding speed Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 13, 2022 Share Posted June 13, 2022 BTW. for a realistic comparison, you'll also need to look at ffmpeg CPU and mem (theirs called differently, but it's a modified ffmpeg only) - and most importantly: the effective transcoding speed. Regarding memory usage, you need to consider that 4k requires 4 times of the memory of Full HD (the 4 in 4k is just a coincidence, though). Video processing always requires uncompressed video frames, so that makes a huge difference. Comparing to QSV, it still seems to use a bit more memory, but it would require some deeper investigation to find out why. Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 14, 2022 Author Share Posted June 14, 2022 Changing subtitles prefs to none has no impact on memory - but it starts a secondary process on the GPU which lasts for <1s. tonemap_cuda is there now, without subs. Jun 14, 2022 07:25:02.803 [0x14f27f2b0b38] DEBUG - [Transcode/js0cw30nq8xglybgt9t57c0x/JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/config/Library/Application\ Support/Plex\ Media\ Server/Codecs/994f4ee-4302-linux-x86_64/' X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxx "/usr/lib/plexmediaserver/Plex Transcoder" -codec:0 hevc -hwaccel:0 nvdec -hwaccel_fallback_threshold:0 10 -threads:0 1 -hwaccel_output_format:0 cuda -hwaccel_device:0 cuda -codec:1 dca -ss 235 -analyzeduration 20000000 -probesize 20000000 -i "/data/Movies/The Contractor (2022)/The.Contractor.2022.2160p.UHD.BluRay.HDR.DTS-HD.MA.5.1.x265-SPHD.mkv" -filter_complex "[0:0]hwupload[0];[0]scale_cuda=w=3064:h=1280:format=p010[1];[1]tonemap_cuda=mobius:nv12[2]" -map "[2]" -metadata:s:0 language=eng -codec:0 h264_nvenc -b:0 14023k -maxrate:0 18698k -bufsize:0 37396k -forced-idr:0 1 -r:0 23.975999999999999 -force_key_frames:0 "expr:gte(t,n_forced*1)" -filter_complex "[0:1] aresample=async=1:ocl='stereo':rematrix_maxval=60.000000dB:osr=48000[3]" -map "[3]" -metadata:s:1 language=eng -codec:1 aac -b:1 136k -f dash -seg_duration 1 -dash_segment_type mp4 -init_seg_name 'init-stream$RepresentationID$.m4s' -media_seg_name 'chunk-stream$RepresentationID$-$Number%05d$.m4s' -window_size 5 -delete_removed false -skip_to_segment 236 -time_delta 0.0625 -manifest_name "http://127.0.0.1:32400/video/:/transcode/session/js0cw30nq8xglybgt9t57c0x/655a795f-d8ac-4a49-a12c-7774407bfb1d/manifest?X-Plex-Http-Pipeline=infinite" -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 dash -start_at_zero -copyts -init_hw_device cuda=cuda: -filter_hw_device cuda -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/js0cw30nq8xglybgt9t57c0x/655a795f-d8ac-4a49-a12c-7774407bfb1d/progress Plex Media Server.log Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 14, 2022 Share Posted June 14, 2022 You can try to get equal by replacing the emby encoding parameters with theirs: -b:0 14023k -maxrate:0 18698k -bufsize:0 37396k -forced-idr:0 1 -r:0 23.975999999999999 -force_key_frames:0 "expr:gte(t,n_forced*1)" But the only one which makes a (slight) difference is the encoding profile (we're using 'high'). Â Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 14, 2022 Share Posted June 14, 2022 12 minutes ago, Sungray said: tonemap_cuda is there now, without subs. Was the shown memory from the case alreeady? Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 14, 2022 Author Share Posted June 14, 2022 (edited) 5 minutes ago, softworkz said: Was the shown memory from the case alreeady? The memory chart is from the last test yes, with tonemap_cuda. The second gpu process is when I change the subtitle settings, whether to none or to a subtitle. The memory does not change whether tonemap_cuda is enabled or not, or at least not by much. What I did during that test is to start without subtitles (tonemap_cuda enabled) then select a subtitle. The screenshot is of the second i'm selecting the sub to show the second process, but I might already have switched a few times already from none to sub selected. Edited June 14, 2022 by Sungray Link to comment Share on other sites More sharing options...
softworkz 3353 Posted June 14, 2022 Share Posted June 14, 2022 12 hours ago, Sungray said: Replacement seems to have worked in the logs. ffmpeg-transcode-79b0d8cb-f3c6-4a17-9f2d-3392d09451ba_1.txt Replacement hadn't worked in this log (the cmd was different), but this replacement is no longer of interest as I have already checked whether it affects mem usage.  1 hour ago, softworkz said: You can try to get equal by replacing the emby encoding parameters with theirs: -b:0 14023k -maxrate:0 18698k -bufsize:0 37396k -forced-idr:0 1 -r:0 23.975999999999999 -force_key_frames:0 "expr:gte(t,n_forced*1)" But the only one which makes a (slight) difference is the encoding profile (we're using 'high'). From the older log, it would be like: Find: -b:v:0 74961474 -g:v:0 72 -maxrate:v:0 74961474 -bufsize:v:0 149922948 -keyint_min:v:0 72 -r:v:0 23.976024627685547 -profile:v:0 high Replace : -b:0 14023k -maxrate:0 18698k -bufsize:0 37396k -forced-idr:0 1 -r:0 23.975999999999999 -force_key_frames:0 "expr:gte(t,n_forced*1)" Link to comment Share on other sites More sharing options...
Sungray 6 Posted June 14, 2022 Author Share Posted June 14, 2022 ffmpeg-transcode-fc62f9d3-6c05-4edc-88d0-9271a0d4150c_1.txt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now