Synology DS-916+ not transcoding in real time (+ processing hooks)

Ok, this is pretty nerdy, I suppose, but I think it could be pretty cool.

I’d love to be able to set up scripts that could run at certain points in the DVR process. For example:

  • program finished recording
  • comskip scan completed
  • program deleted

The particular use case I’m thinking of is I’d like to symlink a recording into Plex, with a new filename that Plex will like, after the program finishes recording. This would let me watch remotely using the Plex real-time transcoder, which seems to work better on my hardware (Synology DS-916+) than the Channels transcoder*.

I would use the deleted hook to remove the plex symlink, so it wasn’t left dangling. I could avoid this by just copying the file, instead of symlinking, but I’ll only watch a small number of these files with Plex, and I’d rather not have to use additional space for a copy.

I’m sure others would have good ideas for how to use these hooks as well!

    • with the Channels transcoder, it seems I can achieve roughly real-time transcoding with hardware transcode enabled at about 480p. Software transcoder roughly similar, although uses more CPU. With Plex, I can do a 1080p transcode (or lower resolution if I need to) at a selectable bit rate in real time on the same hardware.

We do plan to add some sort of hooks. Very useful to hear about real use-cases as this will help inform how the hooks are implemented.

We’re also planning a Transcode/Export option which could also be used to create symlinks instead of copying the file.

I’m surprised to hear that the DVR transcoder is not performing as well as Plex’s, since they’re both just using ffmpeg. Can you run ps aux | grep Transcoder while plex is transcoding to and paste the command it’s using?

Sure- here’s what it’s running when playing on the web, doing original-quality transcode; this runs at about 98% CPU usage:

gregr@nas1:~$ ps aux | grep Transcode
plex     16955  394  3.1 476400 255140 ?       Rl   18:18   1:38 /volume1/@appstore/Plex Media Server/Plex Transcoder -codec:#0x31 mpeg2video -ss 30 -i /volume1/media/TV Shows/A Craftsman's Legacy/Season 03/A Craftsman's Legacy - s03e09 - The Cooper.mpg -filter_complex [0:#0x31]yadif[1];[1]scale=w=min(1920\,iw):h=min(1080\,ih):force_original_aspect_ratio=decrease,format=pix_fmts=yuv420p|nv12[0] -map [0] -codec:0 libx264 -crf:0 16 -maxrate:0 17904k -bufsize:0 35808k -r:0 29.969999999999999 -preset:0 veryfast -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 expr:gte(t,30+n_forced*1) -map 0:#0x34 -metadata:s:1 language=eng -codec:1 copy -copypriorss:1 0 -segment_format mpegts -f ssegment -individual_header_trailer 0 -segment_time 1 -segment_start_number 30 -segment_copyts 1 -segment_time_delta 0.0625 -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 media-%05d.ts -start_at_zero -copyts -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/08r3nsuro8lbfgvpfah2ou85/progress

Just for grins, here’s the command when transcoding down to 3Mbps 720p, which runs at about 75% CPU:

gregr@nas1:~$ ps aux | grep Transcode
plex     17552  304  1.7 326900 138484 ?       Sl   18:20   1:49 /volume1/@appstore/Plex Media Server/Plex Transcoder -codec:#0x31 mpeg2video -ss 177 -i /volume1/media/TV Shows/A Craftsman's Legacy/Season 03/A Craftsman's Legacy - s03e09 - The Cooper.mpg -filter_complex [0:#0x31]yadif[1];[1]scale=w=min(1280\,iw):h=min(720\,ih):force_original_aspect_ratio=decrease,format=pix_fmts=yuv420p|nv12[0] -map [0] -codec:0 libx264 -crf:0 18 -maxrate:0 3000k -bufsize:0 6000k -r:0 29.969999999999999 -preset:0 veryfast -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 expr:gte(t,177+n_forced*3) -map 0:#0x34 -metadata:s:1 language=eng -codec:1 copy -copypriorss:1 0 -segment_format mpegts -f ssegment -individual_header_trailer 0 -segment_time 3 -segment_start_number 59 -segment_copyts 1 -segment_time_delta 0.0625 -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 media-%05d.ts -start_at_zero -copyts -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/8zkgxn9r3lthx74tqlqezot4/progress

And, for giggles, here’s 1.5Mbps 480p transcode, at about 65% CPU:

gregr@nas1:~$ ps aux | grep Transcode
plex     17904  251  1.1 214760 92472 ?        Sl   18:22   1:28 /volume1/@appstore/Plex Media Server/Plex Transcoder -codec:#0x31 mpeg2video -ss 240 -i /volume1/media/TV Shows/A Craftsman's Legacy/Season 03/A Craftsman's Legacy - s03e09 - The Cooper.mpg -filter_complex [0:#0x31]yadif[1];[1]scale=w=min(720\,iw):h=min(404\,ih):force_original_aspect_ratio=decrease,format=pix_fmts=yuv420p|nv12[0] -map [0] -codec:0 libx264 -crf:0 19 -maxrate:0 1500k -bufsize:0 3000k -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,240+n_forced*8) -map 0:#0x34 -metadata:s:1 language=eng -codec:1 copy -copypriorss:1 0 -segment_format mpegts -f ssegment -individual_header_trailer 0 -segment_time 8 -segment_start_number 30 -segment_copyts 1 -segment_time_delta 0.0625 -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 media-%05d.ts -start_at_zero -copyts -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/pcz7577f7nmwvjyyy2zaeu9z/progress

Plex is using the software transcoder. The channels HW transcoder should easily be able to surpass it.

Are you saying that with Hardware 1080p transcoding, you’re not able to watch in realtime? What is the rate shown under the video player?

I don’t have that specific program in Channels any more, but I have another recording I’m using.

I’m set to Hardware, Blend, 1080p.

Transcoder runs at about 0.5x, CPU utilization about 28% (this is on a 4-core machine, so basically one core saturated).

If I switch to software, Blend, 1080p, I get about 0.8x, at around 75% CPU.

Hardware, Blend, 720p runs at about 0.7x

Hardware, Blend, 480p runs at about 0.92x

Weird, that’s definitely not normal.

Can you copy/paste the OS/CPU details from the Settings tab?

And the relevant lines from the Log tab for when the the HW transcoder is being used?

Looks like some similar reports on Synology DS916+

Here are the OS/CPU details from the Settings tab:

OS
Linux
(kernel: 3.10.77)
CPU
4 cores / Intel® Pentium® CPU N3710 @ 1.60GHz
load averages: 1.24 1.16 1.29
RAM
8.29 GB
95.5% free

And from the log when playing on the web using the HW transcoder:

2017/01/23 19:07:36 [HLS] Starting transcoder for file-15 at 5m44s (encoder=h264_vaapi, resolution=1080, deinterlacer=blend, bitrate=4000)
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: va_openDriver() returns 0
[mpegts @ 0x18c7700] PES packet size mismatch
[mpegts @ 0x18c7700] Dropped corrupted packet (stream = 1)
[mpegts @ 0x18c7700] PES packet size mismatch
[mpegts @ 0x18c7700] Dropped corrupted packet (stream = 2)
2017/01/23 19:08:39 [HLS] Stopping transcoder session file-15 @ 6m16.899544s

Thanks. Can you run dmesg after SSHing in and see if there are any errors that say “intel” or “drm”

Well, there are some lines that mention those things. I’ve attached the entire output here:

https://dl.dropboxusercontent.com/u/6774036/dmesg.txt

Initialization of the intel hw driver definitely shows some suspect messages:

[   46.479768] [drm] Initialized drm 1.1.0 20060810
[   46.799484] [drm] Memory usable by graphics device = 2048M
[   46.805676] i915 0000:00:02.0: setting latency timer to 64
[   46.806253] mtrr: no more MTRRs available
[   46.810785] [drm] MTRR allocation failed.  Graphics performance may suffer.
[   46.826273] i915 0000:00:02.0: irq 139 for MSI/MSI-X
[   46.826298] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   46.833755] [drm] Driver supports precise vblank timestamp query.
[   46.894296] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
[   46.983779] acpi device:28: registered as cooling_device4
[   46.989956] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[   46.997809] input: Video Bus as /devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:00/input/input3
[   47.007956] [drm] Initialized i915 1.6.0 20141121 for 0000:00:02.0 on minor 0
[   47.032193] [drm] GMBUS [i915 gmbus panel] timed out, falling back to bit banging on pin 3
[   47.067611] i915 0000:00:02.0: No connectors reported connected with modes
[   47.075338] [drm] Cannot find any crtc or sizes - going 1024x768
[   47.433650] i915 0000:00:02.0: fb0: inteldrmfb frame buffer device
[   47.440622] i915 0000:00:02.0: registered panic notifier

Could be an issue with the kernel version being shipped on these devices. Although, presumably Synology’s own apps are able to transcode using hardware without issue?

Presumably. I don’t have Video station installed, but I read from others that it seems to transcode as expected…

Just for another data point - I see the same behavior for both live and recordings. The HW transcoder runs around 0.5x at 1080p (this is with a live mpeg2 stream from a connect, which was about 13Mbps while I was testing this morning).

I also tried disabling memory compression in the NAS power’hardware settings, no effect.

Hey this is kind of random, but I wanted to mention it in case it offered a clue to the issue here. In this thread, snow66 mentioned his core i7 Mac mini runs comskip in about 10 minutes per half-hour show:

My DS916+ runs comskip in about 5-7 minutes per half hour show, which is a bit surprising. I would think the CPU has to be less powerful than an 2.3GHz quad-core i7.

Which makes me wonder - is comskip hardware accelerated? If so, that might provide a clue…maybe the difference between comskip and the transcoder could shed light on why the HW transcoding is slow.

I’m sure there is more going on with a Mac Mini than a Synology NAS. I have an little i5 mobile processor that finishes it faster, but it only runs the DVR. 2.5 to 3 mins

2017/01/25 18:30:00 [DVR] Running commercial detection on file 38 (TV/The Big Bang Theory/2017-01-25-1759 The Big 2017/01/25 18:32:57 [DVR] Commercial detection finished with 6 markers.

2017/01/25 19:00:00 [DVR] Running commercial detection on file 39 (TV/The Big Bang Theory/2017-01-25-1829 The Big 2017/01/25 19:02:39 [DVR] Commercial detection finished with 6 markers.

I finally tracked down this issue and found a workaround, which is now available in v2017.02.15.0045. With the new version, we are seeing faster than realtime hardware transcoders on our DS-916+!

Thanks for reporting this issue and helping us debug it.