ua0lnj / vdr-plugin-softhddevice

VDR SoftHDDevice Plug-in
11 stars 3 forks source link

[CUVID] svdrpsend GRAB can return old frames #29

Open seahawk1986 opened 4 years ago

seahawk1986 commented 4 years ago

Hello,

since it is not easy to capture the softhddevice output with tools like OBS, I tried to use the GRAB command (see example script below) to demonstrate movements in the VDR OSD - after grabbing the frames, I use ffmpeg -r 25 -i /tmp/frame%04d.pnm -c:v libx264 -crf 25 -pix_fmt yuv420p capture.mp4 to convert the image sequence into a video.

While I don't expect the resulting video to be perfectly smooth (there is no frame-based sync mechanism), I noticed that sometimes GRAB apparently writes an older frame into a file, so the video looks quite jerky due to the occasionally inserted older frames. I tried the same with softhdcuvid, where the GRAB command was a little slower, but lead to a smoother output without noticably inserting older frames in between.

Do you have an idea why grab with softhddevice using CUVID occasionally returns older frames?

#!/usr/bin/env python3
import time
import telnetlib
import logging
from collections import namedtuple

SVDRPResponse = namedtuple("SVDRPResponse", "code, cont, data")
# --------------------------------------------------------------------------- #
# roughly based on https://kfalck.net/2011/01/08/autorecord-vdr-programs-via-svdrp/
class SVDRPClient:
    def __init__(self, host, port, timeout=10):
        self.telnet = telnetlib.Telnet()
        self.host = host
        self.port = port
        self.timeout = timeout
        self.encoding = 'ascii'
        self.changed_encoding = False

    def __enter__(self):
        self.telnet.open(self.host, self.port)
        self.read_greeting()
        return self

    def __exit__(self, type, value, traceback):
        self.send_command('QUIT')
        self.telnet.read_all()
        self.telnet.close()

    def _read_single_line(self):
        return self.telnet.read_until(b'\n', self.timeout)

    def read_line(self):
        line = self.decode(self._read_single_line()).rstrip('\r\n')
        if len(line) < 4:
            return None
        return SVDRPResponse(int(line[0:3]), line[3] == '-', line[4:])

    def decode(self, line):
        return line.decode(self.encoding)

    def read_greeting(self):
        code, cont, data = self.read_line()
        if not code == 220:
           raise ValueError("unexpected response")
        self.encoding = data.rsplit(';', 1)[-1].strip().lower()

    def send_command(self, line):
        logging.debug("encoding: %s", self.encoding)
        self.telnet.write((line + '\r\n').encode(self.encoding, errors="surrogateescape"))

    def read_response(self):
        cont = True
        while cont:
            l = self.read_line()
            if l.code in (221, 451, 500, 501, 502, 504, 550, 554):
                raise ValueError(l.data)
            cont = l.cont
            yield l.data

    def send_cmd_and_get_response(self, cmd):
        self.send_command(cmd)
        for data in self.read_response():
            yield data
# --------------------------------------------------------------------------- #

FPS = 25
t_sleep = 1/FPS

SECONDS = 10

with SVDRPClient('localhost', 6419) as s:
    t_last = time.perf_counter()
    for n in range(SECONDS * FPS):
        try:
            delta = (t_start := time.perf_counter()) - t_last
            if delta < t_sleep:
                 time.sleep(t_sleep - delta)
            else:
                print(f"warning: grab loop is too slow by {delta - t_sleep} s")
            print(*s.send_cmd_and_get_response(f'grab frame{n:04d}.pnm 50 1280 720'))
        except KeyboardInterrupt:
            sys.exit()
        t_last = t_start
ua0lnj commented 4 years ago

Maybe due to software scaling. You can try to remove scaling and bits converting, and see the result.

ua0lnj commented 4 years ago

Try now. No old frames for me.

seahawk1986 commented 4 years ago

I still get old frames with german DVB-T2 - unfortunately my main VDR has an unstable network connection which I still need to debug, so I won't be able to test DVB-C material until this issue is resolved.

9000h commented 4 years ago

so it's h264 vs h265

ua0lnj commented 4 years ago

In general it is very strange, screenshots are taken, they cannot be old in any way. I had to change the script, otherwise there was an error.

try: t_start = time.perf_counter() delta = t_start - t_last if delta < t_sleep:

seahawk1986 commented 4 years ago

The walrus operator (:=) was introduced in Python 3.8, you python version is probably older.

I tried a better reproducible approach to verify my suspicion - this script (based on https://bytefreaks.net/gnulinux/bash/ffmpeg-create-a-video-countdown) produces a h264 TS 720p50 video with a count-down/count-up timer (the freesoftwaresong ogg file is from https://archive.org/download/M00GNU/Moognucc-by-sa-3point0.zip, without an audio track softhddevice begins to slow down after a while during playback):

fps=50;
seconds=30;
mantissaDigits=2;
upperFont=300;
lowerFont=100;
ffmpeg -loop 1 -i black_bg_1280x720.png -i freesoftwaresong\ \(8bit\).ogg -c:v libx264 -r $fps -t $seconds -pix_fmt yuv420p -vf "fps=$fps,drawtext=fontfile='/usr/share/fonts/urw-base35/C059-Bold.otf':fontcolor=yellow:fontsize=$upperFont:x=(w-text_w)/2:y=(h-text_h)/2:text='%{eif\:($seconds-t)\:d}.%{eif\:(mod($seconds-t, 1)*pow(10,$mantissaDigits))\:d\:$mantissaDigits}',drawtext=fontfile='/usr/share/fonts/urw-base35/C059-Bold.otf':fontcolor=yellow:fontsize=$lowerFont:x=(w-text_w)/2:y=((h-text_h)/2)+$upperFont:text='Elapsed\: %{eif\:(t)\:d}.%{eif\:(mod(t, 1)*pow(10,$mantissaDigits))\:d\:$mantissaDigits}'" -c:a aac -shortest "00001.ts";

I copied the created file into the vdr recording directory ( /srv/vdr/video/local/Test/2020-10-30.12.00.4-0.rec/00001.ts) played it back and ran the python script in a tight loop to capture as many frames as possible on my machine:

with SVDRPClient('localhost', 6419) as s:
    for n in range(1000):
        try:
            print(*s.send_cmd_and_get_response(f'grab frame{n:04d}.pnm')) # 50 1280 720'))
        except KeyboardInterrupt:
            sys.exit()

In the resulting files (which i converted to jpeg for easier uploading) the frame sequence is out of order on multiple occasions, e.g.:

Frame 194 frame0194 pnm Frame 195 frame0195 pnm Frame 196 frame0196 pnm Frame 197 frame0197 pnm

ua0lnj commented 4 years ago

I can assume that this is how the softhddevice outputs, and not the problem of capturing frames with grab. Because there is nothing in the code of grab, that could create such a problem. I'll think about it.

ua0lnj commented 4 years ago

Perhaps this is due to AV synchronization. Try last commit, and if nothing has changed, comment line 13292: AudioDelayms(-diff / 90);

ua0lnj commented 3 years ago

Can you reproduce this now? For me, all works correct.

seahawk1986 commented 3 years ago

I hope I will find some time to try this within the next few days.

seahawk1986 commented 3 years ago

I built the most recent version and I am still getting old frames from time to time:

https://user-images.githubusercontent.com/935408/103479184-474fa080-4dcc-11eb-9c99-74bf899233e8.mp4

I am not sure if cuvid works correctly on my machine - building with cuvid supports looks ok:

$ dpkg-buildpackage -us -uc -b
dpkg-buildpackage: Information: Quellpaket vdr-plugin-softhddevice-cuvid
dpkg-buildpackage: Information: Quellversion 1.0.10-0yavdr0~focal
dpkg-buildpackage: Information: Quelldistribution focal
dpkg-buildpackage: Information: Quelle geändert durch Alexander Grothe <seahawk1986@gmx.de>
dpkg-buildpackage: Information: Host-Architektur amd64
 dpkg-source --before-build .
 fakeroot debian/rules clean
dh clean --with vdrplugin
   dh_auto_clean
        make -j1 clean
make[1]: Verzeichnis „/home/alexander/src/vdr-plugin-softhddevice-cuvid-1.0.10“ wird betreten
make[1]: Verzeichnis „/home/alexander/src/vdr-plugin-softhddevice-cuvid-1.0.10“ wird verlassen
   dh_clean
 debian/rules build
dh build --with vdrplugin
   dh_update_autotools_config
   dh_auto_configure
   dh_auto_build
        make -j1
make[1]: Verzeichnis „/home/alexander/src/vdr-plugin-softhddevice-cuvid-1.0.10“ wird betreten
CXX softhddevice.o
g++ -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000        -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED      -DUSE_VDR_SPU                    -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Werror=overloaded-virtual -Wno-unused-parameter -c -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000   -DUSE_PIP
-DHAVE_PTHREAD_NAME              -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -o softhddevice.o softhddevice.cpp
CC softhddev.o
cc -g -O3 -Wall -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000         -DUSE_PIP
-DHAVE_PTHREAD_NAME              -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Wdeclaration-after-statement -c -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000  -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE                 -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -o softhddev.o softhddev.c
CC video.o
cc -g -O3 -Wall -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000         -DUSE_PIP
-DHAVE_PTHREAD_NAME              -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Wdeclaration-after-statement -c -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000  -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE                 -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -o video.o video.c
CC audio.o
cc -g -O3 -Wall -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000         -DUSE_PIP
-DHAVE_PTHREAD_NAME              -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Wdeclaration-after-statement -c -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000  -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE                 -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -o audio.o audio.c
CC codec.o
cc -g -O3 -Wall -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000         -DUSE_PIP
-DHAVE_PTHREAD_NAME              -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Wdeclaration-after-statement -c -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000  -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE                 -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -o codec.o codec.c
CC ringbuffer.o
cc -g -O3 -Wall -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000         -DUSE_PIP
-DHAVE_PTHREAD_NAME              -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Wdeclaration-after-statement -c -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000  -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE                 -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -o ringbuffer.o ringbuffer.c
CXX openglosd.o
g++ -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000        -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED      -DUSE_VDR_SPU                    -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Werror=overloaded-virtual -Wno-unused-parameter -c -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000   -DUSE_PIP
-DHAVE_PTHREAD_NAME              -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED           -DUSE_VDR_SPU                   -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -o openglosd.o openglosd.cpp
LD libvdr-softhddevice.so
g++ -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE       -I/usr/include/x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu  -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -DPLUGIN_NAME_I18N='"softhddevice"' -D_GNU_SOURCE -DAV_INFO -DAV_INFO_TIME=3000        -DUSE_PIP                       -DHAVE_PTHREAD_NAME             -DUSE_TS                        -DUSE_MPEG_COMPLETE             -DH264_EOS_TRICKSPEED      -DUSE_VDR_SPU                    -DUSE_ALSA -DUSE_OSS -DUSE_VDPAU -DUSE_VAAPI -DUSE_GLX -DUSE_SCREENSAVER -DUSE_SWSCALE -DUSE_SWRESAMPLE -DUSE_CUVID -DUSE_OPENGLOSD   -g -W -Wall -Wextra -Winit-self -Werror=overloaded-virtual -Wno-unused-parameter -Wl,-Bsymbolic-functions -Wl,-z,relro -shared softhddevice.o softhddev.o video.o audio.o codec.o ringbuffer.o openglosd.o -lasound -lvdpau -lva-x11 -lva -lva-glx -lva -lGLU -lGL -lxcb-screensaver -lxcb-dpms -lswscale -lswresample -lGLEW -lGLU -lGL -lglut -lfreetype -lrt -lavcodec -lX11-xcb -lX11 -lxcb-icccm -lxcb -o libvdr-softhddevice.so
GT po/softhddevice.pot
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP \
-k_ -k_N --package-name=vdr-softhddevice --package-version=1.0.10 \
--msgid-bugs-address='<see README>' -o po/softhddevice.pot `ls softhddev.c video.c audio.c codec.c ringbuffer.c softhddevice.cpp`
PO po/ru_RU.po
msgmerge -U --no-wrap --no-location --backup=none -q -N po/ru_RU.po po/softhddevice.pot
MO po/ru_RU.mo
msgfmt -c -o po/ru_RU.mo po/ru_RU.po
PO po/de_DE.po
msgmerge -U --no-wrap --no-location --backup=none -q -N po/de_DE.po po/softhddevice.pot
MO po/de_DE.mo
msgfmt -c -o po/de_DE.mo po/de_DE.po
make[1]: Verzeichnis „/home/alexander/src/vdr-plugin-softhddevice-cuvid-1.0.10“ wird verlassen
   dh_auto_test
 fakeroot debian/rules binary
dh binary --with vdrplugin
   dh_testroot
   dh_prep
make[1]: Verzeichnis „/home/alexander/src/vdr-plugin-softhddevice-cuvid-1.0.10“ wird verlassen
   dh_vdrplugin_migrate
   dh_installdocs
   dh_installchangelogs
   dh_perl
   dh_link
   dh_strip_nondeterminism
        Normalized debian/vdr-plugin-softhddevice-cuvid/usr/share/locale/de_DE/LC_MESSAGES/vdr-softhddevice.mo
        Normalized debian/vdr-plugin-softhddevice-cuvid/usr/share/locale/ru_RU/LC_MESSAGES/vdr-softhddevice.mo
   dh_compress
   dh_fixperms
   dh_missing
   debian/rules override_dh_strip
make[1]: Verzeichnis „/home/alexander/src/vdr-plugin-softhddevice-cuvid-1.0.10“ wird betreten
dh_strip --dbg-package=vdr-plugin-softhddevice-cuvid-dbg
make[1]: Verzeichnis „/home/alexander/src/vdr-plugin-softhddevice-cuvid-1.0.10“ wird verlassen
   dh_makeshlibs
   dh_shlibdeps
   dh_vdrplugin_depends
   dh_installdeb
   dh_gencontrol
dpkg-gencontrol: Warnung: Paket vdr-plugin-softhddevice-cuvid-dbg: Substitutionsvariable ${vdr:Depends} unbenutzt, aber definiert
   dh_md5sums
   dh_builddeb
dpkg-deb: Paket »vdr-plugin-softhddevice-cuvid« wird in »../vdr-plugin-softhddevice-cuvid_1.0.10-0yavdr0~focal_amd64.deb« gebaut.
dpkg-deb: Paket »vdr-plugin-softhddevice-cuvid-dbg« wird in »../vdr-plugin-softhddevice-cuvid-dbg_1.0.10-0yavdr0~focal_amd64.deb« gebaut.
 dpkg-genbuildinfo --build=binary
 dpkg-genchanges --build=binary >../vdr-plugin-softhddevice-cuvid_1.0.10-0yavdr0~focal_amd64.changes
dpkg-genchanges: Information: Binärpaket(e) hochzuladen (kein Quellcode enthalten)
 dpkg-source --after-build .
dpkg-buildpackage: Information: Binärpaket(e) hochzuladen (keine Quelle enthalten)

softhddevice is started with those arguments:

[softhddevice]
-D
-w alsa-driver-broken
-w also-no-close-open
-v cuvid

But only vdpau is mentioned in the log:

Jan 03 13:44:59 yavdr08 vdr[1193]: audio: 'alsa' output module used
Jan 03 13:45:00 yavdr08 vdr[1193]: [1294] VNSI: Requesting clients to reload recordings list
Jan 03 13:45:00 yavdr08 vdr[1193]: audio/alsa: supports pause: yes
Jan 03 13:45:03 yavdr08 vdr[1193]: [1294] VNSI: Requesting clients to reload timers
Jan 03 13:45:03 yavdr08 vdr[1193]: audio:  44100Hz supports 1 2 3 4 5 6 7 8 channels
Jan 03 13:45:03 yavdr08 vdr[1193]: audio:  48000Hz supports 1 2 3 4 5 6 7 8 channels
Jan 03 13:45:03 yavdr08 vdr[1193]: audio: 192000Hz supports 1 2 3 4 5 6 7 8 channels
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: VDPAU API version: 1
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: VDPAU information: NVIDIA VDPAU Driver Shared Library  450.80.02  Wed Sep 23 00:46:46 UTC 2020
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: highest supported high quality scaling 1
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: feature deinterlace temporal supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: feature deinterlace temporal spatial supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: attribute skip chroma deinterlace supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: 4:2:0 chroma format with 8192x8192 supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: 4:2:2 chroma format with 8192x8192 supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: 4:4:4 chroma format with 8192x8192 supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: 8bit BGRA format with 32768x32768 supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: 10bit RGBA format with 32768x32768 supported
Jan 03 13:45:03 yavdr08 vdr[1193]: video/vdpau: created osd output surface 1920x1080 with id 0x00000009
Jan 03 13:45:03 yavdr08 vdr[1193]: video: get hwaccel context, not supported
Jan 03 13:45:03 yavdr08 vdr[1193]: audio/alsa: using device 'default'
Jan 03 13:45:03 yavdr08 vdr[1193]: audio/alsa: start delay 336ms
Jan 03 13:45:04 yavdr08 vdr[1193]: video/vdpau: can't render mixer: An invalid handle value was provided.
Jan 03 13:45:04 yavdr08 vdr[1193]: video/vdpau: missed frame (1/2)
Jan 03 13:45:04 yavdr08 vdr[1193]: [1193] skindesigner: w 1920 h 1080 mode changed to 0
Jan 03 13:45:05 yavdr08 vdr[1193]: [1239] video directory scanner thread ended (pid=1193, tid=1239)
Jan 03 13:45:05 yavdr08 vdr[1193]: video/vdpau: synced after 87 frames
ua0lnj commented 3 years ago

If you watch the picture directly, without a grab, maybe there will be the same frame jumps? This is very similar to how video/audio synchronization works, it happens to me when watching iptv. This can be disabled by commenting out line 13291 "AudioDelayms (-diff / 90);" in the video.c, for cuvid.

seahawk1986 commented 3 years ago

Live-TV and replaying recordings seems to be working fine, regardless if I am grabbing frames or not at the same time (although I don't own a HDMI-Capture device that would allow me to check single frames on the output).

Commenting out the line 13291 in video.c does not help - I don't see any messages from https://github.com/ua0lnj/vdr-plugin-softhddevice/blob/vdpau%2Bvaapi%2Bcuvid/video.c#L13290 in the syslog, so I doubt that this branch of the if-statement is reached in my case.

ua0lnj commented 3 years ago

Then this is not what I thought, I will do more tests.

ua0lnj commented 2 years ago

I seem to have found the reason. Screen capture loads the processor at 100%, so the synchronization breaks down and there may be a jump to the old frame. Check the CPU usage during the capture. I need to redo the screen capture.