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

IPTV Stream stopped randomly while VLC plays them without any problem #908

Open
tudstudent opened this issue Oct 10, 2024 · 24 comments
Open

Comments

@tudstudent
Copy link

tudstudent commented Oct 10, 2024

Been busy with this topic now for 2 days and no idea what is going wrong.
From my IPTV supplier I have a m3u8 link. Downloaded etc.

If I then start a channel (doesn't matter which one) it is like lottery if it remains working in Kodi.
Sometimes it wont start, sometimes it plays 1 hour, sometimes 15sec.

However same link in VLC, no problem at all (it just always runs).

What I found in the logs (only was this part):
2024-10-10 15:25:53.531 T:43400 info : Skipped 5 duplicate messages..
2024-10-10 15:25:53.531 T:43400 warning : CVideoPlayerVideo::OutputPicture - timeout waiting for buffer
2024-10-10 15:25:54.067 T:43400 info : CDVDVideoCodecFFmpeg::CDropControl: calculated diff time: 39999
2024-10-10 15:26:13.545 T:35176 info : CVideoPlayerAudio::Process - stream stalled
2024-10-10 15:26:13.632 T:34792 info : CVideoPlayer::Process - eof reading from demuxer
2024-10-10 15:26:13.632 T:34792 info : CVideoPlayer::OnExit()

2024-10-10 15:26:13.632 T:34792 info : VideoPlayer: eof, waiting for queues to empty
2024-10-10 15:26:13.632 T:34792 info : Closing stream player 1
2024-10-10 15:26:13.632 T:34792 info : CDVDMessageQueue(audio)::WaitUntilEmpty
2024-10-10 15:26:13.633 T:34792 info : Waiting for audio thread to exit
2024-10-10 15:26:13.633 T:35176 info : thread end: CVideoPlayerAudio::OnExit()
2024-10-10 15:26:13.633 T:34792 info : Closing audio device
2024-10-10 15:26:13.635 T:34792 info : Deleting audio codec
2024-10-10 15:26:13.636 T:34792 info : Closing stream player 2
2024-10-10 15:26:13.636 T:34792 info : CDVDMessageQueue(video)::WaitUntilEmpty
2024-10-10 15:26:13.668 T:34792 info : waiting for video thread to exit
2024-10-10 15:26:13.668 T:43400 info : thread end: video_thread
2024-10-10 15:26:13.668 T:34792 info : deleting video codec
2024-10-10 15:26:13.670 T:34792 info : Closing stream player 4
2024-10-10 15:26:13.670 T:34792 info : waiting for teletext data thread to exit
2024-10-10 15:26:13.670 T:35476 info : thread end: data_thread
2024-10-10 15:26:13.674 T:14984 info : Deleting settings information for files pvr://channels/tv/%7cEU%7c%20NEDERLAND%204K%20ULTRA@2/[email protected]_925827646.pvr
2024-10-10 15:26:13.693 T:28448 info : CVideoPlayer::CloseFile()
2024-10-10 15:26:13.694 T:28448 info : DXVA::CDecoder::Close: closing decoder.
2024-10-10 15:26:13.694 T:28448 info : DXVA: closing decoder context.
2024-10-10 15:26:13.717 T:28448 info : VideoPlayer: waiting for threads to exit
2024-10-10 15:26:13.717 T:28448 info : VideoPlayer: finished waiting
2024-10-10 15:26:13.717 T:28448 info : CVideoPlayer::CloseFile()
2024-10-10 15:26:13.717 T:28448 info : VideoPlayer: waiting for threads to exit
2024-10-10 15:26:13.717 T:28448 info : VideoPlayer: finished waiting
2024-10-10 15:28:17.483 T:2640 info : CActiveAESink::OpenSink - initialize sink

I tried setting user agent VLC (however without it also works (more or less).
m3u8 HLS setting (not applicable so noting works)
ffmpeg disabled, no result.
inputstream.adaptive in advanced field. Also no result.

As I see this issue on Windows, Linux OSMC and Android I am posting it here as it might be something deeper (or hopefully somewhere a setting that I have missed).

@phunkyfish
Copy link
Member

Please post a full debug log using a paste site.

@phunkyfish
Copy link
Member

Please add a full debug log for both plain kodi and using inputstream.adaptive.

@tudstudent
Copy link
Author

I will make them tomorrow.
For the record (in the GUI configured):

auto refresh is disabled
streaming ffmpeg on
inputstream adaptive for hls off

user agent: empty
inputstream name: inputstream.adaptive

Any specific option to be set before making the log (tomorrow)?

@phunkyfish
Copy link
Member

You should use adaptive for HLS on and leave the inputstream name blank.

@tudstudent
Copy link
Author

Well I have done my best, as M3U8 is super large I have removed all that info.
Then uploaded to the kodi log site:
Kodi Log

Hope this works and has all info you need.
The 2 tests are both in this logfile, furthermore I noticed some streams are mkv and some mp4.
If the source is needed (kodi.log source) I can share to the developer 1-on-1 as I do not see value to share that to the world.

@tudstudent
Copy link
Author

Is there an update/did you check?

@phunkyfish
Copy link
Member

Your getting an eof, which means the stream data has stopped.

have you tried setting the user agent to vlc?

@tudstudent
Copy link
Author

I will try (again) this evening.
Also in parallel I will test to start the same stream with VLC (just to be sure it does not fail).

Is it possible VLC buffers more and reconnects (in this vacuum) that will not be noticed by users?

@phunkyfish
Copy link
Member

phunkyfish commented Oct 18, 2024

Yes, it’s very possible, reconnection logic will be very different in vlc and kodi. With VLCs being far more robust I’d imagine.

@tudstudent
Copy link
Author

2 questions:

  1. Are you interested in VLC log of the same stream?
  2. Is the reconnection/buffer logic part of IPTV Simple or is it part of the Kodi Core (in first case I can image it could be "patched" and second will be more complex never happen)?

@phunkyfish
Copy link
Member

  1. No, that won’t really help.
  2. All that can be done in the addon has been done. Kodi doesn’t really have reconnection logic, it relies on reliable streams.

Have you tried playback with ffmpegdirect instead of adaptive?

@goldengate2121
Copy link

I ran into a similar issue. I literally didn't change anything. Didn't do any updates. I started getting 429 errors and can't determine codec to use. Using Kodi 22 and SIPTV 22.2.2. The link works in VLC. I tried upgrading to the latest SIPTV 23 but still didn't solve the problem. I tried many different user agents (VLC, Chrome). I recompiled Kod and this didn't fix it. I keep a copy of my good .kodi and I tried this still same error. I thought it was a change in the URL but my other microSD has Kodi 21 with SIPTV ver 21.8.2 and it works. Don't know how it could break without doing anything.

@phunkyfish
Copy link
Member

This is not the same error. Too many requests is very different to a stream stalling.

@goldengate2121
Copy link

I was using system-ffmpeg. I re-emerged my Gentoo install to not use system-ffmpeg and now it works.

@goldengate2121
Copy link

Out of the blue now I am getting eof and CVideoPlayerAudio::Process - stream stalled. I installed Jelllyfin to test and I don't get the eof issues after 30 seconds which takes me back to the EPG. I didn't upgrade anything or make any changes. I don't know why this is happening out of nowhere. I tried forcing ffmpegdirect in the m3u file but it didn't fix anything. Running Gentoo on a Rpi5. I also tried on my Arch install that I hadn't used in a month and the same issue.

@am-silex
Copy link

am-silex commented Jan 7, 2025

Hi, everyone
I'm facing the same issue. Channels from time to time stop playing. I understand that stream isn't reliable, but expect the addon will try to reconnect before giving up.

CVideoPlayerAudio::Process - stream stalled
Kodi (22.0-ALPHA1 (21.90.700) Git:20241228-953b28eb12). Platform: Linux x86 64-bit
pvr.iptvsimple v22.4.1

@tudstudent
Copy link
Author

I stopped using kodi for the IPTV part. It simply doesn't work as it should (even though this can be argued, fact is that most likely the stream resume parameters and reconnect parameters are so tight it will not work with IPTV streams.
Yesterday bought a Google Streamer and will install IPTV Pro on it (that will in rare occasions also jam, but at least wit will reconnect).

I hope Kodi will in the future support IPTV better, so I can get rid of the additional device in the living room...

@phunkyfish
Copy link
Member

Unfortunately all the reconnection logic that is possible in the addon is there now.

There is not a huge amount more that can be done unless it gets changed in the core of kodi.

@tudstudent
Copy link
Author

Yes, for me this was already clear. I more or less referred to Kodi logic not addon logic.
Anyway, hope someday soon Kodi will make the necessary improvements to facilitate IPTV streams better.

@am-silex
Copy link

am-silex commented Jan 8, 2025

I'd like to further discuss this issue.

As an example, another PVR add-on TVheadend has no problem with Kodi, when it concerns unstable satellite signal, buffering, etc. So, I don't understand why there is suggestion for improving something in Kodi specifically for this add-on. Using IPTV makes Kodi extremely unstable, often with seg falt and crashes.

As a matter of fact, standard package in the latest Ubuntu 24 is absolutely unusable with my IPTV provider, as even stopping currently playing channel hangs Kodi for 10-20-and-so-on minutes with crash in the end. Compiled from source Piers branch (xmbc, pvr.iptvsimple & inputstream.ffmpegdirect addons), works relatively stable with the same provider. IPTV is unstable stream, in nature, so it should have been taken as a basic premise for building any client.

With regards

@phunkyfish
Copy link
Member

pvr.htshas its own server that handles the stream logic. Iptvsimple has no server, simply an M3U list to work from.

That being said as we now have ffmpegdirect, it should be possible to build similar logic in an inputstream that is separate to kodi. In fact we do have eof detection there and it is used for catchup stream splicing. But, despite many asks for test streams to work on, I have not received any from users outside of catchup streams so it’s never been taken any further. If we get those streams and I can access them (geo locking comes into play here). Don’t expect any solution to be quick or easy to implement. It’s unchartered territory and a one solution to fit all solution will be difficult to achieve.

@am-silex
Copy link

am-silex commented Jan 8, 2025

@phunkyfish, thank you for chiming in.

According to your message, the problem with eof and the likes only affect catchup stream, right? But, I don't see much difference with abrupt stopping playing live or catchup stream. In either cases, it just happens, from time to time. I accept it, more or less. What I dislike much is Kodi hangs and crashes. Here is sample dmesg log:

[81466.142569] VideoPlayer[50647]: segfault at 48 ip 0000762def09cff4 sp 0000762dee3fe670 error 4 in inputstream.ffmpegdirect.so.22.0.1[29cff4,762def022000+102a000] likely on CPU 2 (core 0, socket 0)

Sorry, if it doesn't pertain directly to your add-on. You are doing a great job.

@phunkyfish
Copy link
Member

Well the crash should not happen. Do you have a test stream I can use?

how long do you usually wait for a crash to occur?

@am-silex
Copy link

am-silex commented Jan 8, 2025

Surely, I could provide you with the link, please, write PM.
On components compiled from source, crashes are rare, like, couple times a day. On 'stock' Ubuntu packages - much, much frequently. I suppose, crashes are related to a problem with streams (stalling, time-outs, etc). However, it should not critically affect the whole app to the point of segfault.

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

4 participants