[Live-devel] Recording stream in multiple files

Fantomas fant0m4s at gmail.com
Wed Aug 1 09:41:05 PDT 2007


Hi,
I'm recording a stream to a .mov file using a QuickTimeFileSink, with
code based in the openRTSP example.
I need to record the stream in multiple videos with a arbitrary
duration, so every 30 seconds I close the sink and open a new with
another file name.
I modified the QuickTimeFileSink and added the metod stopPlaying, to
prevent a segmentation fault when I open the new sink.

I can record without problems, but when I try to see the videos with
mplayer, in all of them (except the first) I get a few seconds with a
black screen at the beginning and the message
"[mpeg4 @ 0x87ff79c]warning: first frame is no keyframe."

What could be the problem?

The code of stopPlaying is:

void stopPlaying()
{
	MediaSubsessionIterator iter(fInputSession);
	MediaSubsession* subsession;
	while ((subsession = iter.next()) != NULL)
	{
		// Ignore subsessions without a data source:
		FramedSource* subsessionSource = subsession->readSource();
		if (subsessionSource == NULL) continue;
	
		// First, tell the source that we're no longer interested:
		subsessionSource->stopGettingFrames();
		
		// Cancel any pending tasks:
		envir().taskScheduler().unscheduleDelayedTask(nextTask());
		nextTask() = NULL;
		
		subsessionSource = NULL; // indicates that we can be played again
		fAfterFunc = NULL;
	}
}

Thanks in advance and sorry my english, it's not mi native language.
Manuel Carrizo


More information about the live-devel mailing list