[mythtv-users] Automatic splitting of recordings based on filesize

Andrew Dodd atd7 at cornell.edu
Tue Jan 13 18:06:02 EST 2004


Quoting Randy Perkins <randyperkins at randyperkins.com>:

> On Tue, 2004-01-13 at 13:03, Andrew Dodd wrote:
> > Is this possible?
> 
> > 
> > Another use for people who aren't running FAT32 and don't have the 2GB
> limit is
> > to set a 4.7GB limit for easy archival to DVD-R.
> > 
> 
> yes, i would like to be able to do this
Well, I've reached the first step.

WARNING:  EVIL hack follows:

In programs/mythbackend/scheduler.cpp, within Scheduler::RunScheduler(void):
Look for the following lines:
---------
        recIter = recordingList.begin();
        while (recIter != recordingList.end())
        {
            nextRecording = (*recIter);--------
---------

Immediately above them, add the following code:
---------
	QMap<int, EncoderLink *>::Iterator it;
	for (it = m_tvList->begin(); (it != m_tvList->end()); ++it)
	  {
	    if (it.data()->IsBusyRecording())
	      {
		nextRecording = it.data()->GetRecording();
		if (curtime.secsTo(nextRecording->recstartts) <= -1800)
		  {
		    nextRecording->recstartts = curtime;
		    it.data()->StopRecording();
		    it.data()->StartRecording(nextRecording);
		  }
		
	      }
	  }
---------
Change -1800 to however many seconds you want the files to be chunked into.
(1800 sec = 30 minutes.  I could probably safely set this to 40 minutes as I
usually hit 2 GB after around 45 in high quality mode with my current codec
settings, but 30 minutes is a nice even number with lots of margin.)

Don't do this if you're running remote backends.  GetRecording() is currently
designed as a local-only function, mythbackend will go boom if this is called on
a remote backend.  Sometime tonight or tomorrow I'll try to add remote support
for GetRecording(), and eventually remote/local checking of file size.  (This
will be rather unpleasant...  Going to take a lot of digging through code to
figure out how this would be best implemented.)

This almost surely has other unwanted side effects, but it's better than the
backend crashing!  :)



More information about the mythtv-users mailing list