Page 1 of 1

Black screen when trying to stream from twitch

Posted: 26 Jan 2019 08:36
by Razkan
Hi,

There is a similar post: https://forum.videolan.org/viewtopic.ph ... ed#p483870 however I believe my issue is different and don't want to mix help in the same thread.

I have been using a library, Vlc.DotNet a libVLC wrapper for windows forms, where I get a black screen when trying to play streams from twitch.tv. I get the following debug log when running the program:
(x86) https://pastebin.com/raw/nd5S3yYD.
(x64) https://pastebin.com/5deE2s1t

I discussed this with the Vlc.DotNet creator at https://github.com/ZeBobo5/Vlc.DotNet/issues/509 but it was decided the issue is with libVLC.

The weird behaviour is that the screen is blank, but the memory keeps increasing until all the computers memory is reserved and in some cases an OutOfMemoryException is thrown after a few minutes of running it.

There is a work around, where you use https://github.com/streamlink/streamlink, converting the twitch.tv link to a vlc player friendly link (.m3u8), however that doesn't feel like a plausible solution, since if you paste the twitch.tv link direct in vlc it works out of the box.

I have tried libVLC 3.0.0, 3.0.4, 3.0.5 and 3.0.6.

Any suggestion on how to solve it?

Re: Black screen when trying to stream from twitch

Posted: 31 Jan 2019 17:06
by Razkan
Could someone confirm if this is intended, bug or just missing information to how to test it? I want it integrated with my application, but if it is not serious enough to investigate i'll try another framework.

Re: Black screen when trying to stream from twitch

Posted: 31 Jan 2019 17:09
by chouquette
Can you reproduce the same (or a similar) behavior when using VLC itself?

Re: Black screen when trying to stream from twitch

Posted: 31 Jan 2019 17:12
by Razkan
No, with vlc it works flawless.

copied from the github issue report:

"With vlc I can:
- [x] Play a local .mp4 clip.
- [x] I can play the 'vlcControl1.Play("http://download.blender.org/peach/bigbu ... p_h264.mov"));`
- [x] Play a livestream from example twitch

With vlccontroller (libvlc wrapper) I can:
- [x] Play a local .mp4 clip.
- [x] I can play the 'vlcControl1.Play("http://download.blender.org/peach/bigbu ... p_h264.mov"));`
- [ ] Play a livestream from example twitch
"

Re: Black screen when trying to stream from twitch

Posted: 10 Feb 2019 22:15
by Jean-Baptiste Kempf
It seems the lua module is not loaded, tbh.

Re: Black screen when trying to stream from twitch

Posted: 10 Feb 2019 22:43
by Razkan
is that something I can do manually, or something that has to be fixed in libvlc?

If the stream is converted to .m3u8 through https://github.com/streamlink/streamlink it works flawless.

Re: Black screen when trying to stream from twitch

Posted: 16 Feb 2019 11:05
by Jean-Baptiste Kempf
Are you shipping all the modules correctly?

Re: Black screen when trying to stream from twitch

Posted: 17 Feb 2019 20:37
by Razkan
Are you shipping all the modules correctly?
How can I verify that?

As far as I know, the modules works correctly since I can get it to work if I pass it as a .m3u8 extension, however that might be something else?

Re: Black screen when trying to stream from twitch

Posted: 17 Feb 2019 21:04
by Jean-Baptiste Kempf
Can you compare the VLC logs output and the libVLC logs output on the same link?

Re: Black screen when trying to stream from twitch

Posted: 18 Feb 2019 00:15
by Razkan
Can you compare the VLC logs output and the libVLC logs output on the same link?
LibVLC (not working): https://pastebin.com/uU8EN2LT
VLC (working): https://pastebin.com/nm4GeMfs

Re: Black screen when trying to stream from twitch

Posted: 18 Feb 2019 00:25
by Razkan
I removed all but twitch.luac from <ProjectFolder>\Library\VideoLAN.LibVLC.Windows.3.0.6\build\x64\lua\playlist, and it gave the following result https://pastebin.com/ejuvDxRb, but then nothing more happend. Seems like a small progress.

Re: Black screen when trying to stream from twitch

Posted: 18 Feb 2019 00:28
by Razkan
So the LibVLC generates a .m3u8 link (line 153 in https://pastebin.com/ejuvDxRb), if I copy that link to VLC it starts to play the twitch stream correctly in VLC.

Re: Black screen when trying to stream from twitch

Posted: 18 Feb 2019 15:05
by Jean-Baptiste Kempf
Are you playing the item?

Re: Black screen when trying to stream from twitch

Posted: 19 Feb 2019 18:46
by Razkan
Are you playing the item?

we'll the only thing I am running is

Code: Select all

vlcControl1.Play("https://www.twitch.tv/followgrubby")
so I assume it is running.

When I run it the usher.twitch.tv link is generated, but the generated item does not seem to start. If i run it again, with swapping the https://www.twitch.tv/<channel> to the generated usher.twitch.tv link (copy paste from the log), it works.

basically all the pre work seems to work (fetching links, and generating a .m3u8), however after the .m3u8 is generated nothing more happens.

Re: Black screen when trying to stream from twitch

Posted: 20 Feb 2019 03:54
by mfkl
This code will play your stream with LibVLCSharp as soon as https://github.com/videolan/libvlcsharp/pull/31 gets merged and released

Code: Select all

Core.Initialize(); using (var libVLC = new LibVLC()) { var media = new Media(libVLC, "https://www.twitch.tv/followgrubby", Media.FromType.FromLocation); var status = await media.Parse(Media.MediaParseOptions.ParseNetwork); using (var mp = new MediaPlayer(media.SubItems[0])) { media.Dispose(); mp.Play(); Console.ReadKey(); } }
Vlc.DotNet does not support `libvlc_media_subitems` yet, so your options are: 1. Make a PR to Vlc.DotNet or 2. Switch to LibVLCSharp and wait for PR31 to get merged.

Re: Black screen when trying to stream from twitch

Posted: 20 Feb 2019 10:45
by Razkan
This code will play your stream with LibVLCSharp as soon as https://github.com/videolan/libvlcsharp/pull/31 gets merged and released

Code: Select all

Core.Initialize(); using (var libVLC = new LibVLC()) { var media = new Media(libVLC, "https://www.twitch.tv/followgrubby", Media.FromType.FromLocation); var status = await media.Parse(Media.MediaParseOptions.ParseNetwork); using (var mp = new MediaPlayer(media.SubItems[0])) { media.Dispose(); mp.Play(); Console.ReadKey(); } }
Vlc.DotNet does not support `libvlc_media_subitems` yet, so your options are: 1. Make a PR to Vlc.DotNet or 2. Switch to LibVLCSharp and wait for PR31 to get merged.

Thanks, this is the kind of solution I want. I'll switch to LibVLCSharp and wait for PR31, any ETA?