Record in subdirectory of streams and play from it

75 views
Skip to first unread message

Yamakasi

unread,
Jan 20, 2015, 3:27:45 PM1/20/15
to red5in...@googlegroups.com
I'm able to record in a subdirectory of streams in my app, but playing from it seems to be an issue as I think it does only looks in /streams/filename using ns.play() ?

Hoe can I make it work so I can play from /streams/foo/bar/filename ?


Rajdeep Rath

unread,
Jan 20, 2015, 3:32:13 PM1/20/15
to red5in...@googlegroups.com
Mention the subdirectories path after the core stream directory, in the netstream play function. For example ns.play("/foo/bar/filename.flv"). It should work. 


On Wednesday, January 21, 2015, Yamakasi <yamaka...@gmail.com> wrote:
I'm able to record in a subdirectory of streams in my app, but playing from it seems to be an issue as I think it does only looks in /streams/filename using ns.play() ?

Hoe can I make it work so I can play from /streams/foo/bar/filename ?


--

---
You received this message because you are subscribed to the Google Groups "red5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to red5interest...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yamakasi

unread,
Jan 20, 2015, 3:45:06 PM1/20/15
to red5in...@googlegroups.com
I would say so, would there be an issue with symlinks ? streams is symlinked but recording goes well.

I see: 

Exception attempting to lookup file: ServletContext resource [/streams/foo/bar/movie.flv] cannot be resolved to URL because it does not exist
W3C x-category:stream x-event:play c-ip: xxx.xxx.xxx.xxx x-sname:adb33b4c-ad42-453c-adc0-e50c8507457c x-name:foo/bar/movie

and no movie play at all.

Op dinsdag 20 januari 2015 21:32:13 UTC+1 schreef Rajdeep Rath:
Mention the subdirectories path after the core stream directory, in the netstream play function. For example ns.play("/foo/bar/filename.flv"). It should work. 

On Wednesday, January 21, 2015, Yamakasi <yamaka...@gmail.com> wrote:
I'm able to record in a subdirectory of streams in my app, but playing from it seems to be an issue as I think it does only looks in /streams/filename using ns.play() ?

Hoe can I make it work so I can play from /streams/foo/bar/filename ?


--

---
You received this message because you are subscribed to the Google Groups "red5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to red5interest+unsubscribe@googlegroups.com.

Rajdeep Rath

unread,
Jan 20, 2015, 3:53:54 PM1/20/15
to red5in...@googlegroups.com
When i do this:

stream name: foo/bar/trailer.mp4
rtmp : rtmp://localhost/vod

it does play for me, given that trailer.mp4 is inside {streams}/foo/bar/

To unsubscribe from this group and stop receiving emails from it, send an email to red5interest...@googlegroups.com.

Yamakasi

unread,
Jan 20, 2015, 4:35:06 PM1/20/15
to red5in...@googlegroups.com
This doesn't work for me.

I get the feeling that symlinks are not followed well ?

Or can I check something else on this setup ?

Op dinsdag 20 januari 2015 21:53:54 UTC+1 schreef Rajdeep Rath:

Rajdeep Rath

unread,
Jan 20, 2015, 4:37:03 PM1/20/15
to red5in...@googlegroups.com
Not sure but other than that other things look all the same. Why do you need to use symlinks ?

Yamakasi

unread,
Jan 21, 2015, 2:30:25 AM1/21/15
to red5in...@googlegroups.com
Because we need to.

Some software has issues with symlinks, so this might be an issue?


Op dinsdag 20 januari 2015 22:37:03 UTC+1 schreef Rajdeep Rath:

Rajdeep Rath

unread,
Jan 21, 2015, 4:39:47 AM1/21/15
to red5in...@googlegroups.com

Implement customfilenamegenerator bean to relocate stream folder for record and playback.

Yamakasi

unread,
Jan 21, 2015, 10:17:45 AM1/21/15
to red5in...@googlegroups.com
I think that is not the solution more a workaround.

Anyone some idea about the symlink ?

Any ideas are welcome!

Op woensdag 21 januari 2015 10:39:47 UTC+1 schreef Rajdeep Rath:

Mondain

unread,
Jan 21, 2015, 12:53:35 PM1/21/15
to red5in...@googlegroups.com
I know we worked on a project with symlinks at Infrared5 about 3 years ago, but I can't recall how we made it work; it was probably a custom file resource locator and "hard" symlinks.

Chris Allen

unread,
Jan 21, 2015, 1:17:59 PM1/21/15
to red5in...@googlegroups.com
Hey Paul, Let me know what the project was via private message and I can look into it. 

-Chris

Andy Shaules

unread,
Jan 21, 2015, 10:41:39 PM1/21/15
to red5in...@googlegroups.com
As Paul mentioned, sim links are possible and have been achieved in the
past.

As Rajdeep mentioned, implementing customfilenamegenerator is how you
achieve saving files to another location such as within simlinks or the
international space station CDN.

But really this is a question for the tomcat mailing list, as in, 'How
do I configure Tomcat to look for simlinks for resources in a servlet
context?'

I think implementing IFileProviderService or IVodProviderService is the
ticket. The stock provider looks at the streams directory and relies on
Tomcat. It uses Tomcat so that VOD files can be protected by Tomcat
security, and then RTMP IPlaybackSecurity.

I think the person on the old mailing list dimply copied the code from
FileProvider service and made it look other places. The project Paul
refers to used NAS for VOD files.

If you check the architecture of Red5, it is a series of beans which are
all programing to their own interface. What you say is a 'workaround' is
just how it works.

Yamakasi

unread,
Jan 23, 2015, 10:31:58 AM1/23/15
to red5in...@googlegroups.com
HI Guys,

OK, thanks for that the explanation, I will dive into that!

Chris Allen

unread,
Jan 23, 2015, 10:44:31 AM1/23/15
to red5in...@googlegroups.com
Yeah, and the project that Paul (Mondain) mentioned has long since been deleted due to it being client code, and a few years old. Sorry I couldn't get any help for you there. 

Best of luck, but sounds like you have some good stuff to go on now. Let us know how it goes.

-Chris

Yamakasi

unread,
Jan 23, 2015, 11:46:11 AM1/23/15
to red5in...@googlegroups.com
Hi, no problem By googeling I'm getting somewhere.

What I don't get, as I like to symlink streams -> /mnt/nfs/share I wonder if that is possible.

What I see is most people would set the:

 <bean class="org.red5.core.CustomFilenameGenerator" id="streamFilenameGenerator">
    <property value="recordpath/" name="recordPath" />
    <property value="recordpath/" name="playbackPath" />
    <property value="false" name="absolutePath" />
  </bean>


But this confuses me as I think this doesn't fix my symlink issue ? AbsolutePath is the better way ?

Mondain

unread,
Jan 23, 2015, 11:53:17 AM1/23/15
to red5in...@googlegroups.com
The thing is that you can code whatever you want in your implementation; what doesn't Java do? One example using Amazon S3 for instance is here: https://github.com/Red5/red5-examples/blob/master/s3/src/main/java/org/red5/examples/s3/S3FilenameGenerator.java

You could certainly modify this to use any type of filestore.

Mondain

unread,
Jan 23, 2015, 11:56:34 AM1/23/15
to red5in...@googlegroups.com
Not sure if this is helpful, but there is this over on SO http://stackoverflow.com/questions/19964600/how-to-check-if-filesystem-supports-links-and-symlinks-in-java

To unsubscribe from this group and stop receiving emails from it, send an email to red5interest+unsubscribe@googlegroups.com.

Rajdeep Rath

unread,
Jan 23, 2015, 12:06:17 PM1/23/15
to red5in...@googlegroups.com
Are both your record and play locations physically on same system ? If yes then yes you can use customfilenamegenerator and i can help you with it . if not then good luck googleing :)

Yamakasi

unread,
Jan 23, 2015, 1:54:19 PM1/23/15
to red5in...@googlegroups.com
Yes same system, I wouldn't see a reason why it should be seperated.

I'm googleing about it already :) But ideas are always good!

Op vrijdag 23 januari 2015 18:06:17 UTC+1 schreef Rajdeep Rath:

Yamakasi

unread,
Jan 23, 2015, 7:21:32 PM1/23/15
to red5in...@googlegroups.com
Hi Paul,

Yes thanks a lot I'm reading this always good help too!

Maybe Rajdeep has some solution he is talking about, need to check as I need to fix something else too.

Thanks!

Op vrijdag 23 januari 2015 17:56:34 UTC+1 schreef Mondain:

Yamakasi

unread,
Jan 24, 2015, 12:15:58 PM1/24/15
to red5in...@googlegroups.com
The Custom File Generator itself is kinda clear but the question(s) remain:

Do we need to use the settings for an absolute path directly to the NFS share or can we use a symlinked streams folder in your app with some Generator Settings ?

As far as I can see it's needed to use the absolute path directly to a nfs share, or am I wrong here ?



Op zaterdag 24 januari 2015 01:21:32 UTC+1 schreef Yamakasi:

Rajdeep Rath

unread,
Jan 24, 2015, 12:35:47 PM1/24/15
to red5in...@googlegroups.com
Hi have you coded a custom app ? Does your app does anything more than the normal red5 live app? Have you coded the customfilenamegenerator ?

Yamakasi

unread,
Jan 24, 2015, 12:47:18 PM1/24/15
to red5in...@googlegroups.com
Hi, Yes it is a custom app. I thought I was able to use the way like here: https://github.com/Red5/red5-server/wiki/Customize-Stream-Path

Op zaterdag 24 januari 2015 18:35:47 UTC+1 schreef Rajdeep Rath:
To unsubscribe from this group and stop receiving emails from it, send an email to red5interest+unsubscribe@googlegroups.com.

Yamakasi

unread,
Jan 25, 2015, 6:49:55 AM1/25/15
to red5in...@googlegroups.com
OK for the update.

Recording goes well on a symlink, playing not.

Why would there be a difference in both ? Same path is used so playing would be done different ?



Op zaterdag 24 januari 2015 18:47:18 UTC+1 schreef Yamakasi:

Yamakasi

unread,
Jan 25, 2015, 7:02:28 AM1/25/15
to red5in...@googlegroups.com
I think it's related to here: https://code.google.com/p/red5/issues/detail?id=263#c11

But I don't know if this is solved in later relases, at least not 1.0.2
Op zondag 25 januari 2015 12:49:55 UTC+1 schreef Yamakasi:

Rajdeep Rath

unread,
Jan 25, 2015, 7:15:38 AM1/25/15
to red5in...@googlegroups.com
Why don't you use customfilenamegenerator and locate both record directory and playback directory using absolute paths ?

Yamakasi

unread,
Jan 25, 2015, 4:17:52 PM1/25/15
to red5in...@googlegroups.com
Because symlinks are easier to deploy for us.

So can we do this and wht does record work and play not ?

What was your example you were talking about ? Maybe a share of that can help ?

Yamakasi

unread,
Jan 27, 2015, 4:24:22 AM1/27/15
to red5in...@googlegroups.com
Is someone able to explain me wy there is a difference in recording an playing ?

Recording goes into my streams symlink subdirectory, but playing is not able to find the file.

Mondain

unread,
Jan 27, 2015, 8:47:34 AM1/27/15
to red5in...@googlegroups.com
Without looking to verify, I believe playback uses Spring and record uses std Java.

Yamakasi

unread,
Jan 27, 2015, 9:19:33 AM1/27/15
to red5in...@googlegroups.com
I think you are right there, but is that the known "bug" in Spring ?

But Spring always plays from streams/ ?

I would like to symlink streams/ for both.

Andy Shaules

unread,
Jan 27, 2015, 12:31:59 PM1/27/15
to red5in...@googlegroups.com
You'll need to implement your own IProvider service for file providers, which would look at the sim link.

We dont want people to be able to use red5 to access arbitrary files on a linux system. By allowing wild cards in a play path, you could lock up a server with play requests for things that are not flv's

Dont you think raw access to the file system using flash play requests is a very very bad idea?

Yamakasi

unread,
Jan 27, 2015, 1:14:34 PM1/27/15
to red5in...@googlegroups.com
Yes and no.

If you know how to configure your systems right this shouldn't be a problem.

So my options are the basic example from the wiki that should work out of the box ?
...

Andy Shaules

unread,
Jan 27, 2015, 3:37:15 PM1/27/15
to red5in...@googlegroups.com
Yes and no :)

Any more, this is a tomcat question, not a red5 question.

You need to configure tomcat to allow soft links AND override the file name generator.

OR

you need to override the file name generator AND override or extend the ProviderService bean.

Those are your options, and both are valid, non-workaround solutions.

You could have overridden the provider service, and configured the common.xml bean to use it last week.

brief reference, I cannot say this will work. I would use option 2 from above, and be done with it.

http://isocra.com/2008/01/following-symbolic-links-in-tomcat/
--

Yamakasi

unread,
Jan 27, 2015, 5:35:19 PM1/27/15
to red5in...@googlegroups.com
Hi thanks!

As I'm reviewing this is good and done between. So no problem at all!

Thanks!
...

Yamakasi

unread,
Feb 1, 2015, 8:19:40 AM2/1/15
to red5in...@googlegroups.com
OK I dived into this again today in my sparetime and I still see the same problem, file not found while playing.

The exact way for allowing symlinks is shown where but doesn't seem to work:

https://github.com/collective/unimr.red5.protectedvod/tree/master/unimr/red5/protectedvod/red5-webapp

I wonder why this default doesn't work?

Yamakasi

unread,
Feb 1, 2015, 11:02:46 AM2/1/15
to red5in...@googlegroups.com
I have it fixed, I think I was too much focussed on using my symlink folder....

Thanks guys!


Op zondag 1 februari 2015 14:19:40 UTC+1 schreef Yamakasi:
Reply all
Reply to author
Forward
0 new messages