On Friday 24 August 2007 00:06:04 Mark Paulus wrote:
> Hans Verkuil wrote:
> > On Thursday 23 August 2007 18:00:50 Daniel Selinger wrote:
> >> Hi,
> >>
> >> I have a problem where you hopefully can help me with.
> >>
> >>
> >> closing the device and reopening it is also no option because this
> >> way i loose around 2 seconds between two files.
> >
> > The second option is to use the new VIDIOC_ENCODER_CMD ioctl to
> > stop and start the encoder each hour. You have to set the
> > V4L2_ENC_CMD_STOP_AT_GOP_END flag for the STOP command which
> > ensures that the stream is ended correctly at a GOP boundary (even
> > the program stream end marker is filled in). After executing the
> > STOP command you will need to keep on reading until read() returns
> > 0 (end of file). Only then can you close the file and open a new
> > one.
> >
> > After that you can either just read() again (this will kickstart
> > the encoder) or explicitly call the VIDIOC_ENCODER_CMD ioctl with
> > the V4L2_ENC_CMD_START command.
> >
>  > Based on some experimentation it looks like the second option
>  > might be
> >
> > best: the MPEG files are guaranteed to be well-formed and the time
> > lost between the stop/start looks to be minimal.
> >
>  > Regards,
> >
> >     Hans
>
> Once he does the close ioctl call, couldn't he start writing the
> output to both files?  The first file would be closed/truncated
> correctly, and the 2nd file would have an additional little bit of
> overlap, so there wouldn't be anything lost, and just a tiny bit of
> extra?  Then when he gets the 0 return, just close the old file?

No, that doesn't work because the second file wouldn't start with a 
proper MPEG header. That's just what we try to avoid. I should also 
mention that the reads after the stop command finishes are effectively 
instantaneous: you just empty the internal buffers, there is no 
additional capturing involved.

Regards,

        Hans

_______________________________________________
ivtv-users mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-users

Reply via email to