Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: vdr cuts recordings with ugly artifacts at cutting-points



On Tue, Apr 15, 2003 at 08:02:42PM +0200, justin case wrote:
> > OK, find the attached patch which sets the broken link flag on
> > every "cuttIn" frame. I did only a short test. It still cuts
> > fine and it seems that the decoder honors the broken link flag.
> > The cutting points are smoother.
> 
> i'll only have time for some testing towards the end of the week :(
> ...
> but i will! :)
> 
> i'll report.

Last night I've cutted a few films.  Hey it works, beside the audio
problem, nearly perfect. No artifacts at the cutting points
anymore.  It is possible to remove a commercial and put a film
sequence together and you don't see it ... sometime audio from
the commercial survive the cutting mark. 

@Klaus: This patch should become part of 1.2.0 ;^)


      Werner

> > The problem of missing audio packets due to audio-video delay
> > still has to be solved.
> >
> > Let me know what you (all) think.
> >
> > Disclaimer: this is experimental code, not well tested. Don't
> > blame me, if it ruins a cut. Backup before testing!
> >
> > diff -urN vdr-1.1.27-orig/cutter.c vdr-1.1.27-cutter/cutter.c
> > --- vdr-1.1.27-orig/cutter.c	2002-08-11 13:09:23.000000000 +0200
> > +++ vdr-1.1.27-cutter/cutter.c	2003-04-15 10:53:56.000000000 +0200
> > @@ -23,6 +23,8 @@
> >    cFileName *fromFileName, *toFileName;
> >    cIndexFile *fromIndex, *toIndex;
> >    cMarks fromMarks, toMarks;
> > +  //
> > +  void BrokenLink(uchar *data, int len);
> >  protected:
> >    virtual void Action(void);
> >  public:
> > @@ -60,6 +62,26 @@
> >    delete toIndex;
> >  }
> >
> > +void cCuttingThread::BrokenLink(uchar *data, int len)
> > +{
> > +  if(data[0]==0 && data[1]==0 && data[2]==1 && (data[3]&0xE0)==0xE0) {
> > +    int index=9+data[8]; // skip video packet header
> > +    for( ; index<len ; index++) {
> > +      if(data[index]==0 && data[index+1]==0 && data[index+2]==1 && data[index+3]==0xB8) {
> > +        if(!(data[index+7]&0x40)) {
> > +          data[index+7] |= 0x20;
> > +          printf("setting broken link flag in CuttIn GOP\n");
> > +          }
> > +        else
> > +          printf("cuttIn GOP is closed\n");
> > +        return;
> > +        }
> > +      }
> > +    printf("no GOP header found in cuttIn video packet\n");
> > +    }
> > +  else printf("no video packet in cuttIn frame\n");
> > +}
> > +
> >  void cCuttingThread::Action(void)
> >  {
> >    dsyslog("video cutting thread started (pid=%d)", getpid());
> > @@ -77,6 +99,7 @@
> >       toMarks.Add(0);
> >       toMarks.Save();
> >       uchar buffer[MAXFRAMESIZE];
> > +     bool cuttIn = true;
> >       while (active) {
> >             uchar FileNumber;
> >             int FileOffset, Length;
> > @@ -126,6 +149,11 @@
> >                   FileSize = 0;
> >                   }
> >                LastIFrame = 0;
> > +
> > +              if(cuttIn) {
> > +                BrokenLink(buffer, Length);
> > +                cuttIn=false;
> > +                }
> >                }
> >             if (safe_write(toFile, buffer, Length) < 0) {
> >                error = "safe_write";
> > @@ -151,6 +179,7 @@
> >                   Index = Mark->position;
> >                   Mark = fromMarks.Next(Mark);
> >                   CurrentFileNumber = 0; // triggers SetOffset before reading next frame
> > +                 cuttIn = true;
> >                   if (Setup.SplitEditedFiles) {
> >                      toFile = toFileName->NextFile();
> >                      if (toFile < 0) {
> >
> >
> > --
> > Stefan Huelswitt
> > huels@iname.com  | http://home.pages.de/~nathan


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index