Converting MPEG2 to DIVX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Silent Bob
    Junior Member
    Junior Member
    • Sep 2003
    • 9

    Converting MPEG2 to DIVX

    I've got a Hauppauge Nova-T TV card (Digital) and records by saving the mpeg2 stream to the hard disk. I've recorded a tv program but at several points it lost the signal and resulted in a couple of pauses (around 4 secs). The problem is that when it loses signal the sound and video doesn't stop at the same time so when it's converted into divx it goes out of sync.

    I can play the mpeg2 file in windows media player and it plays fine. It just skips the lost frames.

    Is there a program that can be used to repair the file. I've tried a program called PVAStrumento which is supposed to help but it just outputs an out of sync video without the pauses.
  • megamachine
    Video Fiddler
    • Mar 2003
    • 681

    #2
    Good question, Bob, and I've had this problem myself with MPEG-2 capture using an ADS Tech external device. As far as I can tell, you have correctly diagnosed the problem. I've posted this type question before, but haven't really gotten a satisfactory answer. Like you, I tried various fixes, but nothing has worked yet. I'm replying here in the hopes of keeping this thread alive for a while in case someone out there has a way to fix this problem. There are a few people on these boards that do TV and VHS captures, such as rsquirell, but you might want to also try a message board for one of the capture devices, such as ADS Tech or Dazzle, to see if folks there can help you. It seems to me like what we need is something that will fix the corrupted streams not by deleting the bad frames, but by replacing them, thus preserving the sync. There is one thing I've been meaning to try, which is to render the captured MPEG-2 with Video Studio 6 into a DVD compliant MPEG-2 to see if that can somehow replace the bad frames. I've done this to edit out commercials or cut off titles, and it's the only method that does not cause audio sync, so it might help in the DivX conversion. It's time consuming, and will compromise quality, but if you have some time you might want to give that a shot, too.

    Comment

    • Silent Bob
      Junior Member
      Junior Member
      • Sep 2003
      • 9

      #3
      I've been trying loads of different things out to repair the files and have come up with a way that should fix most files.

      PVAStrumento http://www.offeryn.de/dv.htm
      Ulead DVD Factory 2
      Daemon Tools www.daemon-tools.com/
      DVD2AVI http://arbor.ee.ntu.edu.tw/~jackei/dvd2avi/
      Divx Codec
      MP3 Codec
      MPA to WAV convertor http://www.newfreeware.com/audio/1582/
      VirtualDub http://www.virtualdub.org/
      Gordian Knot http://gordianknot.sourceforge.net/

      First run PVAStrumento selecting make ps on the main screen. Then on the window that pops up select 2048 (pc dvd) under packet size. Enter where you want the new mpeg2 file to be placed and press start.

      When thats finished load Ulead DVD Factory and open the mpeg2 file created in the previous step keep all options as default but select the option to create an image file and not to burn a dvd.

      Once the dvd image has been made open daemon tools and mount the dvd image. Try playing it on any dvd player program and it should be in sync.

      Then open DVD2AVI selecting VTS_01_1.VOB on the dvd image. Under audio > output method select demux. Ideally you want to select decode to wav but it didn't work for me so I had to convert the audio to wav later. Leave everything else as default. Then go to file > save avi. Then in the window that appears select the divx codec. Under the codec options I select the bitrate as 3000 so I dont lose any quality. I do this as I don't know the real length of the film after I've cut the adverts out.

      Then I load the MPA to WAV convertor and convert the MPA file DVD2AVI outputs into wav format.

      Then open virtualdub and open the avi file. Under audio select to use the wav file from the previous step. Make sure that under audio and video direct stream copy is selected. Then save to a new avi file.

      You will then have an avi file with the audio (it will be quite big around 2gb). Open the new avi file and select the first portion of the film until the first set of adverts (holding down shift will make it much quicker searching through the film). When it's selected under audio select compression. Choose mp3 and 128bps 4800hz. Leave video on direct stream copy and save to a new avi.

      Copy this step until you have the whole film (minus adverts) in several avi files.

      When I record a film the files it creates are in 2gb chunks so I have to repeat the previous steps with each file.

      Then open virtual dub again opening the first part of the film. Under file choose append avi segment and choose the next part of the film. Repeat this until you have the whole film added. Keep the audio and video on direct stream copy and save as an avi file.

      Open it on windows media player and write down the length of the film.

      Open gordian knot and use the bitrate calculator to work out the video bitrate you want to use.

      Open virtualdub and open the avi file. Under video compression options select divx and the bitrate from the previous step. Make sure that audio is still on direct stream copy. You'll proberbly have to resize the video which can be done under filters in the video menu. Then save it as a new avi and it should be complete.
      Last edited by Silent Bob; 19 Feb 2004, 09:09 PM.

      Comment

      • megamachine
        Video Fiddler
        • Mar 2003
        • 681

        #4
        Quite a procedure, Bob, thanks for giving all the details. I suspected that making the original capture into DVD structure would help. I'll give that a try, too, but wonder if some of the other steps might not be necessary. Once you have the DVD structure on your hard drive (VOB, IFO, etc.), it seems that it would be possible to just treat that as a usual DVD to DivX conversion, and skip some of the steps. Have you tried that? In any case, your procedure is also taking into consideration editing out commercials, which can sometimes cause sync problems. Anyway, I'll give this a shot. Hope we can keep this conversation going and get a variety of methods that can help others with this.

        Comment

        • ormonde
          Digital Video Explorer
          • Dec 2003
          • 3735

          #5
          "Is there a program that can be used to repair the file."

          Try the following:

          1. Load the AVI or DivX file into the most recent version of either VirtualDub or VirtualDubMod

          2. Set "Video" to "Direct Stream Copy"

          3. Select "Check for errors"

          4. Select "Mask bad frames"

          5. Go to "File" and save AVI (F7) with a new filename

          Comment

          • megamachine
            Video Fiddler
            • Mar 2003
            • 681

            #6
            Thanks Ormonde, I've done this before with AVIs, but I need something that can do this with MPGs. Is there such a program?

            Comment

            • ormonde
              Digital Video Explorer
              • Dec 2003
              • 3735

              #7
              "Is there such a program?"

              You can open mpegs in VirtualDubMod, and do the procedure that I outlined, but true, you will have to save as an AVI (compressed or uncompressed). You can always convert the corrected AVI back to mpeg in TMPGENc". It is an extra step yes, but it seems a little more concise than what user "Silent Bob" outlined. I don't know of a program that will directly do this with mpeg files.

              Comment

              • megamachine
                Video Fiddler
                • Mar 2003
                • 681

                #8
                Actually, my goal is to convert the VHS captured MPEG-2 file to DivX. VirtualDubMod worked great, and was much easier than any other method I tried. I loaded the MPEG-2 into VDM, then processed the video stream with DivX. After that, in VDM I saved the audio stream as a WAV and converted that to MP3 with HeadAC3he. Then loaded the MP3 into VDM, disabled the original audio stream, and did a direct stream copy for the video and audio streams, and came out with exactly what I had wanted all along, a DivX copy of a VHS capture. Worked great, easy and fast, so thanks Ormonde, for pointing me to VirtualDubMod. There was one question that arose, and I wonder if you can clarify it. When I loaded the MP3 into VDM, I got a message that it was VBR and asking if I wanted to rewrite the header to CBR, with a warning it would cause sync skew. I said "no" and just copied the stream as is, and it worked fine. But, I was wondering, what is that warning about? Is it better to use VBR or CBR for the audio?

                Comment

                • megamachine
                  Video Fiddler
                  • Mar 2003
                  • 681

                  #9
                  Just a short after thought to the above, I think my problem was using the method to convert a ripped DVD to DivX (DVD2AVI, VFAPI, VirtualDub, etc.), which seems to have introduced some sort of skew into the audio/video sync. This new method above bypasses all of that, so I can just process the captured MPEG-2 with VirtualDubMod. My original assumption that the MPEG-2 was corrupted while capturing from VHS seems to have been wrong.

                  Comment

                  • ormonde
                    Digital Video Explorer
                    • Dec 2003
                    • 3735

                    #10
                    "I said "no" and just copied the stream as is, and it worked fine. But, I was wondering, what is that warning about? Is it better to use VBR or CBR for the audio?"

                    Constant Bitrate Rate (CBR) is the number of frames should be identical to the number of audio samples. In Variable Bitrate (VBR) the number of frames could be as much as twice the number of video frames. For mp3, (CBR) is mostly used, but sometimes can cause a skew problem. You can correct this skew in VDM, but if by ignoring the warning you achieved good audio results, then do whatever works.

                    Comment

                    • techno
                      Digital Video Master
                      Digital Video Master
                      • Nov 2001
                      • 1309

                      #11
                      fyi - you may also wish to visit my website for top tips on capturing from TV/DV

                      Comment

                      • megamachine
                        Video Fiddler
                        • Mar 2003
                        • 681

                        #12
                        Much obliged, Ormonde. And Techno, I'll check your site. Thanks.

                        Comment

                        • ormonde
                          Digital Video Explorer
                          • Dec 2003
                          • 3735

                          #13
                          "Much obliged, Ormonde. And Techno, I'll check your site. Thanks."

                          Glad (We) could be of help

                          Comment

                          Working...