AV sync issue (AppleTV 4k)

There is no comparison between Android tv and Apple TV

How does HDHomeRun app work on the same Apple TV

well, the problem is already back.

i don't know why it didn't occur to me to try the HDHomeRun app on my ATV, but i just did and i see the same problem on 9.1 KQED-HD using that app. the audio is late. as with Channels, i don't see the problem on other broadcasts. it does still remain the case that telling the appleTV to down mix to stereo fixes the problem, both in HDHR and Channels. i guess what i don't have an answer to is who, if anyone, is responsible for aligning the PTS in the audio and video. under the theory that on 9.1 the broadcast has late audio but correct PTS, the appleTV is apparently lining it all up properly when downmixing to stereo. but what happens if you are using 5.1? does it just get passed through without any PTS alignment?

Since this is your thread, and you have now identified the issue as not only occurring with Channels, but other apps, too, does this mean it is not an app–level issue?

The audio is passed through the same way in both cases, just with two channels instead of five. That would suggest the delay is downstream somewhere, but I'm not sure why it would only affect the one station then.

I may be able to pick up KQED so I'll have to try sometime.

Could be the video to audio delay offset value is wrong in the stream metadata.
Depending on what's decoding it, it may ignore the offset.
I remember one where the audio delay value was hours instead of milliseconds and some players wouldn't play the audio, while other players would.

Try to remux a problem recording and see if it fixes it.

ffmpeg -i recorded_filename.mpg -map 0 -acodec copy -vcodec copy -scodec copy recorded_filename.ts
1 Like

well, i don't know. i still don't understand how audio is supposed to be handled in general by these apps.

by this do you mean that the ATV is just picking off L and R from the transport stream and passing it along? i thought it must be down-mixing it since the sync problem seems to be fixed when the ATV is in that mode. anyway wouldn't the dialog be in the center channel and thus require down mixing?

i'll try to upload a clip. i lack the analysis tools (and the knowledge of MPEG2-TS) to understand what's going on on my own.

If you use "Surround Sound: Off" in the Channels app then we do the downmix. If you're using a system level setting then yes the OS would be downmixing in that case.

ok i'm talking about the setting in the appleTV itself. there's a menu for the audio output format, and it (after an "are you sure?" dialog) lets you change to 5.1 or stereo (vs. 'Auto').

i'll see what the channels setting does in this situation.

i guess if the broadcast has shifted audio but correct PTS then maybe there's no way to fix this, as it seems that when using 5.1 the audio is just being demuxed and sent right to the device. given that other channels work fine, it seems to me this has to be what's going on.

Yea it is suspicious. It would be worth giving the station engineer a call.

i put in a trouble ticket on their website yesterday. no response yet. need to generate a new clip for analysis and try ffmpeg to remux the recording.

so the KQED engineering staff says they did put a new encoder in a little while back, and they had one other report of this problem, though they don't know if that person was also using 5.1 audio. their transport stream analyzer is offline and so they haven't been able to analyze what is going on.

i guess probably very few people use OTA and surround sound receivers? i would have thought they would have been flooded with comments about this. well, we'll see what they say going forward.

well, here is an update. i've exchanged a few emails with the KQED engineering contact and it seems they still have not been able to run the stream analysis. regardless they seem to think that this is not a widespread problem.

i finally got VLC working properly on the appleTV and able to stream video from a server. when i play a 'bad' recording made after the KQED encoder change, i observe a ~2.5s pause in the video as the clip starts, with the audio starting right away. the audio is then in sync with the video. when i play a recording made before the encoder change, i see about a 1.8s pause in the video, and the audio is again synchronized properly. looking at a completely different channel (KGO), there is a similar pause in the video, perhaps closer to 1.5 seconds, as the video starts. all of these video delays imply to me that VLC is trying to align the video and the audio in the stream. interestingly VLC does not seem to be down mixing the audio at all - i can hear stuff in the surround speakers when it is playing the clips.

remuxing the "bad" recording per @chDVRuser post above, the startup pause in the remixed clip is again closer to 1.8s. the AV sync is fine in VLC on the remuxed clip.

i haven't tried to play these snippets in channels. i suppose if channels doesn't try to align the video and audio, then KQED's stream, although likely a legal transport stream, is what's causing the problem.

here are the 3 clips in question - before the encoder switch, before the encoder switch and remuxed with ffmpeg, and after the encoder switch, if anyone wants to take a look. i see there is something called TSDuck out there which might be useful in analyzing these things but i haven't looked into that yet.

https://drive.google.com/drive/folders/1a4lQ-agbG6e2sWMlhc5TAlqYKucQJD-u?usp=share_link

@tmm1 did you happen to have time to look at these ts files? based on the behavior in VLC i wonder if channels could do something about this late audio.