Re: Attempt to solve "ERR: SCR moves backwards, remultiplex input."

View: New views
3 Messages — Rating Filter:   Alert me  

Re: Attempt to solve "ERR: SCR moves backwards, remultiplex input."

by Lawrence D'Oliveiro-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Back on 2nd April 2004, philou <philippe.sarazin@fr...> wrote:

> Like some of you, I had to face some trouble with a recurrent error
> message in dvdauthor (v 0.6.10), "ERR: SCR moves backwards".
>
> This message occurs when the SCR (System Clock Reference) goes backward
> in the data stream that I'm trying to author. After a lot of search on
> the net, I think that there's a case where this is not an error as
> dvdauthor reports it : the SCR can sometimes be reset to zero in the
> middle of a VOB.

I have decided to incorporate this patch. Well, I figure trying to
recover and continue can’t be worse than dying with an error. :)

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dvdauthor-developer mailing list
Dvdauthor-developer@...
https://lists.sourceforge.net/lists/listinfo/dvdauthor-developer

Re: Attempt to solve "ERR: SCR movesbackwards, remultiplex input."

by Martin Crossley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lawrence -

I did quite a bit of work on this issue back in Jun 2008: see
http://www.mail-archive.com/ivtv-users@.../msg08234.html.
Unfortunately for some reason the source code of the patches themselves
seems to have vanished from that site, so I'll dig it out from archive and
sent it to you.

I was taking a lot of input from a hardware MPEG encoder card, that
triggered this problem *a lot*.

I wrote a bit about the causes of the issue here (see in particular "Part 2:
how to patch dvdauthor").

My post here:
http://old.nabble.com/Submission-of-proposed-patch-to-dvdauthor-0.6.14-(affects-dvdvob.c)-p17695878.html 
explains a bit more what the patches are doing

The patches that I developed are probably a bit long in the tooth these days
(they are against version 0.6.14) but I think that they might be helpful for
you to have a look at.

One warning though: while I found that the DVDs produced via this patch work
absolutely fine with my players here (Sony, Denon), I have had reports from
some friends that they don't work in certain older kit.


Cheers - and good luck
MartinC

PS: for the benefit of the list, here is another document I wrote a while
ago, on the subject of how to use the Gimp to do anti-aliased menu text with
dvdauthor.  It's well worth the effort!

http://ivtvdriver.org/index.php/Howto:anti-aliased_menus_and_buttons_with_dvdauthor




----- Original Message -----
From: "Lawrence D'Oliveiro" <ldo@...>
To: <dvdauthor-developer@...>
Sent: Sunday, November 08, 2009 4:52 AM
Subject: Re: [Dvdauthor-developer] Attempt to solve "ERR: SCR
movesbackwards, remultiplex input."


> Back on 2nd April 2004, philou <philippe.sarazin@fr...> wrote:
>
>> Like some of you, I had to face some trouble with a recurrent error
>> message in dvdauthor (v 0.6.10), "ERR: SCR moves backwards".
>>
>> This message occurs when the SCR (System Clock Reference) goes backward
>> in the data stream that I'm trying to author. After a lot of search on
>> the net, I think that there's a case where this is not an error as
>> dvdauthor reports it : the SCR can sometimes be reset to zero in the
>> middle of a VOB.
>
> I have decided to incorporate this patch. Well, I figure trying to
> recover and continue can’t be worse than dying with an error. :)
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Dvdauthor-developer mailing list
> Dvdauthor-developer@...
> https://lists.sourceforge.net/lists/listinfo/dvdauthor-developer
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dvdauthor-developer mailing list
Dvdauthor-developer@...
https://lists.sourceforge.net/lists/listinfo/dvdauthor-developer

Re: Attempt to solve "ERR: SCR movesbackwards, remultiplex input."

by Martin Crossley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here is a copy of my patch against version 0.6.14 (taken from
http://www.mail-archive.com/ivtv-users@.../msg08199.html):

The only file that needs to be patched is dvdvob.c


MartinC

=============================================================

--- src/dvdvob_dist.c 2008-05-30 22:07:22.000000000 +0100
+++ src/dvdvob.c 2008-05-30 22:09:43.000000000 +0100
@@ -240,25 +240,51 @@
         buf[2] == 1 &&
         buf[3] == 0xba )
     {
+ int offs = (buf[17] == 0xbb) ? 24 : 0;
         writescr(buf+4,readscr(buf+4)+tsoffs);

         // video/audio?
         // pts?
-        if( buf[14] == 0 &&
-            buf[15] == 0 &&
-            buf[16] == 1 &&
-            (buf[17]==0xbd || (buf[17]>=0xc0 && buf[17]<=0xef)) &&
-            (buf[21] & 128))
+        if( buf[offs+14] == 0 &&
+            buf[offs+15] == 0 &&
+            buf[offs+16] == 1 &&
+            (buf[offs+17]==0xbd || (buf[offs+17]>=0xc0 &&
buf[offs+17]<=0xef)) &&
+            (buf[offs+21] & 128))
         {
-            writepts(buf+23,readpts(buf+23)+tsoffs);
+            writepts(buf+offs+23,readpts(buf+offs+23)+tsoffs);
             // dts?
-            if( buf[21] & 64 ) {
-                writepts(buf+28,readpts(buf+28)+tsoffs);
+            if( buf[offs+21] & 64 ) {
+                writepts(buf+offs+28,readpts(buf+offs+28)+tsoffs);
             }
         }
     }
 }

+int find_gop(unsigned char *buf)
+{
+    if (buf[14] == 0 &&
+        buf[15] == 0 &&
+        buf[16] == 1 &&
+        buf[17] == 0xbb &&
+        buf[38] == 0 &&
+        buf[39] == 0 &&
+        buf[40] == 1 &&
+        buf[41] == 0xe0)
+    {
+        int i = 42;
+        while (i < 1024)
+        {
+            if (buf[i] == 0 &&
+                buf[i+1] == 0 &&
+                buf[i+2] == 1 &&
+                buf[i+3] == 0xb8)
+                return 1;
+            i += 4;
+        }
+    }
+    return 0;
+}
+
 static int mpa_valid(unsigned char *b)
 {
     unsigned int v=(b[0]<<24)|(b[1]<<16)|(b[2]<<8)|b[3];
@@ -548,7 +574,7 @@
             scanvideoptr(va,buf+i,thisvi,cursect,vsi);
     }
     if( !va->vd.vmpeg )
-        vobgroup_set_video_attr(va,VIDEO_MPEG,"mpeg1");
+        vobgroup_set_video_attr(va,VIDEO_MPEG,"mpeg2");
     // if the mpeg version changed, then rerun scanvideoframe, because
     // scanvideoptr updates the aspect ratio in the sequence header
     if( mpf != va->vd.vmpeg ) {
@@ -824,6 +850,7 @@
 int FindVobus(char *fbase,struct vobgroup *va,int ismenu)
 {
     unsigned char *buf;
+    unsigned char *buf_copy = (unsigned char*) malloc(2048);
     int cursect=0,fsect=-1,vnum,outnum=-ismenu+1;
     int vobid=0;
     struct mp2info {
@@ -837,6 +864,7 @@
         int i,j;
         int hadfirstvobu=0;
         pts_t backoffs=0, lastscr=0;
+        int generate_vobu=0,copy_packet=0,tsoffs=0;
         struct vob *s=va->vobs[vnum];
         int prevvidsect=-1;
         struct vscani vsi;
@@ -869,8 +897,9 @@
             }
             buf=writegrabbuf();

-            i=fread(buf,1,2048,vf.h);
-            if( i!=2048 ) {
+            if (copy_packet == 1 ) {
+                memcpy( buf, buf_copy, 2048);
+            } else if( 2048 != (i=fread(buf,1,2048,vf.h)) ) {
                 if( i==-1 ) {
                     fprintf(stderr,"\nERR:  Error while reading:
%s\n",strerror(errno));
                     exit(1);
@@ -986,6 +1015,38 @@
                 writeundo();
                 continue;
             }
+
+            if( fsect == -1 ) {
+                char newname[200];
+                fsect=0;
+        if( outnum >= 0)
+                 sprintf(newname, "%s_%d.VOB", fbase,outnum);
+                else
+               strcpy(newname,fbase);
+ writeopen(newname);
+            }
+
+            // we should get a VOBU before a video with GOP
+            if( (generate_vobu == 1 || hadfirstvobu == 0) &&
+                copy_packet == 0 && find_gop(buf) )
+            {
+                // create VOBU
+                generate_vobu = 1;
+                copy_packet = 1;
+                memcpy( buf_copy, buf, 2048);
+
+                buf[41] = 0xbf;
+                buf[42] = 0x03;
+                buf[43] = 0xd4;
+                buf[44] = 0x81;
+                memset( buf+45, 0, 2048-45);
+                buf[1026] = 1;
+                buf[1027] = 0xbf;
+                buf[1028] = 0x03;
+                buf[1029] = 0xfa;
+                buf[1030] = 0x81;
+            } else if (copy_packet == 1)
+                copy_packet = 0;
             if( buf[0]==0 && buf[1]==0 && buf[2]==1 && buf[3]==0xba ) {
                 pts_t newscr=readscr(buf+4);
                 if( newscr < lastscr ) {
@@ -997,16 +1058,15 @@
                     backoffs=newscr;
             }
             transpose_ts(buf,-backoffs);
-            if( fsect == -1 ) {
-                char newname[200];
-                fsect=0;
-                if( fbase ) {
-                    if( outnum>=0 )
-                        sprintf(newname,"%s_%d.VOB",fbase,outnum);
-                    else
-                        strcpy(newname,fbase);
-                    writeopen(newname);
-                }
+            if( !hadfirstvobu && buf[0]==0 && buf[1]==0 && buf[2]==1 &&
buf[3]==0xba )
+            {
+                int offs = (buf[17] == 0xbb) ? 24 : 0;
+                if( buf[offs+14] == 0 &&
+                    buf[offs+15] == 0 &&
+                    buf[offs+16] == 1 &&
+                    (buf[offs+17]==0xbd || (buf[offs+17]>=0xc0 &&
buf[offs+17]<=0xef)) &&
+                    (buf[offs+21] & 128))
+                    tsoffs = readpts(buf+offs+23);
             }
             if( buf[14] == 0 &&
                 buf[15] == 0 &&
@@ -1051,7 +1111,7 @@
                         printvobustatus(va,cursect);
                     vsi.lastrefsect=0;
                     vsi.firstgop=1;
-                } else {
+                } else if (generate_vobu == 0 || copy_packet == 1) {
                     fprintf(stderr,"WARN: System header found, but PCI/DSI
information is not where expected\n\t(make sure your system header is 18
bytes!)\n");
                 }
             }
@@ -1369,6 +1429,7 @@
         }
     }
     writeclose();
+    free(buf_copy);
     printvobustatus(va,cursect);
     fprintf(stderr,"\n");
     free(crs);





----- Original Message -----
From: "Martin Crossley" <martin@...>
To: "Lawrence D'Oliveiro" <ldo@...>;
<dvdauthor-developer@...>
Sent: Sunday, November 08, 2009 7:22 PM
Subject: Re: [Dvdauthor-developer] Attempt to solve "ERR: SCR
movesbackwards,remultiplex input."


> Hi Lawrence -
>
> I did quite a bit of work on this issue back in Jun 2008: see
> http://www.mail-archive.com/ivtv-users@.../msg08234.html.
> Unfortunately for some reason the source code of the patches themselves
> seems to have vanished from that site, so I'll dig it out from archive and
> sent it to you.
>
> I was taking a lot of input from a hardware MPEG encoder card, that
> triggered this problem *a lot*.
>
> I wrote a bit about the causes of the issue here (see in particular "Part
> 2:
> how to patch dvdauthor").
>
> My post here:
> http://old.nabble.com/Submission-of-proposed-patch-to-dvdauthor-0.6.14-(affects-dvdvob.c)-p17695878.html
> explains a bit more what the patches are doing
>
> The patches that I developed are probably a bit long in the tooth these
> days
> (they are against version 0.6.14) but I think that they might be helpful
> for
> you to have a look at.
>
> One warning though: while I found that the DVDs produced via this patch
> work
> absolutely fine with my players here (Sony, Denon), I have had reports
> from
> some friends that they don't work in certain older kit.
>
>
> Cheers - and good luck
> MartinC
>
> PS: for the benefit of the list, here is another document I wrote a while
> ago, on the subject of how to use the Gimp to do anti-aliased menu text
> with
> dvdauthor.  It's well worth the effort!
>
> http://ivtvdriver.org/index.php/Howto:anti-aliased_menus_and_buttons_with_dvdauthor
>
>
>
>
> ----- Original Message -----
> From: "Lawrence D'Oliveiro" <ldo@...>
> To: <dvdauthor-developer@...>
> Sent: Sunday, November 08, 2009 4:52 AM
> Subject: Re: [Dvdauthor-developer] Attempt to solve "ERR: SCR
> movesbackwards, remultiplex input."
>
>
>> Back on 2nd April 2004, philou <philippe.sarazin@fr...> wrote:
>>
>>> Like some of you, I had to face some trouble with a recurrent error
>>> message in dvdauthor (v 0.6.10), "ERR: SCR moves backwards".
>>>
>>> This message occurs when the SCR (System Clock Reference) goes backward
>>> in the data stream that I'm trying to author. After a lot of search on
>>> the net, I think that there's a case where this is not an error as
>>> dvdauthor reports it : the SCR can sometimes be reset to zero in the
>>> middle of a VOB.
>>
>> I have decided to incorporate this patch. Well, I figure trying to
>> recover and continue can’t be worse than dying with an error. :)
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and
>> focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Dvdauthor-developer mailing list
>> Dvdauthor-developer@...
>> https://lists.sourceforge.net/lists/listinfo/dvdauthor-developer
>>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Dvdauthor-developer mailing list
> Dvdauthor-developer@...
> https://lists.sourceforge.net/lists/listinfo/dvdauthor-developer
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dvdauthor-developer mailing list
Dvdauthor-developer@...
https://lists.sourceforge.net/lists/listinfo/dvdauthor-developer