On Friday 24 August 2007 00:23:10 Hans Verkuil wrote:
> 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

hi,

Thanks a lot for your effort hans, the V4L2_ENC_CMD_STOP_AT_GOP_END if the gap 
between two files is as little as you expect, is exactly what i was looking 
for :)

As the recording machines run on ubuntu feisty with default-kernel i'll switch 
them to 2.6.22 vanilla and exchange ivtv with your latest snapshot.

I dont really need a backport to 2.6.22, as if this whole thing is running 
stable, no one will touch it for the next decade =)

I'll send in some response when i've implemented the changes and let you know 
how it works. Maybe you also want the code of the splitting tool as example 
for your repository. (after rewriting my awfull c code)

Best Regards

        Daniel

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

Reply via email to