Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

TVMosaic live and recorded TV products for Desktop/NAS/Raspbery Pi
Post Reply
bequiet88
Posts: 5
Joined: Tue Oct 09, 2018 8:03 pm

Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

Post by bequiet88 » Tue Oct 09, 2018 9:24 pm

Hey there,

quick background on what I'd like to achieve:

German DVB-T2 HD (h.265)
=> TV Butler Stick plugged to Synology DS216+II
=> TV Mosaic Server (build 16509) on Synology DS216+II
=> Hardware Transcoding h.265 to h.264/aac transport stream
=> watch 1080p with DVBLink KODI PVR Plugin on Raspi 3 (transcoding is enabled in client)

So far, so good. My Synology DS216+II is powered by a Celeron N3060 Braswell CPU which is according to this source [1] capable of Hardware decoding h.265 with its Intel HD Graphics 400 chip.

What is working:
  • watch DVB-T2 HD on my Radeon RX 480 powered PC is very smooth (transcoding disabled in client)
  • ffmpeg is started on Synology DS216+II when transcoding is enabled in TV Mosaic client (kodi, android, windows), see attached TV Mosaic log:

    Code: Select all

    2018-Oct-09 21:50:58:   [I] Starting live_transcoder. w 1920, h 1080, b 4096, s -1, a (deu)
    2018-Oct-09 21:50:58:   [I] launch_ffmpeg. Executing /volume1/@appstore/TVMosaic/data/common/ffmpeg/ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -analyzeduration 2500000 -i pipe:0 -f mpegts -acodec aac -c:v h264_vaapi -async 1 -ab 128k -qp 25 -level 31 -bf 4 -vf deinterlace_vaapi=rate=field:auto=1,scale_vaapi=w=trunc(iw*(1080/ih)*sar/32)*32:h=trunc(ih*(1080/ih)/16)*16 -b:v 4096k -map 0:v:? -map 0:a -y pipe:1 
    2018-Oct-09 21:50:58:   [I] ffmpeg_wrapper<T>::create_ffmpeg_process: env var LD_LIBRARY_PATH=/volume1/@appstore/TVMosaic/data/common/ffmpeg
    2018-Oct-09 21:50:58:   [I] ffmpeg_wrapper<T>::create_ffmpeg_process: env var LIBVA_DRIVER_NAME=i965
    2018-Oct-09 21:50:58:   [I] ffmpeg_wrapper<T>::create_ffmpeg_process: env var LIBVA_DRIVERS_PATH=/volume1/@appstore/TVMosaic/data/common/ffmpeg/dri
     

    also tested the same with other bitrate settings
  • ffmpeg from Synology's Video station can be used to do hardware accelerated decoding, e.g. (see 2nd attached log):

    Code: Select all

    ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -analyzeduration 2500000  -i /volume1/video/Eigene/Elecard_about_Tomsk_part2_HEVC_1080p.mp4 -f mpegts -acodec aac -c:v h264_vaapi -async 1 -ab 128k -qp 25 -level 31 -bf 4 -b:v 1024k  output.mp4
    
What is not working:
  • Being able to watch transcoded stream in any client (kodi, android, windows) a sensible manner, see TV Mosaic log:

    Code: Select all

    2018-Oct-09 21:50:59:   [I] CTSStreamWaiter::ProcessStream. Found first not encrypted packet. Start streaming
    2018-Oct-09 21:51:05:   [W] ts_circle_buffer::write_stream. Circle buffer overflow. Context data_provider
    ... goes on until stream is stopped
    2018-Oct-09 21:52:17:   [W] ts_circle_buffer::write_stream. Circle buffer overflow. Context data_provider
    

Anyone any idea what I'm missing here? Are there some wrong settings? Or is my entire idea doomed to fail because something I'm overlooking here?

Thanks for the support.

Cheers Jochen


[1] https://en.wikichip.org/wiki/intel/cele ... 0#Graphics
Attachments
tvmosaic-log-20181009-2230.zip
(64.05 KiB) Downloaded 8 times
ffmpeg_video_station.zip
Video Station ffmpeg HEVC Decode Log
(2.04 KiB) Downloaded 9 times

bequiet88
Posts: 5
Joined: Tue Oct 09, 2018 8:03 pm

Re: Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

Post by bequiet88 » Sat Oct 20, 2018 1:37 pm

Nobody any thoughts on this? Thanks for a heads up :)

bequiet88
Posts: 5
Joined: Tue Oct 09, 2018 8:03 pm

Re: Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

Post by bequiet88 » Sat Oct 20, 2018 5:41 pm

in dmesg, i found a gpu related problem

Code: Select all

[41785.551299] [drm] stuck on bsd ring
[41785.571581] [drm] GPU HANG: ecode 8:1:0x8cfffffd, in ffmpeg [27150], reason: Ring hung, action: reset
[41785.581920] [drm] GPU hangs can indicate a bug anywhere in the entire gfx stack, including userspace.
[41785.592246] [drm] Please file a _new_ bug report on bugs.freedesktop.org against DRI -> DRM/Intel
[41785.602170] [drm] drm/i915 developers can then reassign to the right component if it's not a kernel issue.
[41785.612978] [drm] The gpu crash dump is required to analyze gpu hangs, so please always attach it.
[41785.623010] [drm] GPU crash dump saved to /sys/class/drm/card0/error
[41785.632216] drm/i915: Resetting chip after gpu hang
[41791.551207] [drm] stuck on bsd ring
[41791.571349] [drm] GPU HANG: ecode 8:1:0x8cfffffd, in ffmpeg [27150], reason: Ring hung, action: reset
[41791.583133] [drm:i915_set_reset_status [i915]] *ERROR* gpu hanging too fast, banning!
[41791.593129] drm/i915: Resetting chip after gpu hang
[42015.548075] [drm] stuck on bsd ring
[42015.570788] [drm] GPU HANG: ecode 8:1:0x8cfffffd, in ffmpeg [27948], reason: Ring hung, action: reset
[42015.582999] drm/i915: Resetting chip after gpu hang
[42025.547925] [drm] stuck on bsd ring
[42025.570296] [drm] GPU HANG: ecode 8:1:0x8cfffffd, in ffmpeg [27948], reason: Ring hung, action: reset
[42025.581001] [drm:i915_set_reset_status [i915]] *ERROR* gpu hanging too fast, banning!
[42025.591857] drm/i915: Resetting chip after gpu hang
hw transcoding in tv mosaic starts with

Code: Select all

ffmpeg_wrapper<T>::create_ffmpeg_process: env var LIBVA_DRIVER_NAME=i965
does it mean, tv mosaic loads the wrong driver?

Oberon
Posts: 1127
Joined: Thu Jan 26, 2017 8:45 am

Re: Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

Post by Oberon » Mon Oct 22, 2018 12:20 pm

TVMosaic loads the right driver, but apparently there is an issue in the gpu drivers implementation on your NAS. Are you running the latest DSM version?

bequiet88
Posts: 5
Joined: Tue Oct 09, 2018 8:03 pm

Re: Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

Post by bequiet88 » Mon Oct 22, 2018 5:51 pm

Thanks, Oberon.

The errors reported in dmesg were apperently only because of a failed resume after a standby of the NAS. So not related to TV-Mosaic at all.

Regarding drivers: Yep, I got aware of this as well. TV-Mosaic, as well as the video station ffmpeg build, loads it own drivers. I can now also confirm that the TV Mosaic ffmpeg build works as expected when invoked from command line with the command from my first post:

Code: Select all

ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -analyzeduration 2500000  -i /volume1/video/Eigene/Elecard_about_Tomsk_part2_HEVC_1080p.mp4 -f mpegts -acodec aac -c:v h264_vaapi -async 1 -ab 128k -qp 25 -level 31 -bf 4 -b:v 2M  output.mp4
With b:v 2M I reach a speed of 3x, with b:v 1024k and all those deinterlace_vaapi parameters, the NAS only achieves 1,1x. Both metrics are with my sample file and not with the HEVC decoded stream.

Btw: is there an opportunity to get the log output from ffmpeg launched by TV Mosaic? I tried adding "2> output.log" in the profile. But with those, the stream didnt start correctly.

Oberon
Posts: 1127
Joined: Thu Jan 26, 2017 8:45 am

Re: Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

Post by Oberon » Mon Oct 22, 2018 5:56 pm

You can get the full log from ffmpeg by using ssh.
Log into your NAS and do
cd /var/packages/TVMosaic/target

Then execute
./stop.sh
./start.sh

The latter will star TVMosaic in command line mode and you will be able to see the exact ffmpeg output when it works.
When finished press Control-C and then do ./start2.sh

bequiet88
Posts: 5
Joined: Tue Oct 09, 2018 8:03 pm

Re: Transcoding German DVB-T2 HD h.265 on Synology DS216+II results in "Circle buffer overflow."

Post by bequiet88 » Sat Nov 24, 2018 6:36 pm

So, finally, I've been able to solve the issues.

I created a new ffmpeg profile where I removed all the "deinterlace_vaapi" parameters. Downside of this approach, the resolution / scale settings from the clients are not used. So, the transcoder outputs the stream in its input resolution. Which is fine for me as German DVB-T2 HD comes (mainly) in Full HD.

@Oberon thanks for pointing out how to get hold of the ffmpeg logs! You may close the thread.

Post Reply