Page 1 of 1

Google Video (*.gvi) to DivX (*.divX) converter

Posted: Mon Jul 30, 2007 8:55 pm
by fsw
The subject should do it...

Code: Select all

; Google Video (*.gvi) to DivX (*.divX) converter
; Removes the Google header and changes the file extension
; to avoid playback issues with various video players
; Warning: more checks should be implemented
; On the other side, it's only an example...
; ...with a lot of IF's
; fsw (July 2007)
;
; more info:
; http://en.wikipedia.org/wiki/Google_Video#GVI_format_and_conversion

  #InFile = 1
  #OutFile = 2
  file$ = OpenFileRequester("Select a file","","Google Video File|*.gvi|All files|*.*",0)
  If file$
    If ReadFile(#InFile, file$) 
      If ReadByte(#InFile) = 82 ;R
        If ReadByte(#InFile) = 73 ;I
          If ReadByte(#InFile) = 70 ;F
            If ReadByte(#InFile) = 70 ;F
              TotalLength.l = Lof(#InFile)
              
              FileSeek(#InFile, 0)
              Repeat 
                Char.b = ReadByte(#InFile)
              Until Char = 76        ;L

              ListPos.l = Loc(#InFile) - 1

              If ReadByte(#InFile) = 73 ;I
                If ReadByte(#InFile) = 83 ;S
                  If ReadByte(#InFile) = 84 ;T
                    ;All ok "LIST" found
                    ;search again
                    Repeat 
                      Char.b = ReadByte(#InFile)
                    Until Char = 76        ;L

                    CorrectPos.l = Loc(#InFile) - 1

                    If ReadByte(#InFile) = 73 ;I
                      If ReadByte(#InFile) = 83 ;S
                        If ReadByte(#InFile) = 84 ;T
                          ;All ok correct "LIST" found
                          Debug ReplaceString(file$, ".gvi", ".divX", 1)
                          
                          If OpenFile(#OutFile, ReplaceString(file$, ".gvi", ".divX", 1))
                            FileSeek(#InFile, 0)
                            *MemoryID = AllocateMemory(ListPos)
                            ReadData(#InFile, *MemoryID, ListPos)
                            WriteData(#OutFile, *MemoryID, ListPos)
                            FreeMemory(*MemoryID)
                          
                            FileSeek(#InFile, CorrectPos)
                            *MemoryID = AllocateMemory(TotalLength - CorrectPos)
                            ReadData(#InFile, *MemoryID, TotalLength - CorrectPos)
                            WriteData(#OutFile, *MemoryID, TotalLength - CorrectPos)
                            FreeMemory(*MemoryID)
                            CloseFile(#OutFile)
                          EndIf
                          
                        EndIf
                      EndIf
                    EndIf
                  EndIf
                EndIf
              EndIf
            EndIf
          EndIf
        EndIf
      EndIf
      CloseFile(#InFile)
    EndIf
  EndIf 
  
  MessageRequester("GVI 2 DivX", "The Program Execution Has Finished")
fsw

Posted: Tue Jul 31, 2007 12:22 am
by Kale
What i do is find a movie on google that i want to download then i follow these steps:

1). Click the download link on the movie's page.
2). Open the downloaded *.gvp file in a text editor.
3). Copy the url listed in the file.
4). paste into a browser address bar and hit enter.
5). download full original movie with no google flash compression.

sometimes the downloaded movie has headers that are missing but it is otherwise ok. You can use SUPER to convert it to whatever format you like. :)