Video/voice lags every few seconds after update

you are right but what can i do?
It’s only on this SD video, not on an HD video!
Why is there one core on 100%?
Normally i can record two videos and play one on the same time without problems!

strace first process with 100%:

gettimeofday({1440445318, 44275}, NULL) = 0
read(22, 0x7ef956c0, 4112)              = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 958567458}) = 0
read(20, 0x76f4d000, 4096)              = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 959309542}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 960154490}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 960573917}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 960825375}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 961255115}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 961506208}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 961741886}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 962102458}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 962446938}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 962692979}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16530, 962930583}) = 0
clock_gettime(CLOCK_REALTIME, {1440445318, 49445047}) = 0
futex(0x154c98c, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1977, {1440445318, 149445047}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 63729636}) = 0
futex(0x154c9b8, FUTEX_WAKE_PRIVATE, 1) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 64164271}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 64381511}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 64617240}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 64958178}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 65187448}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 65399011}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 65607501}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 65829584}) = 0
gettimeofday({1440445318, 152248}, NULL) = 0
read(22, 0x7ef956c0, 4112)              = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 66611041}) = 0
read(20, 0x76f4d000, 4096)              = -1 EAGAIN (Resource temporarily unavailable)
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 67260729}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 68213958}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 68501770}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 68766093}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16531, 69110468}) = 0
nanosleep({0, 35000000}, NULL)          = 0

strace second process with approx 75%:

clock_gettime(CLOCK_MONOTONIC_RAW, {16689, 383290210}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16689, 383665991}) = 0
futex(0x4607884, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x46078b8, 3704) = 1
futex(0x46078b8, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x46078b8, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x46078d8, FUTEX_WAKE_PRIVATE, 1) = 1
clock_gettime(CLOCK_MONOTONIC_RAW, {16689, 384527450}) = 0
clock_gettime(CLOCK_MONOTONIC_RAW, {16689, 392102709}) = 0

first process:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
58.57   46.828568        3874     12089      1781 futex
14.68   11.740000      122292        96           select
11.29    9.026202        2167      4165           nanosleep
9.84    7.870000       26769       294           poll
3.00    2.395956       46076        52           recv
2.57    2.058303        1249      1648           ioctl
0.02    0.019794           1     23764           clock_gettime
0.01    0.007104          22       320       286 read
0.01    0.005914         227        26           send
0.00    0.002093        1047         2           sendto
0.00    0.001670           5       343           gettimeofday
0.00    0.000000           0         2           write
0.00    0.000000           0         1           munmap
0.00    0.000000           0        18           mprotect
0.00    0.000000           0        33           _llseek
0.00    0.000000           0       169           sched_yield
0.00    0.000000           0        19           mmap2
0.00    0.000000           0        32        32 stat64
0.00    0.000000           0        14           recvfrom
0.00    0.000000           0         1           sendmsg
0.00    0.000000           0         2         1 recvmsg
------ ----------- ----------- --------- --------- ----------------
100.00   79.955604                 43090      2100 total

second process:

root@osmc:~# strace -p 1049 -c
Process 1049 attached
^CProcess 1049 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
91.10    0.001853           1      2260        81 futex
5.06    0.000103           1       105           ioctl
3.83    0.000078           0     13233           clock_gettime
------ ----------- ----------- --------- --------- ----------------
100.00    0.002034                 15598        81 total

If it’s only this video, it would be wise to provide mediainfo on it. There are instructions on how to do so in my necessary info sticky.

1 Like

Every day it’s a new news recorded video from KIKA-TV “logo! Die Welt und ich.” (logo! Die Welt und ich…ts) for children.

root@osmc:/home/osmc/tvheadend# mediainfo logo!\ Die\ Welt\ und\ ich…ts
General
ID : 1079 (0x437)
Complete name : logo! Die Welt und ich…ts
Format : MPEG-TS
File size : 480 MiB
Duration : 13mn 28s
Overall bit rate mode : Variable
Overall bit rate : 4 978 Kbps

Video
ID : 310 (0x136)
Menu ID : 28008 (0x6D68)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=12
Format settings, picture structure : Frame
Codec ID : 2
Duration : 13mn 27s
Bit rate mode : Variable
Bit rate : 3 827 Kbps
Maximum bit rate : 15.0 Mbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Active Format Description : Letterbox 16:9 image
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.369
Stream size : 369 MiB (77%)

Audio #1
ID : 320 (0x140)
Menu ID : 28008 (0x6D68)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 4
Duration : 13mn 28s
Bit rate mode : Constant
Bit rate : 256 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -572ms
Stream size : 24.7 MiB (5%)
Language : German

Audio #2
ID : 321 (0x141)
Menu ID : 28008 (0x6D68)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 4
Duration : 13mn 28s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : -572ms
Stream size : 18.5 MiB (4%)

Audio #3
ID : 325 (0x145)
Menu ID : 28008 (0x6D68)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 13mn 28s
Bit rate mode : Constant
Bit rate : 448 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Delay relative to video : -455ms
Stream size : 43.2 MiB (9%)
Language : German

Text
ID : 331 (0x14B)
Menu ID : 28008 (0x6D68)
Format : DVB Subtitle
Codec ID : 6
Language : German

Menu
ID : 300 (0x12C)
Menu ID : 28008 (0x6D68)
Duration : 13mn 28s
List : 310 (0x136) (MPEG Video) / 320 (0x140) (MPEG Audio, German) / 321 (0x141) (MPEG Audio) / 325 (0x145) (AC-3, German) / 331 (0x14B) (DVB Subtitle, German)
Language : / German / / German / German
Service name : KiKA
Service provider : ZDFvision
Service type : digital television

@michaMEG
Where are you playing the file from? local network/sdcard/internet?
I’m playing the “logo!” file here and have low cpu with omxplayer or mmal.
I need to work out how to reproduce the high cpu before I can try to fix it.

From local sdcard

  • First the raspi is recording “logo / SD” from 7:50 to 8:05 a clock then “tagesschau / HD” (from an other station) from 8:00 to 8:20
  • after recording both the “logo” video is jerking / the “tagesschau” video and other SD/HD (from an other stations) videos are Ok.
  • after reboot the “logo” video is Ok!?

Hardware:

  • Raspberry PI 2 Model B (without overclocking)
  • Sundisk microSDXC Ultra 64GB, Class 10, UHS-I, 48MB/Sec
  • original 2A raspi power supply
  • D-Link USB 2.0 4-Port Hub
  • Sundtek MediaTV Pro III (DVB-C)
  • Sundtek MediaTV Pro I (DVB-C)

I also have the same problem with sound lagging for some secounds, I am useing the SPDIF module here:

https://www.raspberrypi.org/forums/viewtopic.php?f=100&t=93522

And I upgrated to the newest OSMC version.

Here is the log so hope anyone can help me with fixing this problem :smile:

http://paste.osmc.io/odefayepat.vhdl

I have tried both with wifi and cable, but still the same.

With the new version it’s the same … :worried:

I think there is also an memory leak:

  • First the raspi is recording “logo / SD” from 7:50 to 8:05 a clock
  • then “tagesschau / HD” (from an other station) from 8:00 to 8:20
  • playing short the jerking “logo”
  • playing “tagesschau” (without jerking) / also recording an other SD-Video (not from kika)
  • near the end of “tagesschau” (15 minutes) the raspi slow down and the memory is 100% in use
  • reboot: everything is normal

I don’t know why but recording with “Stream Profile: matroska” is an workaround for my problem!

Hi there,

I’ve had this or a similar issue. I have TVHeadend running on the same machine as OSMC.
What fixed my problem: in PVR Addon settings of TVHeadend client, I had to point at 127.0.0.1 rather than the network adress of my machine.

Of course, this is not update related as I first thought. However, it might help anyone else around here.

Best wishes

This might be coming a bit late, I recently had a similar issue and after trying just about every option provided here, i realised that the issue only occurred when i was watching SD TV contents, and the CPU usage was around 80% average, while HD TV contents streamed fine with average usage of 20%. This really got me wondering how that was possible, HD should require more power than SD.

Then i realised the codec purchased for video and audio, werent added to config.txt file after reformatting my sdcard, this by my understanding controls the usage of onboard GPU instead of CPU, which was while i was having the delay. After adding it, normalcy was restored to my world lollll.