v17 A/V sync method
#1
Hello,

in old kodi version there was an option available "A/V sync method" when "sync playback to display" was enabled.
This option seems to be removed in kodi 17 because I cannot find it.
For me it seems that kodi 17 will just resample the audio in kodi 17.
But I want to avoid resampling because this causes strange sound because I can hear that the sound is running to slow or to fast.
I also have a high end hifi system and I definitly want to avoid resampling to get out the most quality of audio.
Is there a way in kodi 17 and above to change the A/V sync method to Video Clock(Drop/Dupe Audio) as in the old kodi version?
Reply
#2
See thread here https://forum.kodi.tv/showthread.php?tid=307165
Reply
#3
ok. Thats very bad in my case. I can only get smooth playback for 23.976 with "sync playback to display".
But then the sound gets resampled which does not sound very good. It´s definitly hearable on a high end audio system.
Isn´t there a way to get an smooth playback with keeping the pcm signal untouched (no resampling)?
Reply
#4
Which hardware are you using? Which devices are in the chain and how are those connected?
Reply
#5
I am using a Core i3 (Hashwell) with an Nvidia (GTX 970) garphics card on up-to-date Ubuntu 17.04 with latest Nvidia graphics driver (381.09) and Kodi 17.3.
As sound card I am using a 8 channel analog PCIx sound card (Marian Seraph 8) as output device connected to "Audionet MAP I" Analog AV-Preamp.
The MAP I is connected to 6 Mono-Amps powering my 5 speakers and 1 subwoofer.

I am using a custom modeline in xorg.conf for 23.976 playback which will run at 23.97606 frames:
"1920x1080_23.976" 74.11 1920 2557 2602 2750 1080 1084 1089 1124 +hsync +vsync

In kodi I have "vdpau" enabled and "adjust refresh rate to video" enabled. As deinterlacing I am using "temporal spartial" with "lanzos 3 optimized".
As audio options I am not using passthrough because the sound card cannot decode dtshd/truehd. So kodi will do the decoding.

The refresh rate change is working correctly and will change it to the custom modeline (I can see it by pressing "z" which shows me a refresh rate of 23.98hz).
So in general the setup is working so far. Only without "sync playback to display" I will get some stuttering every few seconds while playing a 23.976 file. During Playback I
can then see the following message in the kodi logfile:

19:36:27.268 T:139770364692224 DEBUG: CDVDClock::ErrorAdjust - CVideoPlayerAudio::OutputPacket - error:-20774,547515, adjusted:-20774,547515

When I activate "sync playback to display" the video is working flawless, but then sound is getting resampled. I can hear it in two ways:
- Sound is getting to slow or to fast (you can hear it that the sound is getting brighter or darker for some seconds)
- Sound quality is not on the same level than without resampling.

So is there a solution to get video playback without stuttering without touching the audio Signal (sync Playback to Display)?
Reply
#6
FYI, Nvidia 384.xx is out by now for more than a week ;-)
See https://launchpad.net/~graphics-drivers/...ubuntu/ppa
Not it will change that much, I'm afraid.
Reply
#7
ok just tested nvidia Driver 384.47. The behaviour is the same. Without "sync Playback to Display" it´s not smooth.
With "syn Playback to Display" it´s smooth but Sound getting resampled.
Any way to do this without resampling?
Reply
#8
If there is no solution to do it without resampling, maybe using high quality sox resampler to improve quality?
I have used sox on my stereo system with great success. As far as I know you are using ffmpeg for resampling or?
It´s now possible to use sox with ffmpeg. Its also possible to set sox resample quality via ffmpeg.
Maybe set precision to 28 for very high quality (I also used VHQ in my stereo system).
I think sox with VHQ should be big step forward in case of resample quality.

https://trac.ffmpeg.org/wiki/FFmpeg%20an...0Resampler
http://www.transcoding.dk/2011/11/16/car...ng-ffmpeg/

Maybe it´s possible to add a drop down box in the kodis audio settings which resampler to use (sox/ffmpeg) or maybe use sox VHQ as default when the option "quality of resampling" (which as far as I know already there) is set to high and use default ffmpeg when low is selected?
Reply
#9
Nvidia has this year long problem that it cannot get a proper 23.976 mode - our wiki has the workaround since these 5 years. Please add the modeline manually and be happy afterwards :-)
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#10
I think you didn´t read my posts properly. I already have a custom modeline which does not solve the problem. "Sync playback to display" is still necessary which leads to resampling.
Reply
#11
Photo 
Independent form the topic that it would be nice to get smooth playback without resampling,
do you think there is a way to include sox-resampling via ffmpeg in kodi (see my links above)?
Maybe activate it over an advancedsettings entry. So at default swr from ffmpeg as resampler will still be used.
Audiophile ones can then maybe switch over advancedsettings to soxr.

There is definitly a big improvement in sound quality by using sox instead of swr over ffmpeg.

On the following link a guy did some resampler comparing.

http://src.infinitewave.ca/

I didn´t get it working adding a picture here.
So just go to the mentioned url and select "ffmpeg 1.1.1 (soxr)" and "ffmpeg 1.1.1 (swr)" to compare. Then you should see sox is definitly the better resampler.

I also had a look at the kodi source code.
I already change some files for testing to activate soxr when "high" for quality of resampling is selected.

./xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResampleFFMPEG.cpp

Code:
if(quality == AE_QUALITY_HIGH)
  {
    av_opt_set_double(m_pContext,"cutoff", 1.0, 0);
    //av_opt_set_int(m_pContext,"filter_size", 256, 0);
    av_opt_set(m_pContext,"resampler", "soxr", 0);
    av_opt_set_int(m_pContext,"precision", 28, 0);
    av_opt_set_int(m_pContext,"linear_interp", 1, 0);
  }
  ...
  if (m_dst_fmt == AV_SAMPLE_FMT_S32 || m_dst_fmt == AV_SAMPLE_FMT_S32P)
  {
    // av_opt_set_int(m_pContext, "output_sample_bits", m_dst_bits, 0);
  }

and ./tools/depends/target/ffmpeg/autobuild.sh

Code:
--enable-libsoxr \

and ./tools/depends/target/ffmpeg/CMakeLists.txt
Code:
--enable-libsoxr

then installed libsoxr-dev on my ubuntu system and compiled kodi again.
Build where succesfully but I will not get sound when resampling with quality=high is active in kodi.
I think there is something or bit more Huh missing.
I think I dont have the coding skill to do this.
Maybe the kodi-team is interested in implementing this?
I would also help as far as I can with my limited skills or maybe just for testing.
Reply
#12
sox won't help you a single bit. What you hear is the compensation, e.g. the tone going shortly up or down, that will be the very same with sox.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#13
(2017-07-21, 06:54)steo86 Wrote: I think you didn´t read my posts properly. I already have a custom modeline which does not solve the problem. "Sync playback to display" is still necessary which leads to resampling.

Most of the time I skip the wall of text and concentrate on the (here non existing) Debug Log
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#14
I know that sox wont help regarding the speedup an down. But in case of sound quality of resampling it will help. So it´s independent from this thread.
In my opinion it would be nice to implement sox as resampler. Maybe I should open a extra thread for that topic.
Reply
#15
Heres a logfile if it would help:

https://pastebin.com/DHTAKgxx
Reply

Logout Mark Read Team Forum Stats Members Help
A/V sync method0