chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 582 forks source link

Plugin Ustream.tv : Unable to fetch desktop streams #1122

Open karlo2105 opened 8 years ago

karlo2105 commented 8 years ago

As you can see this live stream on Ustream platform is not opening with Livestreamer.

livestreamer "http://www.ustream.tv/channel/tv-sandzak" best [cli][info] Found matching plugin ustreamtv for URL http://www.ustream.tv/channel/tv-sandzak [plugin.ustreamtv][error] Unable to fetch desktop streams: Unable to validate re sult: Unable to validate key 'stream': Unable to validate result: Unable to vali date key 'streams': Unable to validate result: Type of ScriptDataReference(refer ence=7) should be 'dict' but is 'ScriptDataReference' or Type of ScriptDataRefer ence(reference=7) should be 'list' but is 'ScriptDataReference' or [ScriptDataOb ject([(u'name', u'uhs_tcdn'), (u'url', u'http://uhs-live-default.ustream.tv/ams- uhs01/streams/httpflv/ustreamVideo/18684284/'), (u'streams', [ScriptDataObject([ (u'chunkTime', 5000.0), (u'offsetInMs', 4821.0), (u'chunkRange', ScriptDataObjec t([(u'1447230451', u'958283629'), (u'1447230461', u'1943747493')])), (u'offset', 433.0), (u'width', 600.0), (u'bitrate', 537.0), (u'counter', -1.0), (u'streamNa me', u'streams/live1%_%.flv'), (u'chunkId', 1447230458.0), (u'videoCodec', u'H 264'), (u'height', 480.0)])])]), ScriptDataObject([(u'name', u'uhs_akamai'), (u' varnishUrl', u'http://uhs-akamai.ustream.tv/ams/ams-uhs01/streams/httpflv/ustrea mVideo/18684284/'), (u'url', u'http://uhs-akamai.ustream.tv/ams/ams-uhs01/stream s/httpflv/ustreamVideo/18684284/'), (u'streams', ScriptDataReference(reference=7 ))]), ScriptDataObject([(u'name', u'uhs_highwinds'), (u'varnishUrl', u'http://uh s-highwinds.ustream.tv/ams/ams-uhs01/streams/httpflv/ustreamVideo/18684284/'), ( u'url', u'http://uhs-highwinds.ustream.tv/ams/ams-uhs01/streams/httpflv/ustreamV ideo/18684284/'), (u'streams', ScriptDataReference(reference=7))])] does not equ al 'offline' error: No streams found on this URL: http://www.ustream.tv/channel/tv-sandzak

Any chance for a fix ?

poochiteap commented 8 years ago

I am also looking for a fix....

liamkennedy commented 8 years ago

Same here. Raspberry Pi - using version 1.12.0 of livestreamer

No desktop streams available. I am failing over to using the Mobile streams (HLS)

Ustream is definitely not playing nice. I wish I was more capable of diagnosing the issue - and looking at the code.

paulguy commented 8 years ago

Same here, and yeah I don't know enough about this stuff to fix it... I'm familiar with python but not the guts of how ustream and rtmp and stuff work. Unfortunately, it looks like this project is dead, and none of the forks add much.

liamkennedy commented 8 years ago

Well... it's a great tool... and I hope it gets some more attention soon. It's certainly had some work done in the past few months (although none that actually fixed the issue I was experiencing).

There have been other issues with Ustream that got fixed very quickly (earlier this year). I hope some of the guru's with this can help figure this out.

paulguy commented 8 years ago

Try my branch https://github.com/paulguy/livestreamer/tree/ustream-fix

It works for me but I doubt it's anywhere near "correct".

trUSTssc commented 8 years ago

Works fine here. Thanks!

Palmthief commented 8 years ago

Hi, so i spend nearly 3 hours just searching, reading up "guides", loading different versions, trying to understand that whole python thing, opening a reddit thread...but i give up, i can't figure out how to use this fix. I have the windows binary of livestreamer installed, also the night build on windows 7.

I know how to create a batch file like this and adding a link (allthough i mostly use "open livestreamer" addon from firefox)

@echo cd c:\program files (x86)\livestreamer livestreamer.exe @echo off?

thats all i can accomplish so far.

But how do i implement this fix/branch into my installation ? Or can someone compile, install or whatever it takes to make it work and maybe upload this finished folder for me if possible?

I would hugely appreciate that !

paulguy commented 8 years ago

I honestly have no idea how this would work under windows. On here it's literally just python setup.py build && python setup.py install, then pip install python-librtmp to provide a necessary dependency for ustream. I imagine the windows build of livestreamer has some build script. Should just require replacing the source code with the fixed source code (it's all just in 1 file), then running the build script to produce the .exe. I don't use windows though so I really wouldn't know.

liamkennedy commented 8 years ago

@paulguy - is the only change you made in the ustreamtv plugin?

paulguy commented 8 years ago

Yeah. The commit log should only show changes to 1 file.

liamkennedy commented 8 years ago

Great. Will be trying it out later (Rpi). Unfortunately I'm still stuck with not being able to reliably play the desktop streams (UHS) anyway via a Pi - and I have to use the HLS (Mobile) streams anyway.

ddevault commented 8 years ago

@paulguy's branch works for me.

DeafScribe commented 8 years ago

Tried adding the setup.py fix, executed 'python setup.py build && python setup.py install' from the home directory, got 'package directory 'src/livestreamer' does not exist'. Not sure if it's referring to a remote directory or a local one.

paulguy commented 8 years ago

You have to do it from the root of the package directory.

m4a2000 commented 8 years ago

So for those that have never messed with python is there a way for someone to compile an install build for WIN7 or give semi-foolproof instructions for the uStream fix?

brad commented 8 years ago

Paul's fix works for me too, thanks!

DeafScribe commented 8 years ago

Paul - from /usr/share/livestreamer, then?

paulguy commented 8 years ago

What I do is I just created a directory for it, put the source in a subdirectory and created a virtualenv in another subdirectory, then built and installed it in there.

spaceplumber commented 8 years ago

Hey guys, I spent the last day or so trying to figure out a handful of problems I've been getting with Livestreamer and Ustream. In the past I had found a fix here:

https://github.com/jthall/livestreamer

for the issue with Ustream's UHS streams intermittently losing chunks and freezing. It worked great for a while, unfortunately I then ran into the problem discussed in this thread, where the HD UHS streams are not found. Paul's fix took care of this right away. So using the commit logs I went through the ustreamtv.py and basically merged all of the changes from the two different fixes into one file.

I was honestly surprised that I didn't break anything when I saw it run, and everything works 99% perfectly for me now. My stream popped right up in 720p+ and I've only gotten one 2 second freeze in the last 20 minutes of letting it run, but I'm not sure if that is even related to this issue. I believe this is exactly the problem you are mentioning @liamkennedy. The only change is in the ustream plugin, so I've uploaded the file here:

https://mega.nz/#!JRlFlKhI!6T4bS08wWvZEJOv9iuvQoR52BOL-GuqvUxyn4K2ZKAs

For windows users, download it and copy/replace it into your C:\Program Files (x86)\Livestreamer\livestreamer-1.12.2-py2.7.egg\livestreamer\plugins directory.

@m4a2000, @Palmthief this should be pretty easy to make work.

I really don't understand github enough to make this a separate fork or how to integrate it into another OS, but I'm sure you guys are smart enough to make it work for you. Enjoy!

EDIT: If your current livestreamer has some conflict or incompatibility with this, the process that made this work for me was to first clean install the nightly build, then replace the ustreamtv.py file.

paulguy commented 8 years ago

Cool. If nobody else does this, I might do it eventually, but you literally just click a button on my repository to fork it, then you get a copy in your own account to make the changes, optionally in another branch, then commit it. git isn't too bad for that stuff but it is definitely daunting. There's guides out there for the basics, which I'm really only familiar with myself anyway.

spaceplumber commented 8 years ago

Alright, try this for the same fix.

https://github.com/spaceplumber/livestreamer

m4a2000 commented 8 years ago

@spaceplumber Thanks, but for windows it needs to be a .pyc not a .py and I don't know how to compile the file. That's my main issues.

spaceplumber commented 8 years ago

@m4a2000 not sure what you mean. I'm on windows 7 and all the files in Livestreamer\livestreamer-1.12.2-py2.7.egg\livestreamer\plugins are .py files. There's no need to compile anything. Just replace the ustreamtv.py file with the one I uploaded. You could even open the file with notepad and just copy and replace the code into the one that is already there.

m4a2000 commented 8 years ago

@spaceplumber I think the issue here is I went off the installer exe. For me that makes all the files in pyc files http://s22.postimg.org/jm1qd1if5/Plugin00.png I'm guessing you installed base livestreamer another way, right?

spaceplumber commented 8 years ago

@m4a2000 hmm interesting. I had installed it from an .exe previously so it set up the path for me. But to install the nightly build I just deleted everything in the program files livestreamer folder and pasted the files from the nightly build. Then replaced the ustreamtv.py file.

Palmthief commented 8 years ago

Hi, great to hear that people still try to figure this out. I tried your file but it won't work :/

I replaced your file with mine, didn't work I replaced the folder with the newest nightly build, then replaced the file, didn't work. Then i simply opened your file with notepad and replaced the content with my file, also didn't work.

If i use the original py file the stream normally works with the crap 360p mobile version.

I made a screenshot of the error trying your file. Thanks so far for you help!

http://imgur.com/sqAjdAM

ps: maybe you can upload your whole livestreamer folder wich is working for you. Maybe that does the trick.

m4a2000 commented 8 years ago

@spaceplumber Did what you said and I got it to work. I haven't check it with bat files just yet, I'm doing that in a few hours, but it looks like I can go back to recording a talk show I like.

Palmthief commented 8 years ago

@m4a2000 can you maybe upload your folder for testing ? It didn't work for me so far.

paulguy commented 8 years ago

@spaceplumber you should put in a pull request so your code can get merged in. The original dude seems to be merging stuff in now.

spaceplumber commented 8 years ago

@Palmthief hopefully you can make this work:

https://mega.nz/#!FEsSkLpZ!ayjaxkD_u1KFtrA1xvV6jWvFGsfd7wzkZ0BQhhHCgV4

Delete everything in your C:\Program Files (x86)\Livestreamer folder and paste in the contents of this zip after extracting it. If want to follow my process that made it work exactly (not that it was correct or even good) I uninstalled everything. Then installed livestreamer from the windows .exe installer from the website. Then I deleted everything in the C:\Program Files (x86)\Livestreamer folder, downloaded the nightly build .zip from github, and then pasted in the contents of that livestreamer folder. Then I replaced the ustreamtv.py file. I now get this for all HD Ustream streams:

http://i.imgbox.com/wORngsiz.png

Palmthief commented 8 years ago

@spaceplumber

Hi, so i tried it with your file and same error :/

But then i tried the ustream.tv/opensea link and it works.

So apparantly the longer url causes the problems. Because streams starting with a "ustream.tv/channel/randomstream" or ustream.tv/explore/randomstream" cause those problems. Maybe thats why my error screen says "key error url" ?

You have an idea how to fix this ? :)

Palmthief commented 8 years ago

Guess Spaceplumber gave up on me :(

spaceplumber commented 8 years ago

@palmthief I tested this and found the same issue that you did. Oddly enough it works with some other channels with the /channel/ in the url. I'm not sure what's causing this.

Palmthief commented 8 years ago

@spaceplumber That's a shame. Anyways thanks for you help! Maybe someone else can look into it ? So close to getting this solved :)

intact commented 8 years ago

@spaceplumber maybe you can skip all varnishUrls (and not only uhs_akamai)

trUSTssc commented 8 years ago

Thanks, skipping uhs_llnw too makes it work again here.

Palmthief commented 8 years ago

Can someone walk me through how to do this ? Or maybe send the modified file to me ?

trUSTssc commented 8 years ago

@Palmthief https://mega.nz/#!gNUyAQoD!IFanlv_3zYnlcyXJ619DfoRL3Sgn2qgqS8c4Nz1FOjQ

Palmthief commented 8 years ago

@trUSTssc Thanks for the file. It now shows the better quality streams and loads them.

But it's constantly freezing up, sometimes it doesn't load the stream and only shows a black screen with the error...sometimes it freezes in the middle of the stream showing the error i uploaded to imgur. http://imgur.com/BhNTyhy

Reading up the Thread again i guess it's the same problem spaceplumber had.

Did you by any chance use your own ustream.py file or did you modify spaceplumber's file ? Maybe your fix overwrote spaceplumber original fix for the uhs freeze problem ?

Thanks in advance.

trUSTssc commented 8 years ago

@Palmthief I used the file from @spaceplumber so perhaps something else is wrong.

serendipiteez commented 8 years ago

@trUSTssc I tried the file, it works for a while but I get the "Failed to process module" error.

jeranamo commented 8 years ago

So this issue still remains. I have followed everything here and nothing resolves the issue. Is there someone out there that can fix this?

TheSneakySniper commented 7 years ago

Same. I still have this issue. Maybe if someone revised the ustream plugin, i could just download the revised plugin and swap it out for the old one... on my end...

tp0 commented 7 years ago

@TheSneakySniper Maybe someone will at the new fork, https://github.com/streamlink/streamlink