Server-side stream recording with Red5

Filed under ActionScript, Flash Media Server, Java, Red5, Software, Tutorials

This tutorial has been updated. Please check out the new post.

While most developers are content to record video using the NetStream.publish(“streamName”, “record”) API, it is sometimes useful to take FLV snippets from the publishing stream instead. In my opinion, this is one of the greatest features of Flash Media Server (FMS) and Red5. Utilizing this strategy allows the application developer to precisely control when and how much of the video is recorded. While recording via the NetStream function has been available in Red5 since the beginning, recording video from the server-side application has not. In this post, I'll demonstrate Red5's ability to record an FLV with a very simple pair of publish and subscribe flash applications.

I'll jump right in by creating a simple ApplicationAdapter subclass. This step isn't really necessary, however I feel that it is good practice when creating Red5 applications. As your application grows in functionality, you'll have the most essential building block ready to go.

Application.java

public class Application extends ApplicationAdapter {

	...

	/**
	 * Delegate method used to accept/reject incoming connection requests.
	 *
	 * @param conn
	 * @param params
	 * @return true/false
	 */
	@Override
	public boolean roomConnect(IConnection conn, Object[] params) {
		log.debug("New connection attempt from " + conn.getRemoteAddress() + "...");
		// Insure that the listeners are properly attached.
		return super.roomConnect(conn, params);
	}

	/**
	 * Delegate method which logs connection/client/user disconnections.
	 *
	 * @param conn
	 */
	@Override
	public void roomDisconnect(IConnection conn) {
		log.debug("Connection closed by " + conn.getRemoteAddress() + "...");
		// Call the super class to insure that all listeners are properly
		// dismissed.
		super.roomDisconnect(conn);
	}
}

As you can see, there isn't much to it, just a couple of logging statements to track new connections to the application. Next, I'll define a simple service bean to handle the NetConnection calls to start and stop the stream recordings.

StreamManager.java

public class StreamManager {

	...

	/**
	 * Start recording the publishing stream for the specified
	 * IConnection.
	 *
	 * @param conn
	 */
	public void recordShow(IConnection conn) {
		log.debug("Recording show for: " + conn.getScope().getContextPath());
		String streamName = String.valueOf(System.currentTimeMillis());
		// Get a reference to the current broadcast stream.
		ClientBroadcastStream stream = (ClientBroadcastStream) app.getBroadcastStream(
				conn.getScope(), "hostStream");
		try {
			// Save the stream to disk.
			stream.saveAs(streamName, false);
		} catch (Exception e) {
			log.error("Error while saving stream: " + streamName, e);
		}
	}

	/**
	 * Stops recording the publishing stream for the specified
	 * IConnection.
	 *
	 * @param conn
	 */
	public void stopRecordingShow(IConnection conn) {
		log.debug("Stop recording show for: " + conn.getScope().getContextPath());
		// Get a reference to the current broadcast stream.
		ClientBroadcastStream stream = (ClientBroadcastStream) app.getBroadcastStream(
				conn.getScope(), "hostStream");
		// Stop recording.
		stream.stopRecording();
	}

	...
}

This is where the meat of the application lies. The broadcast client starts recording the stream by calling streamManager.recordShow() and stops it by calling streamManager.stopRecordingShow(). In the example broadcast application, I've added a button to the Stage and created a simple onClick function to invoke the server-side methods.

BroadcastController.as

        /**
	 * Handle the record button click events.
	 */
	private function onClick(ev:Object):Void {
		// Record the stream by triggering a server event.
		if (ev.target.label == "Record") {
			// Tell the remote server to start recording.
			conn.call("streamManager.recordShow", null);
			// Re-label the button.
			button.label = "Stop";
		// Stop recording the stream.
		} else if (ev.target.label == "Stop") {
			// Tell the remote server to stop recording.
			conn.call("streamManager.stopRecordingShow", null);
			// Re-label the button.
			button.label = "Record";
		}
	}

Take note, the name of the recorded stream differs from that of the publishing stream. I am using a simple timestamp as a unique name for each new FLV. It is even possible to reuse an existing FLV and append new video data to it. Simply change the second argument of the stream.saveAs() method call to true while reusing the same stream name. Check the streams directory of the recorder application for the output files. Reviewing the FLVs is as easy as opening them up with an FLV player[1].

While this is an interesting bit of functionality, the possibilities are much greater. Consider, for example, a security application that needs to record video when the camera detects movement and also needs to have a unique file for each incident. With some minor tweaks to this example, you've got exactly that. In addition, it would be quite easy to extend this application to extract a JPEG preview snapshot from each FLV using FFMPEG[2].

The example source code for this post can be downloaded here.

1. http://www.wimpyplayer.com Wimpy Desktop FLV Player is a free cross platform (Mac and PC) standalone Flash Video FLV player for you, which will allow you to watch your FLV and SWF videos from your desktop. Check it out.

2. http://www.ffmpeg.org/ FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is developed under Linux, but it can compiled under most operating systems, including Windows.

Liked this post? Share it with others:
  • Digg
  • del.icio.us
  • Facebook
  • DZone
  • email
  • LinkedIn
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis

62 Comments

  1. Posted September 5, 2007 at 9:24 am | Permalink

    Nice post, I’m sure this will help quite a few R5 users out there.

  2. Posted September 8, 2007 at 12:39 pm | Permalink

    Carl, thanks for writing a tutorial on precisely the subject I’m interested in.

    You explain that it is possible to precisely control when and how much
    of the video is recorded. I would like to know if the following level
    of control might be possible:

    A visitor to my website gives permission for Flash to stream video
    from their webcam to my Red5 server. My server records 20 seconds of
    video and then switches to recording audio only.

    My aim is reduce the strain on my server. I need only a few seconds
    of video to identify the user but, after that, only audio is
    necessary.

    Thanks again for your excellent tutorial,

    Donnacha

  3. Posted September 8, 2007 at 2:23 pm | Permalink

    @Donnacha:

    What you are suggesting is possible, sort of. It cannot be done using just 1 stream, though. (AFAIK. Someone please correct me if I am wrong.) You’ll need to open 2 streams, 1 for video and 1 for audio. After your 20 second delay has occurred, then you can stop recording the video stream. If you are clever with your naming strategy, then identifying the streams as being related should be a snap.

    HTH.

  4. silmec
    Posted September 20, 2007 at 6:09 am | Permalink

    Why i’ve got this warning “Service not found: streamManager” when i try to record video? Thanks.

  5. Posted September 20, 2007 at 9:34 am | Permalink

    @silmec:

    I would guess that you did not properly install the application. Make sure that you’ve got a directory named recorder in the Red5 webapps directory. If not, the easiest way to do this to create the recorder directory, then copy the contents of the web directory in the sample application over to it.

  6. Lornzo
    Posted October 21, 2007 at 9:42 am | Permalink

    I tried your application on my Mac.
    the server-side application gets installed and loaded, the flash client turns on my camera but the record button seems not to be enabled and even the log on the server console doesn’t show anything.
    The application is loaded correctly (guess from the log), but there must be a problem while the client tries to connect to the server.
    any hint?

  7. Posted October 22, 2007 at 4:46 pm | Permalink

    @Lornzo:

    The first place I would start is the security settings for your flash player. You’ll need to make sure that they client has permissions to talk to the server. Right click on the player, choose ‘Settings…’ then click ‘Advanced’. Then find the ‘Global Security Settings Panel’ link. Choose ‘Edit locations…’ and select the location of the SWF. Alternatively, you can follow this link and then add the SWF: Global Security Settings Panel

  8. synie
    Posted October 30, 2007 at 6:55 am | Permalink

    Hello,

    thanks for the GREAT tutorial.
    @silmec,
    I got the same problem. If you try to implement this code snippets into your own Red5 project, you have to compare the *.xml files in your WEB-INF with the example-WEB-INF directory. There is the problems solution ;-)

    @Carl,
    I tried to implement the StreamManager in my Red5 application to call it via OpenLaszlo. After some hours, it’s fully implemented and I can execute “recordShow()” via OpenLaszlo. But the Red5 program always fails on creating the ClientBroadcastStream.
    Here is the Log: http://rafb.net/p/j1tcVc38.html
    Any idea, what it could caused by? I’m very new to Red5. I didn’t edit the StreamManager. The functions are still as yours.

    Regards from Germany,
    Mario

  9. synie
    Posted October 30, 2007 at 7:28 am | Permalink

    Ohh, I’m feeling so silly. ;-)
    The problem was, I didn’t change “hostStream” in the record functions into the stream name, the client broadcasted with. Now it’s working, even with OpenLaszlo :-D

    It was a little bit hard, for a newbie like me, to implement this code into an other project. Maybe you should add some lines, which describe HOW.

    Thanks a lot for this great post!!!

    Regards,
    Mario

  10. Lorenzo
    Posted November 13, 2007 at 10:48 am | Permalink

    everything is working ok except audio….
    Is there any setting/code that changes how the audio stream is treated????

  11. Posted November 13, 2007 at 11:36 am | Permalink

    @Lorenzo:

    I did not attach any audio input to the broadcasting stream in my example application. It is fairly straight forward to add though. Within the body of the publish function in BroadcastController.as, check for an active microphone, then attach the microphone to the publishing stream like so: stream.attachAudio(Microphone.get()). Check out the documentation.

    http://livedocs.adobe.com/fms/2/docs/00000576.html#157324

  12. Yuri
    Posted November 14, 2007 at 3:10 pm | Permalink

    Carl, it seems that StreamManager service doesn’t work for me. I’m not getting any log messages from this class. My stream is allways recorded as streams/hostStream.flv and I can’t change it because it seems that StreamManager.recordShow() didn’t called.

    I have this
    in my red5-web.xml, is that enough? May be this issue is because I’m using red5-0.6.3?

  13. Yuri
    Posted November 14, 2007 at 3:11 pm | Permalink

    Sorry, xml can’t be pasted here, i’ve changed the dangerous symbols [bean id="streamManager.service" class="net.sziebert.red5.adapter.StreamManager" singleton="true"]
    [property name="application" ref="web.handler" /]
    [/bean]

  14. Posted November 15, 2007 at 3:14 am | Permalink

    This is definetly a good solution to record stream in live mode.
    Did you find to be any issues with delays caused by request lag combined with the live mode strict sync bahavior?
    For examle you hit record and at review you find out that the server started recording from 2 seconds after you clicked the button. I usually record an onscreen stopwatch to check for this kind of things.

  15. Mario
    Posted November 22, 2007 at 6:19 pm | Permalink

    Is there any way to merge two streams? Like saving different audio and video streams into one file?

  16. Posted November 23, 2007 at 9:17 am | Permalink

    @Cosmin:

    A delay like that is usually due to network latency between the broadcasting SWF and the server. I’ve seen it before and usually implement a buffer when it gets bad.

    @Mario:

    Unfortunately, no. The server acts like a pass-through for the audio and video data and does not offer control over streams such as you describe. I’m not sure that any FMS solution does what you are looking for, however you might look at running a post process using FFMPEG.

  17. Lorenzo
    Posted November 24, 2007 at 5:07 am | Permalink

    @Carl

    could you please point me out some examples of this buffering techniques???

    And what about codecs, is it possible to improve audio & video quality?

  18. Posted November 27, 2007 at 3:40 pm | Permalink

    @Lorenzo:

    Adobe has several good articles on optimizing your video streams. I’d
    suggest that you look at the following as a starting point:

    http://www.adobe.com/devnet/flashmediaserver/articles/performance_tuning_webcasts.html
    http://www.adobe.com/devnet/flashmediaserver/articles/fms_dual_buffering.html
    http://www.adobe.com/devnet/flash/articles/flv_live.html
    http://www.adobe.com/devnet/flash/articles/flv_encoding.html

  19. Judd
    Posted December 16, 2007 at 4:43 pm | Permalink

    This looks great. Exactly what I need!!!

    // I’m a complete newbee to red5 so I apologize in advance if this is a stupid question.

    I’m not clear on how to install this app into my red5 folder tree. You mentioned in one of your follow up comments copying the contents of the web folder into a folder named Recorder under webapps. Where do the other folders go? Also, do I need to add an entry into the build.xml at the root of the red5 tree? Otherwise, how does ant server know about the recorder app?

    A step-by-step install / readme would be the perfect icing on the cake…

    Thanks…

    (BTW, Red5 is awesome. The possibilities it opens up are simply mind boggling…!!!)

  20. matoraze
    Posted January 5, 2008 at 7:05 am | Permalink

    Hi,
    I have Installed red5 server and also the red5chat application.
    Now, In red5chat the text chanting is working fine. I want to implement audio chat in the existing system.
    I have tried but succeeded only in one way audio chat (either can speak other can listen).
    Now my question is how can I make it work for 2 way, both client can speak and listen each other.
    Is there anything i need to do on server side?
    please reply asap.
    thx in adv

  21. Posted January 31, 2008 at 1:51 pm | Permalink

    the idea for a “security application” is good , also there is no need for a special camera that detects movement just a simple webcam and detect the movement using bitmapData object in flash .

  22. lays
    Posted February 3, 2008 at 5:48 pm | Permalink

    Super simple question, where does log.debug print to?

  23. Posted February 8, 2008 at 5:58 am | Permalink

    Dear Carl.
    I like very much your tutorial above about Red5 record streaming. I am trying to build an application Red5-based that record and save images from webcams as FLV video to integrate it into my PHP website .I am PHP and MySQL skilled programmer however as Java i am begginner. I am not experience with Eclipse IDE and J2EE application server as Tomcat, Jetty,etc.. I want run your recorder app in my site. How much you would send me the full package war running to integrate it into my site.

  24. Posted February 14, 2008 at 6:37 am | Permalink

    hi
    I am making a karaoke on red5. I have an mp3 file that plays wile the user sing and record the text. After this I have an mp3 with the song and a flv with the users song. when I play it back I have to syncronize the mp3 and the flv. so the user can hear his own song. this is very difficult. Is there a way that I could merge the two files severside so I could play one file for the user?

  25. Posted February 27, 2008 at 11:40 pm | Permalink

    Hello Stephan,
    To merge the files serverside I think that you will need to use something like FFMPEG to decode the files, merge them and then re-encode them, this would also allow you to specify audio offsets etc to get the voice sync’d up with the video/backing tracks.

    Thanks,
    dBlog.com.au

  26. muthukumar.d
    Posted April 8, 2008 at 9:04 pm | Permalink

    sir,
    i didn’t know the flash action scripting for how do record the sound into server which comes through Microphone ?

  27. Daddel
    Posted April 24, 2008 at 7:40 am | Permalink

    Red5 and its webapps is a powerfull thing. Recording flv files works nice. After this, the flv can be loaded and streamed by rtmp/red5 again.
    Beside loading this flv from filesystem and streaming it, has anyone tried to “load” a flv from http like http://xyz/myfile.flv from inside a red5 webapp and then streamed it over rtmp? With this kind of proxy, interessting approaches will be possible, like grabbing transcoded flvs from tools based on ffmpeg.

  28. Posted April 28, 2008 at 9:04 am | Permalink

    Carl, thank you for the post. I have a question about recording a two person (one-on-one) audio conversation with red5. I believe each side of the conversation will have an incoming stream and an outgoing stream. Person A’s incoming stream will be person B’s outgoing stream and vice versa. On the server I would like to record this conversation as one stream. Not quite sure how to go about this. Do I use RTMPClient on the server and publish both streams to another instance? Is there an easier way.
    Can it be done at all?

    As an aside, in today’s world of youtube video’s and yesterday’s world of podcasts, I believe the compelling form-factor of one-on-one conversation has been overlooked. My goal is to create a place where you will always have someone interesting to talk to, or an interesting conversation to listen to — a place where anyone so inclined can have a base of a thousand devoted listeners.

    I was lucky enough to get a spot on Google App Engine and I’m hosting red5 on Amazon ec2. My code so far is on google code (see the web link). Thanks to anyone who read this far.

  29. Posted May 3, 2008 at 3:25 pm | Permalink

    @Greg:

    The simple answer to your question is yes, but with conditions. Unfortunately the server does not have a means to combine 2 publishing streams. It is, however, possible to utilize ffmpeg to merge the 2 streams and then have Red5 serve the merged stream for subsequent requests. Have a look at the documentation for ffmpeg for more info.

  30. saroj
    Posted May 27, 2008 at 11:47 am | Permalink

    Just wanted to say “thanks a LOTTTTT” for sharing this. You are awesome :)

  31. Moz
    Posted June 2, 2008 at 9:08 am | Permalink

    Hi Carl,

    Is it possible to save recored video on some other Server space rather then.. the one which Red5 Running on it?

  32. Posted June 2, 2008 at 11:05 am | Permalink

    @Moz:

    You’ll want to give this tutorial a look. It’s authored by one of the original Red5 developers.

    http://www.joachim-bauch.de/tutorials/red5/HOWTO-StreamCustomDirectories.txt

  33. Posted June 4, 2008 at 12:54 am | Permalink

    Good day Carl and everyone . . can anyone tell me what can i import to identify the symbol getBroadcastStream();?

  34. Posted June 4, 2008 at 12:02 pm | Permalink

    @kris:

    Check out the JavaDoc for ApplicationAdapter. It has the method you are looking for.

    http://dl.fancycode.com/red5/api/org/red5/server/adapter/MultiThreadedApplicationAdapter.html#getBroadcastStream(org.red5.server.api.IScope,%20java.lang.String)

  35. Mark
    Posted June 28, 2008 at 9:52 am | Permalink

    Hi Carl,
    thanks for this tutorial, very helpful! I am fairly new to Red5 and I am struggling to compile you example. I keep getting an ‘app can not be resolved’ error on line -> ClientBroadcastStream stream = (ClientBroadcastStream) app.getBroadcastStream(
    conn.getScope(), “hostStream”);
    the reason is probably because this variable is not set to the ApplicationAdapter instance but how and where do I set it? Thanks for your help, Mark

  36. Joe Petrelli
    Posted October 4, 2008 at 8:49 pm | Permalink

    Hi, do you guys know if it’s possible to record a stream not from a webcam but from a movieclip? My go is to create an applications where the user start to record his video from the webcam with some kind of effect applied to it, for example, a distor teffect. Something like in this website: http://66.70.39.100/

  37. ashok
    Posted November 27, 2008 at 8:17 pm | Permalink

    first of all please accept a big thank you from my side. this helped me a lot.

    i am very new to this, so had a question.
    i would like to know if a call to “stream.stopRecording()” closes the stream. in my application, the recording is happening only once for every session and i need to restart the tomcat to get another recording session.

  38. Michal
    Posted December 4, 2008 at 4:28 am | Permalink

    This topic is great. Straightforward and easy + works fine.

    But I’ve encountered a problem when migrating your application to AS3. It appears that the streamManager.recordShow is not called. When I publish the stream with “record” I can see my recording on the server, but when trying to call manager, nothing happens. This was working ok with AS2.

    Carl, do you have any ideas?

  39. ashok
    Posted December 14, 2008 at 7:04 pm | Permalink

    could somebody please help me with this issue. i have spent days with this and not able to find what could be going wrong.

    using my server side code, i am able to record only once and the next time i try to record a new stream, i get a InvocationTargetException
    with the below values. this does not help me as i don’t know what could be doing wrong.

    cause null
    detailMessage null
    stackTrace null
    target NullPointerException (id=319)

    the server side call which fails on getting called is

    stream = (ClientBroadcastStream) app.getBroadcastStream(
    conn.getScope(), “hostStream”);

    any ideas what can be going wrong here. why does it work only the first time and it fails after that everytime. the client is in flex and as3.

    private function recordClickHandler():void
    {
    trace(“inside record handler. recording is ” + recording);

    if(this.recording == false)
    {
    publish();
    isRunning = true;
    }

    connection.call(“streamManager.recordShow”, null);
    this.record.enabled = false;
    this.stoprecord.enabled = true;

    }

    /**
    * Creates the NetStream, attaches the
    camera and publishes the stream.
    */
    private function publish():void {

    if(connection.connected)
    {
    trace(“inside publish”);
    ns = new NetStream(connection);
    //ns.attachCamera(cam, 20);

    ns.attachAudio(Microphone.getMicrophone());
    ns.publish(“hostStream”, “live”);
    ns.addEventListener(NetStatusEvent.NET_STATUS, onPublish);

    }
    }

  40. Posted January 27, 2009 at 8:17 pm | Permalink

    hi, im very interested in ur source-code, unfortunately the download link is broken. wuld u mind to provide the code?
    thx tom

  41. Posted January 28, 2009 at 1:02 pm | Permalink

    @Tom:

    Sorry about that. I’ve updated the download url. Please try it again.

  42. tom
    Posted January 28, 2009 at 1:04 pm | Permalink

    thx@link

  43. tom
    Posted February 6, 2009 at 11:58 am | Permalink

    hi, i used ur code and its working fine. thx. now i have a different question: i wanna acheive to store a record about certain stream-details, the one im recording right now, in the database. my application.java already holds a object of my DBManager class. Since i have no idea about Beans, But i know java, my question is: do i need to instantiate a new DBManager Obekt or can i somehow reference to the one db-object i have in application.java, sorta similar how u did it with :
    private Application app;

    thx tom

  44. Posted February 11, 2009 at 11:16 am | Permalink

    Is it possible to

  45. Posted February 11, 2009 at 11:17 am | Permalink

    I’m looking for a way to record video on the client side in maximum quality, then transfer it to the red5 server in however much time it takes. Live isn’t important, but the quality is. Is this tutorial the way to achieve that?

    Thanks!

  46. Posted February 11, 2009 at 12:09 pm | Permalink

    Is any work being done in red5 on the rtmfp front and will this include being able to record?

  47. Posted February 11, 2009 at 4:42 pm | Permalink

    @Greg:

    RTMFP is a peer-to-peer feature of Adobe Air and does not have a server component. It could be compared to the webcam functionality found in yahoo or skype chat. I’m not sure if they will support the ability to record the streams as I’m not very familiar with the spec or with Air. You can read more on the technology here: http://en.wikipedia.org/wiki/Real_Time_Media_Flow_Protocol

  48. Posted February 11, 2009 at 4:46 pm | Permalink

    @Ian:

    Recording is a function of the server and is not supported directly by the flash client. Quality of the stream is simple a matter of the camera used and the capture settings specified when configuring the input source. I’d suggest that you review the livedocs for the Camera object.

  49. Posted September 8, 2009 at 12:55 am | Permalink

    Hi Carl,

    Thanks for the nice post…

    Actually we are facing a very strange problem, where we are unable to record multiple concurrent streams at our server. Once the server starts recording a stream, it doesn’t allow another simultaneous or subsequent request to start recording the new and seperate stream. One stream at a time recording works perfectly fine.

    Another problem/difference I noticed in my code was, at the server, roomConnect / roomDisconnect did not get called during every connection request from the flex component. But instead, appConnect / appDisconnect method get called. (If this makes any sense).

    We are stuck here since many days…Any help or pointer regarding this would be really helpful.

    Thanks in Advance,
    Y. Kamesh Rao

  50. Posted September 24, 2009 at 3:21 am | Permalink

    I deployed the Application and StreamManager to Red5 but red5 can’t load them. I have no idea why.
    I’ve compiled your project (with ant clean compile). I created a new directory called “recorder”/WEB-INF in the webapps folder in Red5. And I put in there the folder classes, lib and red5 configuration files (red5-web.properties, red5-web.xml, web.xml) that i modified so that they are correct. When I call the application localhost/recorder, I get a 503 error. It seems like it can’t load this class: “net.sziebert.tutorials.Application”. Because when I change this web handler to the red file Application Adapter org.red5.server.adapter.ApplicationAdapter I can reach the application.

    Have you got any idea why it can’t find this class? net.sziebert.tutorials.Application
    It’s in the folder: “red5directory/webapps/recorder/WEB-INF/classes/net/sziebert/tutorials/Application.class

    Thank you

  51. Posted September 25, 2009 at 3:49 pm | Permalink

    Paul:

    Not sure why it can’t load the classes. Could have something to do with the folder structure you’ve created. The easiest way to deploy the app is to copy the web directory to $RED5_HOME/webapps and rename it to recorder. Try that and let me know what the outcome is. If you have a stack trace that would be helpful in diagnosing your issues.

  52. Igor
    Posted October 4, 2009 at 9:53 am | Permalink

    Hi Carl,

    I need to broadcast flv file, with ability to connect and disconnect users to stream. I can’t find any docs how to do this. Could you give me some directions or provide me some info about this issue. I would really appreciate it.

  53. Posted November 13, 2009 at 3:16 am | Permalink

    Can I stream with one streaming client and start/stop recording with a different application? Can RED5 accept 2 different connections?

  54. Posted November 13, 2009 at 9:32 am | Permalink

    Using the server-side stream recording technique described in the tutorial, it is completely possible to start/stop recording from a client that is not publishing the stream.

  55. George Vieira
    Posted January 7, 2010 at 12:57 pm | Permalink

    Carl,

    Thanx a lot for this demo. Great job.
    I have some problem, however, in the .flv recorder from the stream, the beggining of the video looks like is missing some images – probably it lacks de initial KeyFrame. Do you have some hint to fix this?

    Thank you

  56. Jaume (Barcelona)
    Posted February 3, 2010 at 4:32 am | Permalink

    Hi Carl, i tried to understand the aim of broadcast recorder and i don’t know if usefull for me, but i’ll try to explain my idea.
    I want emule a radio online (only microphone), if is possible in live mode, but i dont know what i need.
    Broadcast recorder its ok for me?

    Thank u so much for your tutorial and your time.

  57. Posted March 14, 2010 at 12:54 pm | Permalink

    People deserve very good life and business loans or financial loan would make it much better. Because freedom depends on money state.

  58. Posted March 20, 2010 at 7:53 am | Permalink

    Thanks for sharing this information.

  59. Posted May 25, 2010 at 12:43 am | Permalink

    Hi Friends,

    Can anybody tell me,How can I use Red5 for Android Platform.

    Pls reply .
    Thank in Advance.

  60. Matt
    Posted June 22, 2010 at 12:56 pm | Permalink

    Is there a way to record automatically every stream that is published? I’m using the latest FFMpeg to publish videos to red5 via RTMP, and there is no way I can invoke the “recordShow()” function…

  61. Posted October 28, 2010 at 4:35 pm | Permalink

    In the following line app is never defined and throws an error every time. I’ve tried several ways to define app with something that will work but come up short every time…..what is app defined as? How do i resolve the null pointer exception that i’m receiving. I hope this thread is still active.

    ClientBroadcastStream stream = (ClientBroadcastStream) app.getBroadcastStream(conn.getScope(), “testStream”);

  62. Stir Zoltan
    Posted November 30, 2010 at 8:14 am | Permalink

    Hello!

    I have tried to make use of your article, however I’m having some trouble recording videos. I’m using Red5 ver. 0.8 and oflaDemo on server-side. Videos record however, they seem to be broken. It keeps skipping frames, and jumping ahead on play(the frames are there, they are just skipped). Did you encounter anything like this?

6 Trackbacks

  1. By Remote debugging Red5 applications | Carl Sziebert on September 16, 2007 at 12:53 pm

    [...] Red5[1] contributor Paul Gregoire recently added a new server startup script targeted specifically at application debugging. The script is quite simple in nature and is provided in both Windows and Unix flavors. Take note, however, that this script is exclusive to the standalone version of Red5. Debugging the WAR version of the server is quite a different task. To demonstrate the ease of debugging your applications, I’ll walk through a simple example using Eclipse[2] and the source code from my stream recording tutorial. [...]

  2. [...] While this is an interesting bit of functionality, the possibilities are much greater. Consider, for example, a security application that needs to record video when the camera detects movement and also needs to have a unique file for each incident. With some minor tweaks to this example, you’ve got exactly that. In addition, it would be quite easy to extend this application to extract a JPEG preview snapshot from each FLV using FFMPEG[2]. [...]

  3. [...] Take note, the name of the recorded stream differs from that of the publishing stream. I am using a simple timestamp as a unique name for each new FLV. It is even possible to reuse an existing FLV and append new video data to it. Simply change the second argument of the stream.saveAs() method call to true while reusing the same stream name. Check the streams directory of the recorder application for the output files. Reviewing the FLVs is as easy as opening them up with an FLV player[1]. [...]

  4. [...] [yoy] Carl Sziebert » Server-side stream recording with Red5 …is a software engineer with a keen interest in streaming media applications. [...]

  5. By record streaming - StartTags.com on January 24, 2010 at 3:47 pm

    [...] INetGet couldn't work for that. So, Is they're a way to record an audio streaming with an AutoIt …Carl Sziebert Server-side stream recording with Red5While most developers are content to record video using the NetStream.publish(streamName, record) [...]

  6. [...] popular blog topic, I felt the time has come for a little update. (You can catch up on the original here.) Frankly, there’s not much too it. The server-side code didn’t change much, just an [...]