flash-media-server

Recording video in adobe media server 5 gives invalid file


I just installed a testing version of Adobe Media Server 5 and I'm trying to create an application that will save the videos to disk for later play.

I've found code online that suggests stream.record(), but this results in an FLV file with the correct name, but is less than a kB in size. Inspecting the file with mediainfo (a tool) shows me that the duration of the "video" is correct (for example 2 min 27 sec), but it contains no actual data.

Is my code wrong? Or am I missing a setting?

My main.asc:

application.onPublish = function(clientObj, streamObj) {
    streamObj.record("append");
}

application.onUnpublish = function(clientObj, streamObj) {
    streamObj.record(false);
}

All I want is that people can watch live, but there is still a recording for watching later as well (not DVR mode).


Solution

  • The answer is not the code, that works, but it's the CODECs. If I stream using my tool in audio AAC, that doesn't work. If I stream my desktop (that's what the application does) in x264, that doesn't work either.

    If I stream audio in mp3, the file grows.

    Unfortunately, the tool doesn't stream video in another codec, so I can't be sure that video is saved, but I assume so.