Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio tracks not handled correctly on LiveTV #3170

Closed
lukee7 opened this issue May 3, 2014 · 49 comments
Closed

Audio tracks not handled correctly on LiveTV #3170

lukee7 opened this issue May 3, 2014 · 49 comments

Comments

@lukee7
Copy link

lukee7 commented May 3, 2014

I'm using Openelec 3.95.7 generic on a Zotac AD02. With IPTV Simple Client I am watching LiveTV. All Openelec4 betas seem to have one issue: not correctly detecting audio channels.

If I press the "info" button, Openelec is always showing "0.0" as channel configuration - but it is playing an audio channel.

My provider's streams contain 3 tracks (5.1, 2.0 and teletext). Openelec seems to select one of it randomly. Sometimes it chooses the teletext-track... ;)

Additionaly I can't manually change the track. In the audio options openelec is showing "None" instead of the tracks.

If I play an M3U file with one of the streams in it, everything works perfect and as expected!

"Screenshot" here: http://1drv.ms/1fYJfv0
Logfiles here: http://1drv.ms/1q1j93Z

Some new debug log with Openelec 4.0.7: http://1drv.ms/1mDblCK
XBMC-Log: http://sprunge.us/DNSB

@mister-bogus
Copy link

This problem is still present in the latest sources from github, and is related to the patch from FernetMenta and others discussed here: xbmc/xbmc#3590. In order to speed the channel switching the stream is not analysed by not calling avformat_find_stream_info(), but ffmpeg then produces lots of decoding errors on the teletext stream as seen here: http://pastebin.com/RE3hBuiW. The ffprobe result on my the stream gives this:

Program 1
Metadata:
service_name : x
service_provider: x
Stream #0:0[0x65]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 720x576 [SAR 16:11 DAR 20:11], 50 tbr, 90k tbn, 50 tbc
Stream #0:10x115: Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Stream #0:20x12d: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 83 kb/s
Stream #0:30x12e: Audio: aac, 48000 Hz, stereo, fltp, 83 kb/s

As mentioned by the OP the URL in the format of rtp://234.168.40.10:10000 inside a .strm file works perfectly, but when passed from IPTVSimple PVR addon it does not. The developer of the addon has indicated that his addon is just passing the URL of the stream and not processing it in any way.

@fritsch
Copy link
Contributor

fritsch commented Jul 14, 2014

@FernetMenta The patch that is referenced in this bugreport and via the upstream PR: xbmc/xbmc#3590 - do you have an idea to not come up with teletext as audio tracks?

From my reading it seems backends without own demuxer are affected.

@lukee7
Copy link
Author

lukee7 commented Jul 14, 2014

I made some new debug logfiles on Openelec 4.0.7:

debug logs: http://1drv.ms/1mDblCK
xbmc log only: http://sprunge.us/DNSB

@FernetMenta
Copy link

The GUI should ask decoder not demuxer for audio info. We have a similar problem with some DTS formats where info show on screen may be wrong because only the DTS core is used.

@FernetMenta
Copy link

I will have a closer look end of this week.

@lukee7
Copy link
Author

lukee7 commented Jul 20, 2014

Even worse with Openelec 4.1.1. Openelec tries to play the teletext track which gives a horrible noise out of the speakers.

xbmc.log w/ debug enabled: http://sprunge.us/SBXa

@FernetMenta
Copy link

i this is the case PAT/PMT is corrupted. you log shows:
13:43:59 T:140673466496768 DEBUG: ffmpeg[17FFF700]: RTP: missed 222 packets
13:43:59 T:140673466496768 DEBUG: ffmpeg[17FFF700]: [rtp] PES packet size mismatch

which indicated issues with this stream.

I can't reproduce on stream having proper pat/pmt

@lukee7
Copy link
Author

lukee7 commented Jul 20, 2014

Can/should I provide a sample of the stream? Or do I simply have to realize that I cannot use Openelec >=4 for watching LiveTV?

@FernetMenta
Copy link

please provide a sample.

@lukee7
Copy link
Author

lukee7 commented Jul 20, 2014

Can I record a sample from my OE box? Or maybe from a windows pc with VLC?

I have no exoerience with recording streams untouched,

@schumi2004
Copy link

Record using build in record function and share recording would be my guess.

@lukee7
Copy link
Author

lukee7 commented Jul 20, 2014

When I record it simply with VLC not everything is being recorded. At least the teletext-track and some other extended information is not in the stream anymore. Here the original streaminfo while playing it in VLC:
streaminfo

And here the vlc recorded stream: http://bit.ly/1sBQ2Vq (available for 1 week I think...)

@schumi2004
Copy link

Maybe share your live tv connection to a dev for better trouble shooting is an option?

@FernetMenta
Copy link

The sample provided shows no issues with find_stream_info skipped.

@lukee7
Copy link
Author

lukee7 commented Jul 21, 2014

@FernetMenta I guess that's because the teletext-track hasnot been recorded by VLC :-/
@schumi2004 Unfortunately I cannot provide access to the streams, as I pay for that service. You can try, but I think/hope rtp://239.2.16.1:8208 will not be available for public - otherwise I would be an idiot paying for it ;-)

I can offer SSH connection to my OE box if that helps. Or anyone has an Idea how to record the stream as-is, without removing teletext?!

@FernetMenta
Copy link

I doubt that this is related to teletext. your last log indicated that mp3 audio was opened. @fritsch can you provide a build based on Helix with most recent changes of my master?

@lukee7
Copy link
Author

lukee7 commented Jul 21, 2014

What I experience on the GUI is, that the "codec info overlay" shows "0.0 channels" in this case and I also cannot show teletext. But if openelec catches the right audio track, it shows "5.1 channels" or "stereo" and teletext is working.

This led to my guess, that it sometimes (presumably in 33% of the time) tries to play the teletext-track...

@FernetMenta
Copy link

I am almost sure that your rtp streams lacks pat/pmt. If it had pat/pmt we would get a stream change and streams would be created at once. Have a look into your log between those lines other thinks happen:
CDVDDemuxFFmpeg::AddStream(0, ...) -> 0

I do hard in creating a solution for this odd case without having access to a sample. Either some rtp source of a raw dump of this stream.

@mister-bogus
Copy link

I have uploaded another sample here http://we.tl/JPYbXQG317 (available for 7 days). This was recorded using VLC, it includes teletext. If still does not help I can try to record from my OE box.

@schumi2004
Copy link

Not sure if this is related but last night i experienced the same thing, or sort of.
On 1 specific channel the audio was gone when commercials started and came back when commercials ended. Not such a big deal since i hate commercials but maybe it's the same issue? Don't have this issue on other channels as far as i could see.
Running OE 4.2 beta 1 (noticed it before in previous builds) on a AD02 (Zotac) with TVHeadend as backend.

@jenkins101
Copy link
Contributor

@FernetMenta I managed to remove your message... sorry!

@schumi2004 I think your last problem is an issue of tvh. tvh has its own demuxer. it needs to detect the change from 5.1 to stereo which in general happens on commercial breaks. then it needs to inform player with a special message to trigger re-open of audio decoder.

@FernetMenta
Copy link

@mister-bogus your problem seems also different to the one OP has. ffmpeg demuxer does not update channel number for AAC. This is only done by decoder. A solution for what I first posted in this thread.

@mister-bogus
Copy link

@FernetMenta if I change the line (in your patch):
return IsUDP(strFile) || IsTCP(strFile) || IsPVRChannel(strFile);
to
return IsUDP(strFile) || IsTCP(strFile);
Then all tracks are properly identified in my stream. I know that may break something else but I wanted to let you know.

@FernetMenta
Copy link

this disables the entire patch and channel switching times may go up to 8 seconds on certain streams. your issue is fixed by FernetMenta/xbmc@ed4f59a

@mister-bogus
Copy link

Great, thanks a lot. I would like to test it, how can I add this as patch in the OpenELEC sources to compile myself, like in xbmc-995.01-fernetmenta-fixesxbmc-995.01-fernetmenta-fixes.patch?

@FernetMenta
Copy link

I don't know how to build OE. Someone from the OE dev team needs to assist @sraue, can you help?

@lukee7
Copy link
Author

lukee7 commented Jul 22, 2014

I managed to do a "raw data dump" with VLC player. It should contain all video/audio tracks like the real stream.
As OE doesn't fail all the time, the moment of jumping into the stream might also be critical?!
Here it is (7 days available): http://bit.ly/1nRQBTo

@FernetMenta
Copy link

you sample shows no issues here. nevertheless this patch might fix the issue: FernetMenta/xbmc@db0490a

@mister-bogus
Copy link

@FernetMenta, thank you so much!!! I have tested your patch and it works great. Took me awhile to figure git out but I managed to compile OE 4.0.7 with your modifications, I even included the one for the lack of pat/pmt. Hopefully this gets included by @sraue in the next OE 4.2.
@mcluki I can provide you with my release in case you want to give it a try. Or the patch file if you need to compile for another platform, I did Generic X86_64.

@lukee7
Copy link
Author

lukee7 commented Jul 24, 2014

@mister-bogus Generic x86_64 is perfect...I would pay for it ;-) Can you provide a download-link?

@mister-bogus
Copy link

@mcluki here you go (valid for 7 days): http://we.tl/9JGhP9DXBc

@lukee7
Copy link
Author

lukee7 commented Jul 26, 2014

@mister-bogus @FernetMenta Thank you guys. That patch seems to fix my issue too. I only tested it for two minutes but I can see one main difference => I can choose/switch the audio tracks again. That was not possible with any 4.x version at all!

@lukee7
Copy link
Author

lukee7 commented Nov 30, 2014

In OE 5 betas the issue reappeared. Same like before, no audio track to choose at all...but sometimes one is played randomly.

@lukee7
Copy link
Author

lukee7 commented Dec 2, 2014

@FernetMenta Some more information after a debug session with @stefansaraev:

  1. rtp://@239.2.24.2:8208 via pvr - not working (no audio tracks detected, but playing one randomly)
  2. rtp://@239.2.24.2:8208 via PlayMedia() - fine
  3. http://127.0.0.1:82/rtp/239.2.24.2:8208 via udpxy -> pvr - fine.

Logfiles:

  1. stream via PVR: http://sprunge.us/YLTI
  2. stream via udpxy -> pvr: http://sprunge.us/UadB (EDIT by @stefansaraev this one actualy works)

Hope that helps!

@FernetMenta
Copy link

what exactly is the issue? the log shows that audio plays. if you think that there is something wrong please elaborate on it. what would you have expected and where exactly (line numbers) in the log did it happen. I don't have a crystal ball :)

@stefansaraev
Copy link
Contributor

@FernetMenta I believe its something related to the "fastchannelswitch" thingie.

@mcluki says hecant select "audio track" via osd -> audio. (none shown) but random track playing (he has few)

playing the (rtp, multicast) stream directly, not via pvr but via strm/m3u file or PlayMedia() builtin is fine. all audio tracks shown and can be changed. it's just livetv broken :(

playing the SAME stream but "proxied" via udpxy (udp/rtp multicast to http proxy) is fine in both pvr and PlayMedia(). udpxy does some internal "buffering".

unfortunately, I cant reproduce atm, as everything I have here is http (mpegts coming via udpxy from few streaming servers I manage). will try to set up something with opencaster next few days. hope I can reproduce then.

oh and btw we tested with bumped ffmpeg, if that matters, it did not help.

@FernetMenta
Copy link

I need much more precise descriptions. The log shows that at least four channels were played. It shows audio for all of them. "I believe" does not help much.

@stefansaraev
Copy link
Contributor

well....

broken (http://sprunge.us/YLTI)

19:40:20 T:139903739086592   DEBUG: opening live stream on url 'rtp://@239.2.24.2:8208'
19:40:20 T:139903739086592   DEBUG: CPVRChannelGroup - Persist - persisting channel group 'Alle Kanäle' with 57 channels
19:40:20 T:139903739086592   DEBUG: PVRFile - Open - playback has started on filename pvr://channels/tv/Alle Kanäle/1.pvr
19:40:20 T:139903739086592   DEBUG: CDVDInputStreamPVRManager::Open - stream opened: rtp://@239.2.24.2:8208
19:40:20 T:139903739086592  NOTICE: Creating Demuxer
19:40:20 T:139903739086592   DEBUG: ffmpeg[7F3DE0ABC700]: Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
....
19:40:21 T:139903739086592   ERROR: ffmpeg[7F3DE0ABC700]: [NULL] non-existing PPS 0 referenced
19:40:21 T:139903739086592   DEBUG: CDVDDemuxFFmpeg::Read() fetching extradata, extradata_size(40)
19:40:21 T:139903739086592   DEBUG: CDVDDemuxFFmpeg::AddStream(0, ...) -> 0
19:40:21 T:139903739086592  NOTICE: Closing stream player 1
19:40:21 T:139903739086592   DEBUG: CDVDPlayer::SetCaching - caching state 0
19:40:21 T:139903739086592  NOTICE: CDVDMessageQueue(audio)::WaitUntilEmpty
19:40:21 T:139903601968896   DEBUG: CDVDPlayerAudio - CDVDMsg::GENERAL_SYNCHRONIZE
19:40:21 T:139903601968896   DEBUG: CDVDPlayerAudio::Process - Abort received, exiting thread
19:40:21 T:139903601968896  NOTICE: thread end: CDVDPlayerAudio::OnExit()
....

^ go figure...

good (http://sprunge.us/UadB)

21:01:42 T:140730596841216    INFO: ffmpeg[7FFE653BD700]:     Stream #0:0[0x20]: Video: h264 ([27][0][0][0] / 0x001B), 90k tbn
21:01:42 T:140730596841216    INFO: ffmpeg[7FFE653BD700]:     Stream #0:1[0x21](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 0 channels
21:01:42 T:140730596841216    INFO: ffmpeg[7FFE653BD700]:     Stream #0:2[0x22](ola): Audio: ac3 ([6][0][0][0] / 0x0006), 0 channels
21:01:42 T:140730596841216    INFO: ffmpeg[7FFE653BD700]:     Stream #0:3[0x29](GGG): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
21:01:42 T:140730596841216   DEBUG: CDVDDemuxFFmpeg::AddStream(0, ...) -> 0
21:01:42 T:140730596841216   DEBUG: CDVDDemuxFFmpeg::AddStream(1, ...) -> 1
21:01:42 T:140730596841216   DEBUG: CDVDDemuxFFmpeg::AddStream(2, ...) -> 2
21:01:42 T:140730596841216   DEBUG: CDVDDemuxFFmpeg::AddStream(3, ...) -> 3

^ 4 streams. 1x video, 2x audio, 1x teletext. all audio streams shown in osd -> audio..

@stefansaraev
Copy link
Contributor

@mcluki can you please test this build. without udpxy, and share a debug log ?

@FernetMenta
Copy link

@stefansaraev there is nothing wrong with the log snippets you posted. creation of streams is deferred until pat/pmt is seen. the question is why this does not work. what did you change in the liked build?

@FernetMenta
Copy link

could you try this:

diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index 4147a57..93ab519 100644
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -455,6 +455,7 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein
   {
     m_program = 0;
     m_checkvideo = true;
+    skipCreateStreams = true;
   }

   // reset any timeout

@stefansaraev
Copy link
Contributor

thanks @FernetMenta

@mcluki here two builds for you
build 1 (same as from my comment above)
build 2 - with the patch @FernetMenta provided.

please test both and share (clean, right after restart, try play an rtp:// channel) debug logs

@lukee7
Copy link
Author

lukee7 commented Dec 3, 2014

@FernetMenta @stefansaraev After trying build1 and build2, I can confirm that both work for me. I can see and change audio tracks.

Logs:
build1: http://sprunge.us/hBPP
build2: http://sprunge.us/LPLQ

@stefansaraev
Copy link
Contributor

thanks

@FernetMenta FYI "build 1" has

diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
index 343651c..0c8d5cb 100644
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
@@ -109,6 +109,8 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool
     bool useFastswitch = URIUtils::IsUsingFastSwitch(pInputStream->GetFileName());
     streaminfo = !useFastswitch;

+    streaminfo = true;
+
     if(pOtherStream)
     {
       /* Used for MediaPortal PVR addon (uses PVR otherstream for playback of rtsp streams) */

just to confirm what "I believe" :)

EDIT: and uh #2885

@FernetMenta
Copy link

@stefansaraev that would just disable the entire fastchannelswitch logic. I think this is not what we want, right?

@stefansaraev
Copy link
Contributor

@FernetMenta yes, that was exactly what I wantedto test

and uhm.. I hope "preferred audio language" will work with your patch. unfortunately @mcluki cant test that :(

@FernetMenta
Copy link

language is encoded in pat/pmt and a change in pmt triggers open of default streams which includes preferred audio track selection. works for vnsi and tvh for ages because they have their own demuxer and the same logic for a long time.

@stefansaraev
Copy link
Contributor

yep. I know its in pmt, wasnt sure about kodi internals.

cool. thanks ;) damn github doesnt have "+1" (thanks) button :D

@stefansaraev
Copy link
Contributor

this one is fixed in xbmc master. fix comes in next OE rc. thanks to everyone involved.c losing ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants