FAQ  •  Register  •  Login

Closing connection: NetStream.Failed

<<

haamro

Serviio newbie

Posts: 9

Joined: Fri Aug 23, 2013 4:55 pm

Post Mon Aug 18, 2014 3:38 pm

Closing connection: NetStream.Failed

Hello there, I am building groovy, that fetches rtmp and sends it to serviio
but I am getting the following error.

From serviio.log
  Code:
libswscale      2.  3.100 /  2.  3.100
libswresample   0. 17.102 /  0. 17.102
libpostproc    52.  3.100 / 52.  3.100
Closing connection: NetStream.Failed
rtmp://xxxxxxxxxxx   playpath=sportstime?token=GltZT0yMDE0MDgxODE1MT live=1 buffer=100000000: Unknown error occurred


This is the output of eclipse:
  Code:
ContentURLContainer [fileType=VIDEO, contentUrl=rtmp://xxxxxxxxxxx   playpath=sportstime?token=GltZT0yMDE0MDgxODE1MT live=1, thumbnailUrl=http://xxx/tv.jpg, expiresImmediately=true, cacheKey=xx_xxTV, live=true, ]

Please note:
1. token only works once
2. I know it does not have swfURL and pageURL but it works, when I paste it directly to console->live stream. It says the URL is valid.
3. I tried ffmpeg.exe -i "rtmp://xxxxxxxxxxx playpath=sportstime?token=GltZT0yMDE0MDgxODE1MT live=1"

am I missing something ? why would it work on console when I add it as live stream (at least it says the link is valid) but not work with actual groovy ?

thx
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Aug 19, 2014 6:06 pm

Re: Closing connection: NetStream.Failed

If the token only works once, it might be a problem. As Serviio will use the URL to fetch metadata before you even attempt to play it. Alternatively you could set expiresImmediately to true, which will cause the groovy code to be called again just before playback - but I think that is only taken into account for live streams (not sure if yours is)
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Tue Aug 19, 2014 7:56 pm

Re: Closing connection: NetStream.Failed

I think that is only taken into account for live streams

That is correct but Nothing in the spec says expires immediately only applies to live streams.
I in fact have non-live streams where the "key" changes over time and requires expires immediately to re-extract at play time.
I have raised a ticket to fix that by making expires immediately apply to all stream types.

I tried ffmpeg.exe

You need to get it to work on the command line first. Try ffplay -i "rtmp......",
then if it works run ffmpeg.exe -i "rtmp...." from the command line and post the output here
<<

haamro

Serviio newbie

Posts: 9

Joined: Fri Aug 23, 2013 4:55 pm

Post Tue Aug 19, 2014 11:42 pm

Re: Closing connection: NetStream.Failed

Thanx for the reply

1. it is a live stream
2. expiresImmediately is set to true as you can see on eclipse output
3. It does work on ffplay
4. please find the attached image
Image

my XBMC and WDTV does shows the link, but not able to play.
Last edited by haamro on Wed Aug 20, 2014 12:07 am, edited 1 time in total.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Wed Aug 20, 2014 12:01 am

Re: Closing connection: NetStream.Failed

From serviio.log
Code:
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Closing connection: NetStream.Failed
rtmp://xxxxxxxxxxx playpath=sportstime?token=GltZT0yMDE0MDgxODE1MT live=1 buffer=100000000: Unknown error occurred

In my experience this is not from the log which never displays the ffmpeg details.
You are simply changing and hiding too much data to be able to help you.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Aug 20, 2014 11:02 am

Re: Closing connection: NetStream.Failed

you have to check the detailed log to see how many times and when the ffmpeg command is called, and with which token. I assume it's called twice with the same token somewhere along the process.
<<

haamro

Serviio newbie

Posts: 9

Joined: Fri Aug 23, 2013 4:55 pm

Post Thu Aug 21, 2014 12:31 am

Re: Closing connection: NetStream.Failed

I did the detailed log. And to my surprise looks like the token is not being refreshed and the same token is being used each time. But when I run the script with Eclipse different Token is generated each time.
Looks like serviio is not respecting expiresImmediately=true
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Aug 21, 2014 8:22 am

Re: Closing connection: NetStream.Failed

did you see at any point the plugin being invoked again due to expiresImmediately?
<<

haamro

Serviio newbie

Posts: 9

Joined: Fri Aug 23, 2013 4:55 pm

Post Thu Aug 21, 2014 11:04 pm

Re: Closing connection: NetStream.Failed

Well I am not quite sure how to check that, but the detailed logs shows the same token everywhere. I think this is the reason why the video is not opening.


  Code:
2014-08-21 18:29:25,464 DEBUG [FeedItemUrlExtractor] test.groovy: Staring video URL extraction for null
2014-08-21 18:29:25,464 DEBUG [FeedItemUrlExtractor] test.groovy: Finished extraction of url: ContentURLContainer [fileType=VIDEO, contentUrl=rtmp://xxxx/ playpath=sports?token=SAMETOKENEVERYTIME live=1 swfVfy=1, thumbnailUrl=http://image, expiresImmediately=true, cacheKey=TEST.COM_Channel1, live=true, ]
2014-08-21 18:29:25,464 DEBUG [VideoDeliveryEngine] Successfully set new URL for the feed item

The above log occurred twice ( 1 for adding and 1 while trying to play video I guess ) in the entire log, but the token is the same in both instances. I tried to play the video after 30 min and it is the same token :(

Also I noted, it shows as FeedItemUrlExtractor while my groovy uses WebResourceUrlExtractor.

I re-ran my groovy in eclipse and everytime it generates different token.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Fri Aug 22, 2014 1:51 am

Re: Closing connection: NetStream.Failed

I'm a little confused by your statement "I re-ran my groovy in eclipse and everytime it generates different token" implying that the expires immediately code ran there too.
AFAIK, the expires immediately logic is only within serviio and so when you test your groovy outside of serviio, only the 2 methods (WebResourceContainer extractItems and ContentURLContainer extractUrl) run, and with each test you will see a different token.
When you load your groovy in Serviio, the 2 methods will run, and when you play an item declared as expires immediately the second method will run again, and reextract the url to give you the token per your groovy code.
I just had the same problem and it turned out my groovy code was failing within Serviio without any notification causing the rextract to fail and the original cached url and token to be used. The way to fix that is to add log statements to your groovy at each step in order to identify and fix the point it fails. My groovy now works correctly, and I can also report that "expires immediately" works correctly for both live=true and live=false feed items, and so I have cancelled by bug report referenced earlier.
<<

haamro

Serviio newbie

Posts: 9

Joined: Fri Aug 23, 2013 4:55 pm

Post Fri Aug 22, 2014 11:41 am

Re: Closing connection: NetStream.Failed

jhb50 wrote:I'm a little confused by your statement "I re-ran my groovy in eclipse and everytime it generates different token" implying that the expires immediately code ran there too.

No, it just means that my code is correct in extracting correct URL everytime. Eclipse has nothing to do with expiresImmediately

is my cacheKey a problem ? do I need to add token or URL to cachekey to make it unique ?

jhb50 wrote:The way to fix that is to add log statements to your groovy at each step in order to identify and fix the point it fails.

I will try this
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Fri Aug 22, 2014 2:27 pm

Re: Closing connection: NetStream.Failed

is my cacheKey a problem ? do I need to add token or URL to cachekey to make it unique ?

No, its fine. The latest URL including the token will be cached under that key and used when you play it. If the key has your token added then a new key will be created with each extract. Both work but the latter will grow the cache for no good reason.
PS: As your first test add a log displaying the token just before the "return new ContentURLContainer" statement; update the groovy in Serviio; play the item. If the Debug log does not display the log at play time then the reextract failed before that point and the original token (which is displayed earlier in the log at the initial extract time)will be used, or if the log still shows the original token, then your extract logic is faulty.
<<

haamro

Serviio newbie

Posts: 9

Joined: Fri Aug 23, 2013 4:55 pm

Post Sat Aug 23, 2014 3:20 am

Re: Closing connection: NetStream.Failed

As your first test add a log displaying the token just before the "return new ContentURLContainer" statement; update the groovy in Serviio; play the item. If the Debug log does not display the log at play time then the reextract failed before that point and the original token (which is displayed earlier in the log at the initial extract time)will be used, or if the log still shows the original token


I did that, and the debug log display the same token with each request. Looks like I am missing something here :(

then your extract logic is faulty.

Well, I run my Groovy in eclipse, and it pulls different token every time

I think this is more of a cache problem. Do i need to reset the variable to null before assigning the value ?
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Sat Aug 23, 2014 2:35 pm

Re: Closing connection: NetStream.Failed

Well, I run my Groovy in eclipse, and it pulls different token every time

Of course it does because it only runs the first extract, never the re-extract at play time which only happens in serviio.
ie: your logic fails when re-extracting so you need to debug with log statements to see where the re-extract differs from the original extract.

Return to Plugin development

Who is online

Users browsing this forum: No registered users and 10 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.