android-tvheadend icon indicating copy to clipboard operation
android-tvheadend copied to clipboard

Stuttering while audio track changes on the fly

Open xi784 opened this issue 7 years ago • 28 comments

Example: Change from commercials to movie from stereo 2.0 to ac3 5.1, video begins to stuttering, channel change helps.

xi784 avatar Mar 10 '17 20:03 xi784

Could you record a piece of video that does this?

I've not seen this happen on any of my channels, but a few folks have reported it.

Details on how to record @ https://github.com/kiall/android-tvheadend/wiki/Muxdump

Does it recover on its own, or just continue stuttering?

kiall avatar Mar 10 '17 20:03 kiall

Just continue stuttering or gets totally freezed.

Will take a muxdump on the next break.

xi784 avatar Mar 10 '17 20:03 xi784

ok muxdump will be a problem because CA in use.

xi784 avatar Mar 10 '17 20:03 xi784

Humm, my understanding is it'll be decrypted by the to e you record the muxdump? I think.

kiall avatar Mar 10 '17 20:03 kiall

If i try to record the mux directly, ca doesn´t get active. What makes sense, because TVHeadend doesn´t know the pid.

xi784 avatar Mar 10 '17 20:03 xi784

Will take a dump via streamrecording, maybe that helps

xi784 avatar Mar 10 '17 21:03 xi784

Yea, try using the "pass" profile for DVR? It might work, I've not tried! Anything is better than nothing I'm sure though :)

Failing that, access to your TVHeadend server for a few hours if remote access can work? (With some pointers to content that does this. .)

kiall avatar Mar 10 '17 21:03 kiall

got it: https://drive.google.com/drive/folders/0BxP1VJf8kaXoNU1SQkFDbHFiZlE?usp=sharing On 1:00 +/- it changes from stereo to 5.1

xi784 avatar Mar 10 '17 21:03 xi784

That would be not a problem, would have only to persuade my special "Telekom Hybrid Router" :) Tomorrow i will set this up, for future problems.

xi784 avatar Mar 10 '17 21:03 xi784

Okay, so I can see this sample definatly contains a layout switch:

# ffprobe -select_streams a -show_frames sample.ts 2>&1 | grep channel_layout | sort | uniq -c
   1126 channel_layout=5.1(side)
   1997 channel_layout=stereo

Both sides of the switch appear to play OK individually (convincing TVHeadend to pass through the right parts of this stream without editing the file was... challenging), however when played continuously across the boundary, it's clearly stuttering.

The app log little more than this:

03-11 17:56:00.143 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 83488000, got 83232011]
03-11 17:56:00.529 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 83616011, got 83360011]
03-11 17:56:00.911 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 83744011, got 83488011]
03-11 17:56:01.297 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 83872011, got 83616011]
03-11 17:56:01.674 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84000011, got 83744011]
03-11 17:56:02.059 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84128011, got 83872011]
03-11 17:56:02.446 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84256011, got 84000011]
03-11 17:56:02.828 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84384011, got 84128011]
03-11 17:56:03.214 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84512011, got 84256011]
03-11 17:56:03.597 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84640011, got 84384011]
03-11 17:56:03.982 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84768011, got 84512011]
03-11 17:56:04.366 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 84896011, got 84640011]
03-11 17:56:04.752 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85024011, got 84768011]
03-11 17:56:05.140 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85152011, got 84896011]
03-11 17:56:05.517 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85280011, got 85024011]
03-11 17:56:05.902 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85408011, got 85152011]
03-11 17:56:06.287 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85536011, got 85280011]
03-11 17:56:06.671 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85664011, got 85408011]
03-11 17:56:07.057 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85792011, got 85536011]
03-11 17:56:07.440 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 85920011, got 85664011]
03-11 17:56:07.818 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86048011, got 85792011]
03-11 17:56:08.205 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86176011, got 85920011]
03-11 17:56:08.589 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86304011, got 86048011]
03-11 17:56:08.973 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86432011, got 86176011]
03-11 17:56:09.362 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86560011, got 86304011]
03-11 17:56:09.739 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86688011, got 86432011]
03-11 17:56:10.125 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86816011, got 86560011]
03-11 17:56:10.513 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 86944011, got 86688011]
03-11 17:56:10.900 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 87072011, got 86816011]
03-11 17:56:11.275 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 87200011, got 86944011]
03-11 17:56:11.658 3466-14014/ie.macinnes.tvheadend E/AudioTrack: Discontinuity detected [expected 87328011, got 87072011]

kiall avatar Mar 11 '17 17:03 kiall

No one said it would be easy, but it had to be done.. :)

xi784 avatar Mar 11 '17 18:03 xi784

I have this problem as well, using TVheadend Live Channels on a Sony Bravia XD8505 with Android-TV 6.01 as frontend. I´m loosing the HW acceleration every time commercial breaks movies. Channel change will bring it back. Using a Ubuntu server with Tvheadend 4.1-2405 as backend.

Vispen74 avatar Mar 11 '17 18:03 Vispen74

So, what devices are you two on? Shield? Nexus Player? etc

kiall avatar Mar 11 '17 18:03 kiall

Also - Can you give this build a go? Once installed, re-run setup to get to the preferences, then disable the FFMpeg Audio Renderer, and see if that helps? It seems to have helped for me:

https://dl.dropboxusercontent.com/u/1400487/VID_20170311_183826.mp4

http://jenkins.macinnes.ie/job/android-tvheadend/job/master/52/ - download the "-release.apk", not the "-debug.apk"

Assuming it works for you too, and not just on the recorded sample I have, I can start digging into the issue...

kiall avatar Mar 11 '17 18:03 kiall

The TV is occupied by family this evening, will give the build ago tomorrow and report back.

Vispen74 avatar Mar 11 '17 18:03 Vispen74

Have checked this, Nexus Player and shild as well.. ok Kiall, i will test it

xi784 avatar Mar 11 '17 18:03 xi784

if you need access to my tvheadend, we need to pm .. e.g. skype, hangouts or something else.

Channel RTL2 is perfect for testing now.

xi784 avatar Mar 11 '17 18:03 xi784

I think I'm OK without access, the muxdump you provided reproduces the issue, just want to get a sanity check before spending more time chasing a possible red herring ;)

kiall avatar Mar 11 '17 18:03 kiall

hehe .. ok :)

xi784 avatar Mar 11 '17 18:03 xi784

Possibly related to #117

kiall avatar Mar 11 '17 19:03 kiall

Ok.. when disable the FFMpeg Audio Renderer: On Nexus Player only get Streaming by channels with stereo but without audio Channels with 5.1 dont start.

On Shield the same but streaming starts with "unsupported audio track" on 5.1 content.

xi784 avatar Mar 11 '17 19:03 xi784

Humm. Could you grab some logcat's from the devices as you change onto these channels? (annotated with what device and what the issue was!)

kiall avatar Mar 11 '17 19:03 kiall

Or - If you know how IRC works, join #android-tvheadend on FreeNode and can PM me server details there to have a check myself - that said, I likely won't get to login + test today...

kiall avatar Mar 11 '17 19:03 kiall

ac3_new.zip Shield log - mediacodecinfo unsupported while ffmpeg disabled

Did some channel changes for more details

xi784 avatar Mar 12 '17 20:03 xi784

So, this appears to be an ExoPlayer (or FFMpeg?) bug, I've filed a bug with ExoPlayer google/ExoPlayer#2552.

For now, as a workaround, if your Android Box, TV itself, or audio receiver (if you have one) supports native AC3 decoding, then running through the app setup, disabling the FFMpeg extension in the settings, and rebooting for the changed setting to take effect should workaround the issue.

kiall avatar Mar 12 '17 23:03 kiall

and reproduces too on:

  • Nexus Player 7.1.1 (NMF26X)
  • Sony Bravia XD8505 (AndroidTV 6.01)

xi784 avatar Mar 13 '17 09:03 xi784

5e9e468052bfda71d886b8d05157600d1fbec9f2 re-orders things a little, if you're on a device with a native AC3 decoder, that will now be used instead of FFmpeg, and this issue should disappear.

However, very few devices actually ship an AC-3 decoder (even the more $$ ones, like the Shield)

kiall avatar Mar 14 '17 20:03 kiall

Think we have to reopen it, same issue on layout switch 2ch to 5.1 and back again. Picture gets stuttering and freeze.

Channel change helps and passthrough audio.

sample.ts approx sec 40~ https://drive.google.com/file/d/0BxP1VJf8kaXoSkpidGFpMURkMzg/view?usp=sharing

using develop build #.23

xi784 avatar Jul 24 '17 22:07 xi784