HEVC transcoding only working locally not remote

I have a Synology DS418play, which has Intel Celeron J3355 dual-core 2GHz AND has hardware transcoding that supports H.264 (AVC), H.265 (HEVC) at max 4K (4096 x 2160) 30fps.

When I turn on the "Use HEVC for transcoding" option in settings, I'm able to locally record and stream locally to AppleTV devices on the network. When I am away, remote streaming fails on AppleTV and iPhone, but streams via the Safari browser. The activity box on the Settings page says (0.00fps)) and I get the following in the debug log:

Hardware Transcoder Probe

amf
[Parsed_color_0 @ 0x296f240] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Unknown encoder 'h264_amf'
exit status 1
nvenc
[Parsed_color_0 @ 0x24d0240] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x251b180] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[h264_nvenc @ 0x24fd240] Cannot load libcuda.so.1
[h264_nvenc @ 0x24fd240] Nvenc unloaded
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
exit status 1
vaapi+deint
[AVHWDeviceContext @ 0x8c874c0] libva: VA-API version 1.16.0
[AVHWDeviceContext @ 0x8c874c0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x8c874c0] Initialised VAAPI connection: version 1.16
[AVHWDeviceContext @ 0x8c874c0] VAAPI driver: Intel i965 driver for Intel(R) Broxton - 2.4.0.pre1 (2.4.0.pre1).
[AVHWDeviceContext @ 0x8c874c0] Driver not found in known nonstandard list, using standard behaviour.
[Parsed_color_0 @ 0x8c96bc0] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x8cc5b40] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
[auto_scaler_0 @ 0x8cc8780] w:iw h:ih flags:'bicubic' interl:0
[trim_in_0_0 @ 0x8cc6600] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'trim_in_0_0'
[auto_scaler_0 @ 0x8cc8780] w:640 h:480 fmt:yuv420p sar:1/1 -> w:640 h:480 fmt:nv12 sar:1/1 flags:0x4
[Parsed_deinterlace_vaapi_2 @ 0x8cc4f40] Picking 4 (MotionCompensated) as default deinterlacing mode.
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: wrapped_avframe, 1 reference frame, vaapi_vld(tv, progressive), 640x480 (0x0) [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc58.134.100 wrapped_avframe
No more output streams to write to, finishing.
frame=    2 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.12 bitrate=N/A speed=2.66x    
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (color=black:640x480):
  Input stream #0:0 (video): 4 packets read (1843200 bytes); 4 frames decoded; 
  Total: 4 packets (1843200 bytes) demuxed
Output file #0 (/dev/null):
  Output stream #0:0 (video): 2 frames encoded; 2 packets muxed (1072 bytes); 
  Total: 2 packets (1072 bytes) muxed
success!
vaapi@/dev/dri/renderD128
[AVHWDeviceContext @ 0x8f56400] libva: VA-API version 1.16.0
[AVHWDeviceContext @ 0x8f56400] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x8f56400] Initialised VAAPI connection: version 1.16
[AVHWDeviceContext @ 0x8f56400] VAAPI driver: Intel i965 driver for Intel(R) Broxton - 2.4.0.pre1 (2.4.0.pre1).
[AVHWDeviceContext @ 0x8f56400] Driver not found in known nonstandard list, using standard behaviour.
[Parsed_color_0 @ 0x8f65c00] size:640x480 rate:25/1 duration:-1.000000 sar:1/1
Input #0, lavfi, from 'color=black:640x480':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x8f935c0] w:640 h:480 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: wrapped_avframe, 1 reference frame, yuv420p(progressive), 640x480 (0x0) [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc58.134.100 wrapped_avframe
No more output streams to write to, finishing.
frame=    3 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.12 bitrate=N/A speed=7.53x    
video:2kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (color=black:640x480):
  Input stream #0:0 (video): 4 packets read (1843200 bytes); 4 frames decoded; 
  Total: 4 packets (1843200 bytes) demuxed
Output file #0 (/dev/null):
  Output stream #0:0 (video): 3 frames encoded; 3 packets muxed (1608 bytes); 
  Total: 3 packets (1608 bytes) muxed
success!
vaapi@/dev/dri/renderD129
no such file or directory

Unchecking "Use HEVC for transcoding" allows streaming to work again. Note that the problem occurs on previously recorded content and streaming any live channels from Guide and both resolve after disabling the feature.

I just encountered the same issue. Checked "Use HEVC for transcoding" and initially it worked fine both local and remote.

Recently the iOS app would just 'spin' after selecting a channel when connected remotely. (It continued to work fine when connected to the local network). I checked the Channels DVR server logs when connecting remotely and found these errors:

2023/11/04 07:05:09.841674 [ENC] Starting encoder for ch600 in /volume2/DVR/Streaming/ch600-dANY-c92e366b6d06-3669851060/encoder-1-1502759480 at 1 (1.256389) (encoder=hevc_vaapi, resolution=1080, deinterlacer=hardware, bitrate=5616, segment_size=0.01)
2023/11/04 07:05:09.872951 [HLS] ffmpeg: ch600-dANY-c92e366b6d06-1-hevc-aac-copy--5616-384-1080-6-0---false-false-0.01-0: Error while decoding stream #0:1: Invalid data found when processing input
2023/11/04 07:05:10.295289 [HLS] ffmpeg: ch600-dANY-c92e366b6d06-1-hevc-aac-copy--5616-384-1080-6-0---false-false-0.01-0: [hls @ 0x8553480] Stream HEVC is not hvc1, you should use tag:v hvc1 to set it.

Turned off this feature and remote streaming began working again.

Did anyone find a solution to this. I notice that using HEVC to transcode uses much less CPU and GPU than transcoding to H.264 (about 50% less processing power). However, when I try to watch a show on my Android Phone app, I just get the black spinning circle forever. I can see the CPU and GPU workload go up, but nothing every plays on my phone. Android 14 supports HEVC H.265 so I don't think it is a phone issue per say.

Other than switching the Deinterlacer to Linear (which didn't work), is there anything else I should try to get this working?

Here is what my log shows when trying to watch a program on my Android phone with HEVC transcoding enabled...

2024/02/23 12:17:58.538429 [ENC] Starting encoder for Island Hunters S03E04 2016-07-17 The Search for a Dream Pa 2024-02-22-2229.mpg in E:\ChannelsDVR\Streaming\file34784-a6ddad236415-692993317\encoder-0-4228814341 at 0 (0.000000) (encoder=hevc_mf, resolution=1080, deinterlacer=linear, bitrate=7616, segment_size=0.01)
2024/02/23 12:17:59.089265 [HLS] ffmpeg: file34784-a6ddad236415: [hevc_mf @ 0000000002d20540] format negotiation failed (1/0)
2024/02/23 12:17:59.151795 [HLS] ffmpeg: file34784-a6ddad236415: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2024/02/23 12:17:59.152361 [HLS] ffmpeg: file34784-a6ddad236415: [aac @ 00000000033308c0] 2 frames left in the queue on closing
2024/02/23 12:17:59.173768 [ENC] Encoder stopped for Island Hunters S03E04 2016-07-17 The Search for a Dream Pa 2024-02-22-2229.mpg in E:\ChannelsDVR\Streaming\file34784-a6ddad236415-692993317\encoder-0-4228814341 after starting from 0 without encoding any segments
2024/02/23 12:17:59.176768 [ENC] Starting encoder for Island Hunters S03E04 2016-07-17 The Search for a Dream Pa 2024-02-22-2229.mpg in E:\ChannelsDVR\Streaming\file34784-a6ddad236415-692993317\encoder-0-2619085721 at 0 (0.000000) (encoder=hevc_mf, resolution=1080, deinterlacer=linear, bitrate=7616, segment_size=0.01)
2024/02/23 12:17:59.812308 [HLS] ffmpeg: file34784-a6ddad236415: [hevc_mf @ 0000000002d70540] format negotiation failed (1/0)
2024/02/23 12:17:59.840958 [HLS] ffmpeg: file34784-a6ddad236415: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height



It also shows this message, should I try updating ffmpeg?

2024/02/23 12:16:34.039926 [HLS] ffmpeg: file34778-a6ddad236415: [NULL @ 0000000000f3e9c0] illegal reordering_of_pic_nums_idc 12
2024/02/23 12:16:34.039926 [HLS] ffmpeg: file34778-a6ddad236415: [NULL @ 0000000000f3e9c0] Out of range weight is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
2024/02/23 12:16:34.039926 [HLS] ffmpeg: file34778-a6ddad236415: [NULL @ 0000000000f3e9c0] If you want to help, upload a sample of this file to VideoLAN File Uploader and contact the ffmpeg-devel mailing list. ([email protected])
2024/02/23 12:16:34.039926 [HLS] ffmpeg: file34778-a6ddad236415: [NULL @ 0000000000f3e9c0] illegal reordering_of_pic_nums_idc 6
2024/02/23 12:16:34.040430 [HLS] ffmpeg: file34778-a6ddad236415: [NULL @ 0000000000f3e9c0] illegal reordering_of_pic_nums_idc 25

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.