red5 get default stream file absolute path


These days i has been fell into Red5 program. The Red5 Application will save live stream in the default path – /webapps/yourAppName/streams. Of couse, we can change the default path to custom directories. Check here Streaming from custom directories for more details.

I am a lazy boy, moreover, the default path works fine. But i need to do some transcoding between flv and mp3. So i must get the saved file absolute path. Below is my code for getting the path.

Email me or leave a message when you find a better way!!



import ...;

public class Application extends MultiThreadedApplicationAdapter{
  public String getDefaultStreamPath(IScope scope, String name) throws IOException{
    IStreamFilenameGenerator generator = (IStreamFilenameGenerator) ScopeUtils.getScopeService(scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
    String recordingFilename = generator.generateFilename(scope, name, ".flv", GenerationType.RECORD);
    File file = scope.getContext().getResource(recordingFilename).getFile();
    return file.getAbsolutePath().replace("", "\");  // Windows path


4 thoughts on “red5 get default stream file absolute path

  1. 很可惜,链接中的那篇文章不见了。而且调试也不能成功,不知道为什么。肯能是那三个配置文件的问题吧。。

Leave a Reply

Your email address will not be published. Required fields are marked *