VideoHelp Forum
+ Reply to Thread
Page 1 of 4
1 2 3 ... LastLast
Results 1 to 30 of 98
Thread
  1. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    DJRumpy's SVCD to DVD MPEG Guide
    12/30/04: I'm doing the rewrite to the conversion process in order to help alleviate problems with audio sync. The rewrite breaks down each svcd disk into it's component parts in the script, and then allows you to speed up or slow down the audio to attempt to resync the audio. If your a regular visitor of this guide, please be sure you follow the new guide instructions

    Note: This guide does not include the actual DVD authoring step. It only encompasses the MPEG encoding step. You should refer to a guide specific to your DVD Authoring software for the final authoring step.

    Intended Audience:
    This guide is to assist you in converting from any of the following formats to MPEG:

    SVCD or CVD to DVD MPEG
    AVI/DivX/XviD to DVD
    DVD to DVD

    The primary focus here being SVCD to DVD. By simply changing the output resolution or the SOURCE statement of your script when needed, you can work with any of the above inputs/outputs.
    For AVI to DVD, using the AVISource method instead of Mpeg2Source method (see the AVISynth scripts below).
    For PAL/NTSC conversions, include the AssumeFPS command in your AVISynth script (See AVISynth Scripts below).
    For DVD to DVD conversions, simply loading the DVD VOB's into DVD2AVI, rather than the SVCD MPEG's (see figure 1 below). All of the remaining steps are the same.

    This guide covers the full conversion process. It will also show you how to remove the common 2 second overlap used in many SVCD's. It does not use the patch method. If your looking for an easy way to convert to DVD with little work, then this is not for you. If your player doesn't support the patch method, your a diehard video buff, a perfectionist (or just a bit anal), or you just want to assure maximum compatability with any dvd player, then read on. Assuming your SVCD is from a good source, the loss in quality due to re-compression is unnoticable, while the benefits of a higher resolution for HDTV and compatibility with any DVD player are obvious. I would suggest that in order to use this guide effectively, you should have at minimum, knowledge of the 3 basic types of video (Interlaced, Progressive, Telecined), and a basic knowledge of video itself (frames, fields, frames per second, pal, ntsc, etc…). Do not let the length of this guide scare you. Although the content is somewhat complex for a beginner, the tasks are rather simple.
    Tools You Will Need:
    Frameserving
    DGMPGDec, or DVD2AVI v 1.76 (version 1.77 has problems with MPEG2DEC3.DLL – check the downloads section of http://www.doom9.org/ )
    MPEG2DEC3.DLL (Used to read DVD2AVI D2V Project Files. http://nic.dnsalias.com/MPEG2Dec3v109.zip )
    Editing:
    AVISynth 2.5.2 ( http://prdownloads.sourceforge.net/avisynth2/AviSynth_252.exe?download )
    VirtualDub 1.4.13 or higher ( http://www.virtualdub.org/index )
    Encoding:
    CCE version 2.66 or higher suggested ( http://www.cinemacraft.com/eng/home.html )
    Finalizing:
    Pulldown.exe ( http://www.doom9.org )
    Pulldown GUI ( http://guiguy.wminds.com/downloads/pulldownbatchfe/ )
    Audio:
    BeSweet ( http://dspguru.doom9.net/ )
    BeSweet GUI ( http://dspguru.doom9.net/ )
    Optional Software:
    VCDGear ( http://www.vcdgear.com/ )
    TMPGenc
      Note: when searching for files on doom9.org, ensure you click any one of the ‘Show All Files’ in the Download section to see the full list of available files. The section in which you click the ‘Show All Files’ doesn’t matter. It will expand the full list for all sections.[/list]
        Important Information: The example video used in this guide is PAL (480x576). This guide will work for either NTSC, or PAL, just keep in mind that the example video’s vertical height is 576. I try to remind you of this when it affects your project. For this guide, the final output will be NTSC DVD, but it will be noted so you can remove the conversion components if desired.[/list]Installing your software:
        Install all of the above packages that require it. The encoder, and AVISynth both require you to run setup programs. BeSweet, and BeSweet GUI do not have a setup program, but you will need to point the BeSweetGUI to the location of your BeSweet.EXE file. The remaining software can execute directly out of the folder you unpack it in, without installation. To test your installation of AVISynth, simply open Notepad (or any text editor), and type the following line of text:
        Version()
        Save the file, and call it version.avs
        Double click the file. When prompted to select the program to view it, choose Windows Media Player (ensure you do not select ‘Media Player’…it must be ‘Windows Media Player’). The file should play, displaying version information. If it does not, refer to the AVISynth troubleshooting documentation. If the VERSION.AVS script played properly, you can delete it.
        Extract each of your MPEG’s from the source CD if you haven’t done so already. If you have VCDGear, you can use the MPEG -> MPEG option to retrieve your MPEG’s by opening the MPEG directly on the SVCD disc with VCDGear. This is the method I suggest, rather than copying them directly from the disc via explorer. If you do use VCDGear, ensure the ‘splitting’ option is turned OFF, and you select ‘Fix MPEG Errors’. Save all of the MPEG’s to the same folder, using the same naming convention for each (i.e. MPEG1.mpg, MPEG2.mpg, MPEG3.mpg)
        Play the first MPEG using your player of choice, and scan to the very end of the mpeg. Note the ending scene and timestamp. Open the next mpeg, and see if there is any overlap. Most SVCD’s created using DVD2SVCD add a 2 second overlap, causing the same 2-second scene to be played over again where the MPEG’s are joined. Simply note if this is the case, and proceed to the next step.
        Open the MPEG's with DVD2AVI by pressing F3.
        (Figure 1)


        Ensure that ‘Files of Type’ is set to All Files (*.*). Browse to and select your first MPEG. Click OK. If there are multiple MPEG’s from multiple SVCD disks, do NOT add all of the MPEG files here. Repeat the following steps in DVD2AVI for each disk, starting from this point, where you load an mpeg, through all of the following steps, to the point where you save the project file (see below). After you have saved a project file for the current disk (see below), then start again at this point, adding only the next MPEG (disk) in the set to DVD2AVI, and repeat as necessary, naming each output project file with a number (i.e Disk1.d2v, Disk2.d2v.
        (Figure 2)

        Ensure VIDEO | FIELD OPERATION | FORCE FILM is set to NONE. Press F5 to preview your image:
        (Figure 3)

        Note the framerate of 20 FPS in the right pane (see figure 3). In this example, I’ve forgotten to turn off the FORCE FILM setting, which will skew my PREVIEW framerate and frame type. Ensure it’s turned OFF (set to NONE) when you preview your MPEG.
        (Figure 3a)

        When you preview now, by pressing F5, the proper framerate should be reported (see figure 3b).
        Note: PAL video (25 FPS) sometimes reports interlaced FRAME TYPE, even for Progressive sources. You should manually verify that your source type with VirtualDub MPEG by stepping through a few frames of the video on a busy (high action) scene.
        (Figure 3b)

        Configuring DVD2AVI:
        Under the AUDIO menu:
        Track Number: 1
        Channel Format: Auto Select
        Dolby Digital: Decode
        MPEG Audio: Demux
        48 -> 44.1Khz: Off
        Normalilzation: Disabled
        Under the VIDEO menu:
        IDCT Algorithm: Default (do not change)
        Field Operation: If your previewed video (F5) reports a FRAME TYPE of PROGRESSIVE, or 90% FILM or higher, set this to FORCE FILM. If your VIDEO TYPE is PAL, or your FRAME TYPE is INTERLACED or NTSC, set it to NONE. If your video is PAL video (progressive or interlaced), or 29.97 FPS PROGRESSIVE, do NOT use the force film option. This option is only intended for use with FILM 29.97 frame per second source video.

          IMPORTANT: If you do use FORCE FILM option on a PROGRESSIVE or FILM source, your output D2V file will be 23.976 FPS PROGRESSIVE, not 29.97 fps. This is important to note when setting your CCE Encoder configuration.[/list]Color Space: YUV 4:2:2
          YUV to RGB: TV Scale
          All other video options below that should be unchecked (disabled)
          Select FILE | SAVE PROJECT (or press F4). When prompted for a filename, call your file DISKx.D2V where X is the disk number your saving the project for. Example: your working on the second disk of an SVCD, then name the file DISK2.D2V.
          IMPORTANT: If DVD2AVI generated a WAV file, then rename the WAV file to "DISKx.WAV" and proceed to the next step. If it generated an MPA file, then convert that file to WAV using BeSweet and name the output from besweet "DISKx.WAV". Do not worry about the sample rate. Just convert it to WAV. Ensure you call the converted WAV file: DISKx.WAV (again replace the X with the disk # that your currently working on).

          If DVD2AVI did not produce an audio file (either MPA/MP2 or WAV), then ensure your AUDIO -> OUTPUT METHOD is set to DEMUX. Resave your project file again.


          Editing Your Video (A few notes about AVISynth):
          AVISynth is a frameserver. It feeds each frame of your video to the encoder (or another editor) for processing. It allows us to modify each frame before it is fed to the encoder, making it very versatile. The AVISynth scripts are created with any text editor like Notepad, and saved with an .AVS extension. The text in the script is NOT case sensitive. I simply use capitalization to emphasize spelling, or context. Any text in the AVISynth script, after a pound sign (#), is ignored. Your MPEG2DEC3.DLL file needs to be placed into your AVISynth PLUGINS directory. If you accepted the default AVISynth installation, this PLUGIN directory should be located on your C: drive:
          C:Program FilesAviSynth 2.5plugins
          Place the MPEG2DEC3.DLL file in the above directory.
          Creating your AVISynth Script:
          Open Notepad (or any text editor), and input the following script. Any text after the POUND sign (#) is optional and does not need to be added:
          # Start Here
          # Remember, anything after a pound sign is ignored and optional.
          # If you didn't put mpeg2dec.dll in your PLUGIN dir then
          # you will have to specify the full path to mpeg2dec.dll using the
          # LoadPlugin command.
          # LoadPlugin("c:\foldername\mpeg2dec3.dll")
          # Note: If this script is in the same dir as the D2V file then you only
          # Need to specify the dvd2avi.d2v filename.
          # Your WAV file from DVD2AVI should be in the same directory as
          # your DVD2AVI.D2V file.
          # The AudioDub command mixes your video and audio together into one stream.
          # The ResampleAudio command resamples the audio to 48Khz Which
          # is standard for DVD audio. The next line AssumeFPS is used to convert our
          # framerate from PAL to FILM (25fps to 23.976). Remove this line if you
          # do not want to convert from PAL to NTSC
          clip1=mpeg2source("disk1.d2v")
          aud1=wavsource("disk1.wav")
          # The above assigns disk1.d2v video to clip1 and disk1.wav to
          # the aud1 variable. We'll repeat this again using clip2 and aud2 below.
          clip2=mpeg2source("disk2.d2v")
          aud2=wavsource("disk2.wav")
          # Now we'll join the video and audio from each disk and assign them
          # to the DiskX variables. We won't adjust the audio just yet though.
          # Make sure the DelayAudio statments have 0 as their value for now.
          Disk1=audiodub(clip1,aud1).DelayAudio(0)
          Disk2=audiodub(clip2,aud2).DelayAudio(0)
          # At this point we have each svcd disk assigned to the
          # variables disk1, disk2, disk3 (if applicable), etc...
          # we do this to ensure each disks audio is in sync
          # since each disk may have different audio delays
          # due to corruption in the MPEG stream, CDR write errors, etc.
          # We'll adjust as needed using the value for DelayAudio value
          # on each of the DISKx= lines above.
          disk1++disk2
          ResampleAudio(48000)
          AssumeFPS(23.976,True)
          ConvertToYUY2()
          # End Here
            Note, there is NO space between the parenthesis on the last line (). The Disk1= and Disk2= lines with the DelayAudio commands at the end basically recreate each SVCD disk virtually in AVISynth. The DelayAudio values should be set to 0 initially until we verify that each segments audio is in sync. Save this script with the filename MOVIE.AVS and put it in the same directory as your .D2V files (DISKx.d2v), and WAV files (DISKx.WAV).[/list]
              Notes for PAL/NTSC conversions - The AssumeFPS(framerate, True) command seen in the script above, directly under the ResampleAudio command is used to change your framerate between FILM (23.976fps) and PAL (25fps). The ‘framerate’ value is the desired TARGET framerate you want to convert TO.
              (example: AssumeFPS(23.976,True)
              The TRUE parameter of the AssumeFPS command tells AVISynth to sync your audio to the specified framerate along with the video. Use this command only if you want to convert between PAL and NTSC. If your source was true NTSC, 29.97 frames per second (not telecined film), and you did NOT use the FORCE FILM option, then you would NOT use this command. You would also remove it if you did not wish to convert the framerate from PAL to NTSC or vice versa.[/list]You should now be able to open this script in Windows Media Player, and view your entire movie. You can just double-click it, and select MediaPlayer as the default viewer for your .AVS scripts. If the script does not work, but an error is displayed instead, then Note the line #, and examine that line of your script to see where the problem lies.
              At this point, if your SVCD MPEG’s did NOT have any overlap (or you don’t care if the overlap is in your final product), you can drop the AVS script onto your encoder of choice, and encode (see ENCODING below). If your MPEG’s did have overlap, and you wish to remove it, proceed to the next step.
              Removing Overlap with AVISynth and VirtualDub:
              This part of the conversion is to remove the 2-Second overlap that is common between multi-disk SVCD sets. Many people repeat the last second or two of the previous disc, at the start of the next disk. I guess their memories can't handle the 30 seconds it takes to change disks, and they completely lose their frame of reference. Who knows? In any case, this type of thing makes these conversions more difficult. If your a perfectionist, or even just a little picky, your going to want to remove these. It's rather simple with AVISynth. It requires scanning the video with VirtualDub.
              For this step, we're going to have multiple VirtualDub windows open. If you have any VDub windows open at this time, close them. The relaunch VirtualDub twice, so you have two windows open. Then on the very last line of your AVISynth script (see in red below) put in Disk1 like so:

              clip1=mpeg2source("disk1.d2v")
              aud1=wavsource("disk1.wav")
              clip2=mpeg2source("disk2.d2v")
              aud2=wavsource("disk2.wav")
              Disk1=audiodub(clip1,aud1).DelayAudio(0)
              Disk2=audiodub(clip2,aud2).DelayAudio(0)
              disk1++disk2
              ResampleAudio(48000)
              AssumeFPS(23.976,True)
              ConvertToYUY2()

              DISK1

              Save it (do not close NOTEPAD, just minimize the NOTEPAD window to get the script out of the way), and drag and drop the AVS script onto the first VirtualDub window. Now go back to your AVS Script, and change the last line to DISK2, this time, dragging and dropping your AVISynth script onto the next VirtualDub window. Repeat this for each SVCD disk.

              You may need to launch more VirtualDub windows. You can also resize your VirtualDub window so they don't take up so much space.
              Drag and drop your VIDEO.AVS file onto VirtualDub.
              (Figure 4)

              Move the slider in the first VDub window to the very end (tip: use the right arrow button with a vertical line after it >| to move the slider all the way to the end). The final frame of the first mpeg will typically be all pixilated or a copy of the second to last frame. Do NOT count that frame. Use the frame previous to it (see figure 4)
              In our example, we would pick the previous frame to this one. This is frame 82903, so we will note the first STOPPING point for our first disk is frame # 82903. Jot the frame number somewhere so you can reference it later. Now you need to examine frame 82903. Look for some movement detail that you can easily and accurately identify in the frame. Advance and Reverse the frame over and over again until you spot some motion that is easy to identify in that frame. I usually look at hands, eyes, heads, cars, or whatever, and then note when they connect with other objects in the frame (i.e a car passing a person on the street). We’re going to look for this same 'event' in the duplicated frame on the next VDub window. (IMPORTANT: If the last frame is too hard to spot due to lack of motion, then pick any duplicate frame between each mpeg segment. It doesn't have to be the last frame, I just pick the last frame because they tend to be the easiest to spot).
              Now pull up the next VirtualDub window, which should have the next MPEG video displayed in it. Scan forward about 30 frames from the beginning and start looking for the duplicate frame from your first VDub window (remember frame 82903 from the first VirtualDub window). When you do find the duplicated frame, note the frame number of the duplicate frame, and then advance one frame. If our ending FRAME # in figure 4 for MPEG1 is 82903, and the same frame is found in the second MPEG at around frame # 48, then you would simply add one to that number to get the START frame for your second MPEG (48 + 1 = Frame #49) (see figure 4 above).
                (TIP: You can get a good estimate of where the duplicate frame is by adding two seconds worth of frames to next mpegs start frame. For example, if we are working on an video which has a 23.976 frame per second rate, and we have a 2 second overlap between the current and the previous MPEG then simply add 2 seconds worth of frames to figure out where the start frame should be (approximately). Do this by multiplying your framerate (23.976 in this example) times 2 (23.976x2 = 47.952) and round up or down to the nearest whole number. If we add 48 frames (47.952 rounded up) to our 2nd mpeg's start frame of 0, you get 48. In our above example, our duplicate frame was at 48, so we can get very close to our target duplicate frame. Then its only a matter of going forward or back a few frames to find the exact point where they match)[/list]Repeat this process for each MPEG in your project. You should have a STOP and START frame where each MPEG overlaps. In my example, this is a two disk set, so I only have one set of STOP and START frame numbers ( 1st disk stop = 82903, 2nd disk start = 49 ). Again, these values are only examples. Yours may be different.


                Finding Letterbox and Aspect Ratio:
                While we have our video open in VirtualDub, this is a good time to find out what aspect ratio our movie is, and how large our letterbox area is (in pixels). Because we’re converting to DVD, we will be converting our movie to Widescreen. If your project is not a letterboxed movie (i.e. it’s fullscreen), then you can skip this step and go on to ‘Modifying Our AVISynth Script’.
                In VirtualDub, with our VIDEO.AVS script loaded, select VIDEO | FILTERS from the Vdub menus’.
                Click the ADD button to see the full list of filters.
                Scroll through the list and locate the ‘Null Transform’ filter. Highlight it and click OK.
                (Figure 5)

                Once you add the Null Transform filter, the ‘Cropping’ button should now be available (no longer grayed out) (see figure 5). Click the Cropping button.
                You may have to drag the slider into the movie a bit, as the first frame is almost certain to be black. Just move it into the movie (any spot is fine), until you can see an image in the preview screen.
                Use the Y1 and Y2 offsets to remove the letterboxing. When the letterboxing has been covered completely in gray (top and bottom), note the Y1 and Y2 offset values. You will need these later. In my example they are Y1=125, Y2=125 (see figure 5a)
                (Figure 5a)

                Modifying Our AVISynth Script:
                At his point, we have found the frame numbers, so we can exlude any overlap frames for each MPEG. If our movie was letterboxed, we’ve also found out exactly how high each letterbox is, in pixels, so we can remove them and resize our video. If you movie was not letterboxed, then you should have skipped that step. We are now ready to put all of these values into our AVISynth script (VIDEO.AVS).

                Open Notepad (or whatever editor your using). If your editor supports drag and drop (notepad does), you can simply drag and drop your VIDEO.AVS file onto it, or select FILE | OPEN, set the FILES OF TYPE setting to ALL FILES and browse to your VIDEO.AVS file. From here on out, I’ll remove any remarks ( pound signs # ), so they do not clutter our script. It should look similar to this:

                clip1=mpeg2source("disk1.d2v")
                aud1=wavsource("disk1.wav")
                clip2=mpeg2source("disk2.d2v")
                aud2=wavsource("disk2.wav")
                Disk1=audiodub(clip1,aud1).DelayAudio(0).Trim(0,82903)
                Disk2=audiodub(clip2,aud2).DelayAudio(0).Trim(49,0)
                disk1++disk2
                ResampleAudio(48000)
                AssumeFPS(23.976,True)
                ConvertToYUY2()

                Note the addition of the .TRIM statements to each DISKx= line. The first takes the first mpeg clip from frame 0 to frame 82903. The second takes the 2nd mpeg, starting at frame 49, to the end.

                We should now start checking each disk for audio sync. You do this by simply adding the DISKx variable to the last line of our script. This is a temporary addition. Since we put the DISKx at the end of our script, whatever video/audio is stored in that variable will be the scripts' output. This lets us quickly play each 'virtual' svcd disk to verify the audio from that disk is in sync. (IMPORTANT: Remember to remove this temporary DiskX line when we move onto the next step - Figuring Resize Values for your Aspect Ratio).

                clip1=mpeg2source("disk1.d2v")
                aud1=wavsource("disk1.wav")
                clip2=mpeg2source("disk2.d2v")
                aud2=wavsource("disk2.wav")
                Disk1=audiodub(clip1,aud1).DelayAudio(0).Trim(0,82903)
                Disk2=audiodub(clip2,aud2).DelayAudio(0).Trim(49,0)
                Disk1++Disk2
                ResampleAudio(48000)
                AssumeFPS(23.976,True)
                ConvertToYUY2()
                Disk1

                  Save the above script and drag/drop it onto Media Player or VirtualDub (you must drag/drop it back onto your VDub or Media Player after each save). Check the audio at both the beginning of the video segment your checking, and at the end of the video segment. If the audio is NOT in sync, change the .DelayAudio(0) '0' value (see in red above) to either a negative or a positive value. If you have added DISK1 to the bottom of your script, then you would modify the Disk1= line containing the DelayAudio statement in the middle of your script. You can use decimal values (examples: DelayAudio(-.3) is valid, DelayAudio(.3) is valid, and so is DelayAudio(1.7). When you get the audio for each DISKx in sync, then just change the DISKx variable (in blue above) at the bottom of your script to examine the next disks for audio sync. When you have the audio properly in synce for all the disks, remove the DISKx variable from the bottom of your script, save your script, and proceed to the next step.[/list]
                  Our script should look something like this up to this point (again these are examples, your DelayAudio and Trim statements will probably be different). If your audio was in sync, your DelayAudio setting for that disk will remain 0:

                  clip1=mpeg2source("disk1.d2v")
                  aud1=wavsource("disk1.wav")
                  clip2=mpeg2source("disk2.d2v")
                  aud2=wavsource("disk2.wav")
                  Disk1=audiodub(clip1,aud1).DelayAudio(1.2).Trim(0,82903)
                  Disk2=audiodub(clip2,aud2).DelayAudio(-.3).Trim(49,0)
                  disk1++disk2
                  ResampleAudio(48000)
                  AssumeFPS(23.976,True)
                  ConvertToYUY2()

                  When your done, you should verify your results by saving your script and playing the script in Windows Media Player, or VirtualDub, and verifying the splice area’s appear to play relatively smooth and that the audio is in sync throughout the video. Don’t forget to save it and drag and drop it onto your player of choice before you play it. If it jerks badly, repeat the steps to isolate your duplicate areas, and try again. Just remember you can put any variable as the last line of your script to quickly isolate any part of your video for playback (example: Disk2 at the end would play only disk 2). This is sometimes usefull if you have to go back to find your frame overlap again. Depending on the speed of your PC, you may see a very slight jump due to realtime filter. If in doubt, simply encode a small sample and view the resulting AVI.

                  If you continue to have audio sync issues, a good workaround it to drag & drop your MPEG onto TMPGenc. The AUDIO file should populate with the dropped MPEG's filepath. Clear any information in the VIDEO SOURCE line, and from the FILE menu, select OUTPUT TO FILE -> WAV File. Save the WAV file to your project directory, and call the wav file according to hte disk # your working on (i.e. if your working on the first disk of your SVCD set, then call the WAV file DISK1.WAV


                  TIP: To work around audio sync issues, use TMPGenc if you have it. TMPGenc seems to preserve the duration (play length) of the audio regardless of any corruption in the stream. I would actually suggest that you use this method when pulling the audio from SVCD disks, rather than using the audio generated from DVD2AVI.


                  Figuring Resize Values for your Aspect Ratio:
                  The last thing to consider for editing is Letterboxing and Aspect Ratio. If your movie is letterboxed, you can remove the letterboxing, and convert it to proper 16:9 Widescreen. Even if you have only a 4:3 television, you should do this. A DVD player will handle Widescreen sources, and properly letterbox it for you, if you have a 4:3 television. This way it will display properly on both types of displays.
                    TIP: You can also specify that your DVD will display fullscreen on a 4:3 television when done this way.[/list]If your movie is Fullscreen (4:3), then skip to ‘Resizing and Letterboxing for your DVD’.
                    Now onto the Gruesome stuff. Converting your 4:3 SVCD back to 16:9. This assumes of course that your SVCD is letterboxed.
                    To convert your 4:3 letterboxed video back to Widescreen 16:9, you have to remove the letterboxing. Since your probably new at this, you'll want to use a GUI to do this, as it's easier to discern the crop values by clicking than guessing. Once you get good at this, you can eyeball a video at 20 paces. This is why I had you use VirtualDub to determine the letterbox heights while we had it open (see figure 5 and 5a).
                    To crop the letterboxing from your video, you use the CROP command in AVISynth. There are faster ways to do this, by specifying the long format of a resize command, but it’s very confusing to beginners, so I’ll use each command separately. The syntax is as follows: Crop(left,top,adjusted_width,adjusted_height). In our example, we found that the top letterbox was 125 pixels. Our bottom value was also 125. IMPORTANT: NEVER crop by odd values. It changes the field order of your video. Even if you don’t understand what field order is, just remember. You should always crop by even values.
                    Now, on to the CROP command. As I explain each step of this command, I’ll fill in the value we’re working on. Do not place this command into your script 4 times .
                    Since we know that we want to retain all of our width of 480 pixels (SCVD = w480 x h480), or for PAL video ( SVCD = w480 x h576 ), our LEFT crop value will be 0 (crop 0 pixels from the left):
                    Crop(0,top,adjusted_width,adjusted_height)
                    Since our top letterbox was in my example is 125 (round it to 126, or 124 to make it even…we’ll use 124 for our example), we plug that into the TOP value:
                    Crop(0,124,adjusted_width,adjusted_height)
                    The adjusted_width value is equal to your video’s original width, minus the amount you cropped from the LEFT. Since we cropped nothing (0) from the left, (480-0=480), then this value would be 480:
                    Crop(0,124,480,adjusted_height)
                    How do you figure out the adjusted_height? By using a method similar to the one we used to find our adjusted_width value. Subtract the TOTAL amount of letterboxing, with the total being both top and bottom values. We’re cropping (remember, 124 from top, and 124 from bottom – 124x2=248 ) 248 from the original HEIGHT of 576 pixels. Our example video is PAL so we do the following: height(576)–cropped(248)=adjusted_height(328). Lets plug in our final value of 328:
                    Crop(0,124,480,328).
                    NOTE: If, after removing our letterboxing, and our example video was NTSC 2.35:1, then we would be cropping approximately 104 pixels from top and bottom (104x2=208 pixels total), so our math would be height(480 NTSC) – 208 = 272 for our new NTSC adjusted_height. If our example video was NTSC 1.85:1 then we would be cropping approximately 60 pixels from top, and 60 from bottom (120 total).
                    (figure 6)

                    If I've lost you completely, don't worry. You don't have to understand it to use the command. Just remember that the LEFT, and adjusted_width values can't be more than your movies original width (you can't crop what isn't there). The same is true for your TOP and HEIGHT values.
                    If you still want to desperately understand the CROP command, there is another syntax that can be used. Instead of specifying the adjusted_width and adjusted_height, you specify the amount to crop on each side. The right and bottom values are expressed as negative (-) numbers if they aren't = 0 (you can't have a negative -0 now can you? ). To use this syntax, give our example values, it would look like this:
                    Crop(0, 124, 0, -124)
                    This would crop 0 from the left, 124 from the top, 0 from the right, and 124 from the bottom. Many find this syntax much easier to understand.
                    Ok, crop command in hand, we would make a script that looks like the one below. Since we’re putting the CROP command at the very bottom, all previous commands that output video (like Clip1 and Clip2) are CROPPED (everything in AVISynth is top down, where the top commands are always performed before the ones below it).

                    clip1=mpeg2source("disk1.d2v")
                    aud1=wavsource("disk1.wav")
                    clip2=mpeg2source("disk2.d2v")
                    aud2=wavsource("disk2.wav")
                    Disk1=audiodub(clip1,aud1).DelayAudio(0).Trim(0,82903)
                    Disk2=audiodub(clip2,aud2).DelayAudio(0).Trim(49,0)
                    Disk1++Disk2
                    ResampleAudio(48000)
                    AssumeFPS(23.976,True)
                    ConvertToYUY2()
                    Crop(0,124,480,328)

                    Resizing and Letterboxing for your DVD:
                    Last but not least, we now want to resize it to a DVD resolution. We add the LanczosResize command to finish it off. What we resize to is important. If your video is fullscreen (4:3) video (i.e. it’s wasn’t letterboxed) then your resize command is simple:
                    LanczosResize(720,480)
                    However, if your movie was letterboxed, you may need to add some letterboxing back in. You determine this by figuring out the aspect ratio of your movie. You do this by looking at the image area of your cropped SVCD. In our example, the cropped video is 480x328.

                    An accurate way to find out what aspect ratio your PAL cropped movie uses, is to convert it's vertical back to NTSC (if your video is already NTSC, just use the cropped vertical values with the table below: table 1).
                    If your video is PAL, you do this by multiplying the CROPPED movie vertical height (without any letterboxing), by .8334 ( for example, my PAL movie was 328 pixels cropped ), so...

                    To Convert PAL verticals to NTSC:
                    328 * .8334 = 274 rounded.
                    • (Table 1)
                      NTSC Vertical Values close to 272 are 2.35:1
                      NTSC Vertical Values close to 360 are 1.85:1

                    Use the following as a guide when resizing to DVD resolutions:
                    Aspect Ratio is 1.85:1
                    Resize to full 720x480. No letterboxing
                    >Aspect Ratio is 2.35:1
                    Resize to 720x360, and add letterboxing to complete the horizontal resolution. If your video is NTSC, you would resize to 720x360, and add a 60 pixel high letterbox on top, and 60 pixel high letterbox on bottom:
                    Since we’re converting our example SVCD from PAL to NTSC DVD, and our movie has an aspect ratio of 1.85:1, we’ll be resizing to a full 720x480, without any letterboxing. If our movie, however, had an aspect ratio of 2.35:1, we would be adding a 60 pixel letterbox on top, and one on bottom.
                    360 image height + top60 letterbox + bottom60 letterbox = 480 (NTSC)
                    You do this with the AddBorders command. The command syntax is as follows:
                    AddBorders(left,top,right,bottom)
                    Since we do not need letterboxing on the LEFT or RIGHT side of our video, both those values will be 0, while our top and bottom will be getting 60 pixel high letterboxing:
                    AddBorders(0,60,0,60)
                    At this point, I’ll put two versions of the script. One for a 1.85:1 aspect ratio, and one for a 2.35:1 aspect ratio.

                    1.85:1 NTSC DVD
                    clip1=mpeg2source("disk1.d2v")
                    aud1=wavsource("disk1.wav")
                    clip2=mpeg2source("disk2.d2v")
                    aud2=wavsource("disk2.wav")
                    Disk1=audiodub(clip1,aud1).DelayAudio(0).Trim(0,82903)
                    Disk2=audiodub(clip2,aud2).DelayAudio(0).Trim(49,0)
                    Disk1++Disk2
                    ResampleAudio(48000)
                    AssumeFPS(23.976,True)
                    ConvertToYUY2()
                    Crop(0,72,480,432)
                    LanczosResize(720,480)

                    2.35:1 NTSC DVD
                    clip1=mpeg2source("disk1.d2v")
                    aud1=wavsource("disk1.wav")
                    clip2=mpeg2source("disk2.d2v")
                    aud2=wavsource("disk2.wav")
                    Disk1=audiodub(clip1,aud1).DelayAudio(0).Trim(0,82903)
                    Disk2=audiodub(clip2,aud2).DelayAudio(0).Trim(49,0)
                    Disk1++Disk2
                    ResampleAudio(48000)
                    AssumeFPS(23.976,True)
                    ConvertToYUY2()
                    Crop(0,124,480,328)
                    LanczosResize(720,360)
                    AddBorders(0,60,0,60)
                    Note the differences in the last two lines for the 2.35:1 script. It resizes our video to a vertical height of 360, and adds letterboxing to fill out the vertical height to 480. Both of these will output a video that is 720 pixels wide, by 480 high. At this point, your ready to drop your VIDEO.AVS script onto your encoder. We’re using CCE in this example, but TMPGenc will also accept AVS files. Save your VIDEO.AVS (overwrite your original) and proceed to the next step.
                    Encoding your MPEG with CCE:
                    This guide is intended for CCE versions 2.66 or higher, but it can also be used with older versions. Many of the settings are the same, although the GUI may have changed a bit. There are 5 basic sections to CCE that we'll be using. The ENCODER settings page, the MAIN settings page, the VIDEO settings, the AUDIO settings, and the QUALITY settings. We'll start with the MAIN page.
                    (Figure 1)

                    On the main cce page (see Figure 1), the video's title, number of files, number of frames, duration, encode settings, and audio encode settings are displayed (if they aren't, you need to drag and drop your VIDEO.AVS file onto CCE. It should then display information about your VIDEO.AVS script). Note the 'Duration' reported. Double click the VIDEO.AVS entry on the main CCE page, and you should see the SETTINGS page (see Figure 2).
                    (Figure 2)

                    Each area of interest has been circled in red. Starting on the left side under 'Output Files', we have two checkboxes, for Video, and Audio. Both should be checked. On the right/top of the main page, we have our Video Settings section. The MODE will typically be MPEG-2 (ES,Multipass VBR). Although you can do Multipass CBR (better quality than 1 pass CBR), One Pass VBR (CQ), and regular CBR modes, none of them fully utilize the strengths of DVD.
                    The BITRATE settings are key here. You should use a bitrate calculator for this section. You can use any bitrate calculator, but I would suggest you download the calculator from DVDRHelp, as it is very simple to use, and accurate (see figure 3). You can find it in the TOOLS section.
                    (Figure 3)

                    Enter your video's duration into the calculator. In this example, our video is 1 hour, and 45 minutes long. We set our output media to DVD. Enter the number of DVD's (1 in this case), which will hold 4.37GB of data. Set our audio bitrate (for SVCD to DVD, use 224kbits). The calculator should then report the 'calculated', or 'Average' bitrate. In this case, 5568 kb/s. This is our AVG setting. Regardless of which calculator you use, they should all function similarly. Note your AVG value, and close the calculator.
                    Under the BITRAGE section, enter your MIN setting (I would suggest 0, or 300), then enter the AVERAGE setting from your calculator into the AVG setting under the Bitrate setting. For your MAX, set the bitrate to at least 9300, although technically you can go up to 10035 kb/s (9.8Mb/s). I leave these a hair low in case of bitrate spikes.
                    Set the number of passes to 1 or higher. Select 'Create New File' (use 'existing file' if you've already created a VAF file from a previous first pass). Last but not least, set your Aspect Ratio. In our example, I've converted my video back to 16:9, so I select that here. If your video is full screen, select 4:3.
                    The three checkboxes to the left of the aspect ratio setting are normally not used. They relate to the 3:2 Pulldown detection. Later versions of CCE allow you to detect telecined material, and rather than encoding those duplicate fields, it flags them as telecined, saving bitrate. It's affect is the same as performing inverse telecine on your source material before encoding. I'm not happy with it's performance yet, so I never use the options, but for consistancy, the first enables this 3:2 pulldown detection. The next option, 'Letter box hint', tells CCE that your source has letterboxing. This helps it to properly detect dupicate fields, by ignoring the letterboxed area. This setting has no effect if 3:2 pulldown detection is not enabled. The last flag 'Panscan' changes the playback method used by the player when a 16:9 video is displayed on a 4:3 television. This information is overridden by the IFO's for a DVD, so this setting doesn't seem to serve any purpose. I think it has been removed in later versions.
                    ADVANCED VIDEO SETTINGS:
                    Click the VIDEO button to enter the Advanced Video settings.
                    (Figure 4)

                    Set your settings under advanced as seen in Figure 4.
                    (note that the N/M setting should be set to 4 for best compatability)
                    M=3 and N/M=4 settings: These settings will produce a GOP that is 12 frames in length, which is compatible with PAL, and NTSC.
                    Sequence End Code: Checked. Simply adds code to the end of your video, indicating the end of your video stream.
                    Close All GOPS: Ensures compatability with your DVD Authoring software. Although this can cause a theoretical drop in quality, I've never seen a difference. DVD Bitrates would seem to eliminate this drop regardless, so save yourself any grief, and leave it on.
                    Luminance Level: Set this to 0-255.
                    Click the 'Quantization Matrices' button.
                    Quantization Matrix settings:

                    Select the 'Standard' matrix for DVD video from the drop-down list. The other options to note are 'Ultra Low', used for VCD projects and 'Very Low', which should be used for SVCD. The MPEG Standard matrix can also be used for DVD video, although I've never seen a difference at such high bitrates. Once you've selected 'Standard', click OK to return to the Advanced Video menu. Click OK again to return to the MAIN menu page.
                    AUDIO SETTINGS:
                    Click the AUDIO button to enter the Audio settings page. These are pretty basic, so I'll just list the settings as follows:
                    Audio Bitrage: Use 224 for SVCD to DVD Projects. More is wasted.
                    Mode: Select Joint Stereo
                    Sampling Frequency: 48,000 Hz (per the DVD Spec)
                    Enable CRC: Enabled. Place a check here.
                    Click OK
                    QUALITY SETTINGS:

                    Click the Quality button to enter the quality settings page.
                    From here, you can apply various filters. Typically you will not need these. Ensure everything is unchecked.
                    Quantizer Characteristics: Set this to 16 for DVD projects. Set it to 32 for SVCD/CVD/VCD or interlaced video.
                    Intra Block DC Precision: Set this to 10 for DVD video. Set it to 9 for SVCD/CVD. Use 8 for VCD. Higher settings use more bitrate, and could affect quality on low bitrate projects like VCD, or SVCD/CVD.
                    Block Scanning Order: Set this to ZigZag for progressive video (i.e. you used the 'Force Film' setting in DVD2AVI, or your source was progressive to begin with). For interlaced video, select 'Alternate'.
                    Progressive Frame Flag: If your video is progressive (i.e. you used the 'force film' option in DVD2AVI, or it was a progressive source to begin with), then place a check in the 'Progressive frame flag' checkbox.
                    Click OK to return to the MAIN settings page. At this point, all of your settings should be configured properly. Either click 'Encode Now' to begin encoding immediately, or click OK to return to the ENCODER settings page, and then click the 'ENCODE' button. Either will begin the encoding process.
                    When the encode is done, you should have 3 new files in your project directly. An M2V Video file, and an MPA audio file, and a VAF file (usefull if you need to recreate your MPEG using multipass).

                    If your output was PAL, you can then load your M2V and MPA into the authoring software of your choice. If your project is NTSC, you must perform one additional step...

                    Finalizing your Output
                    You should have downloaded both PULLDOWN.EXE, and PullDownBatchFE, which is the GUI for PULLDOWN.EXE.
                    • Note: This step will create a file that is exactly the same size as your .M2V file. Ensure you have enough space on the target drive (4GB for a DVD project)
                    Launch the GUI tool. If this is the first time you've launched it, you will be presented with a dialog to select the PULLDOWN.EXE file. Browse to the folder you've unpacked it to, select the PULLDOWN.EXE, and then click OPEN.

                    You should then be presented with the main GUI screen. Use the BROWSE button to select your INPUT .M2V file. Once you do, both the Input file and Output file should be pre-filled on the main GUI page:

                    Now you need to check your options. Click the OPTIONS button, and set your options to the following:

                    Note that the only item you need to select is the 'Drop Frame' option. All of the checkboxes either turn on, or off, the corresponding item to it's right. Don't worry if one of the radio buttons is set to something that doesn't match your output. It doesn't do anything as long as it's corresponding checkbox isn't ON. All items, except the Drop Frame checkbox can remain unchecked. When the process completes, you should have a new file in your project directory, with a _PD.mpg extension. This is the file that will need to be loaded into your authoring software, along with your .MPA audio file.

                    Final Word: You may be tempted to start deleting your temporary files at this point. You should resist if space is not an issue, as you may find these files are needed if you decide to re-do any particular step. Save yourself the time and grief and hold on to them until you have viewed your project and are happy with it!

                    Change Log:
                    8/11/2003 - Updated the 'Intended Audience' section with additional info on converting other formats.
                    8/15/2003 - Corrected the CROP values. Some were listed as 356 instead of 328 (thanx misterchuckles). Changed the section on 'Resizing and Letterboxing' to clarify how to spot the source video's aspect ratio.
                    8/17/2003 - Updated the section on obtaining the aspect ratio to clear things up a bit more.
                    8/18/2003 - Added the section for applying Pulldown on your final M2V file. Forgot to add this in the original guide .
                    7/6/2004 - Modified the CCE N/M setting to = 4 to retain maximum compatability with TMPGenc DVD Author .
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  2. Damn... No 'knock' on other guides... But THAT is one clear and concise guide... Versy sweet, indeed. Thanks DJ..

    Question, is there a space between '23.976,' and 'True' in the following portion of the avs script??

    AssumeFPS(23.976,True)

    or

    AssumeFPS(23.976, True)

    ??
    Quote Quote  
  3. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    Spacing is pretty much up to you. Either will work.
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  4. what can i say,this guide os more than i envisaged...man you rock ill say that one more time you rock One big big thank you
    Quote Quote  
  5. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    Thanks aloo. I appreciate it the comment! 8)
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  6. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Did you delete the guide?? Or did it dissapear? (I just did some changes to the forum).
    Quote Quote  
  7. Member
    Join Date
    Mar 2002
    Location
    canada
    Search Comp PM
    i was going to take a look at it,but as baldrick pointed out.....its not there
    Quote Quote  
  8. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    I didn't delete it. Any idea what happend? I'd hate to have to create it again.

    Just let me know Baldrick. I still have the images, just not the text. I tried an image tag, not knowing if it would work, but it appears either the image only shows up in the original post, the images are gone, or they have been moved.

    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  9. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    I could recreate most of it...because I make a static version from all guides ( https://www.videohelp.com/forum/userguides/171216.php )
    Quote Quote  
  10. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    This looks like one of the most recent edits. It's fine. All I've been doing is tweaking some of the text, and fixing a few typos. Thanks Baldrick
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  11. Great Job! This is the best user guide I have seen at this site, I will definitely be using these techniques in my future files.
    Quote Quote  
  12. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Hi DJRumpy..

    I just wanted to add my comment to this guide.. Great !!

    I especially like the details of all the settings. Maybe able to use some of
    them in other projects and things (experiments mostly) and the likes.

    I was especially curious about the CCE v2.66 (trial ver) 's setting under
    the Video, where it has MPEG System setting Packet size: [2,048]
    ..was wondering what that's for, exactly - but you don't have to answer.

    Question though...
    * Can you add a Date Stamp to those areas that you update, if that makes
    ....any sense ??
    I ask this question because I may return at a later date (sometimes, much
    later) and I may be comparing my issues against your Guide, and if you had
    done any changes to certain areas, I could be taining my only tests. Just a
    note for something to considere, w/ the request for a Date Stamp

    just complementing your guide :P
    -vhelp
    Quote Quote  
  13. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    The packet size affects the way the mpeg is streamed (or transferred) from point a, to point b. The stream is broken up into 'packets'. These smaller bits are recombined on the receiving end, back into the mpeg stream. If an error occurs, then the receiving end can simply request the packet again. These packets simply break up the stream into smaller, manageable parts. If they did not do this, then you would have to request the entire stream over again, if an error occurred. If the packet was too small, then you could end up spending more time requesting packets, than playing them. Get the packet size too large, and you could end up waiting too long to get a 'fixed' packet. In either case, do not change the default setting, as you may end up with a coaster. It will not affect quality in any way.

    I'll log any changes to the bottom with dates/time stamps, so it doesn't interfere with the flow of the guide. This way you can read a change log, without having to see all of the change info in the guide itself. I don't expect too many more changes (I'm somewhere around 40 now ). Almost all of them have been spelling corrections, but a few have been to content.
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  14. DJ Rumpy very nice guide... and very pertinent subject matter for me( svcd to dvd ). Well done.

    Thanks DJ Rumpy.
    Quote Quote  
  15. DJ, very sick guide indeed - almost perfect!

    Question for you though, in the cropping section here:

    248 from the original HEIGHT of 576 pixels. Our example video is PAL so we do the following: height(576)–cropped(248)=adjusted_height(328). Lets plug in our final value of 328:

    Crop(0,124,480,328).

    your final cropped height is a value of 328, but a couple of paragraphs down you have a different value of 356:

    Crop(0,124,480,356)
    Since our movie’s cropped size is 480x356, it’s going to be 1.85:1.

    Wouldn't your movie in this example be 480x328 ?

    Did I miss something that added another 28px to your height? If 124x2 is subtracted from 576, you get your original quote of 328. Where did 356 come from?

    Reason I'm asking is because I'm dealing with a PAL 480x576 SVCD and my results came to:

    Crop(0,128,480,320)
    320 being my cropped height is closer to 300 which would translate more to 2.35:1 than 1.85:1. I'm a little confused as to what ratio I should have and the mismatched valued above have me wondering if I'm doing something wrong. Is 320 the right answer judging from the crop parameters?

    Thanks man!

    Chaz
    Quote Quote  
  16. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    Nice catch misterchuckles! You are correct. The crop value should be 328 for this example. I've updated the guide. Just remember that every SVCD can be a bit different. Your crop values may be a bit more, or a bit less than the example ones I used here. If your SVCD has a different aspect ratio than this one, then your values will also be different.

    Just use the VDUB Cropping trick (see figure 5a), to determine what the top and bottom crop values are (rounded to an even number), and add both top and bottom together. In my example, 124 for top, and 124 for bottom ( 124 + 124 = 248). You then subtract that from your movies original height (576 in my example): 576-248 = 328. This number (328 in my example) will always be the last number in the CROP command:
    Crop(0,124,480,328).

    A more accurate way to find out what aspect ratio your PAL cropped movie uses, is to convert it's vertical back to NTSC. You do this by multiplying the CROPPED movie vertical height (without any letterboxing), by .8334 ( for example, my PAL movie was 328 pixels cropped ), so...

    To Convert PAL verticals to NTSC:
    328 * .8334 = 274 rounded.

    Values close to 272 are 2.35:1
    Values close to 360 are 1.85:1


    As for your aspect ratio, your PAL movie is most likely a 2.35:1 video. Your cropped movies was 320. Multiply that by .8334 to get 267. When in doubt, you can do a quick resize to both aspect ratio's, and see which looks better. I usually just use my AVISynth script, with everything but the SOURCE line (the 1st line), and the CROP command remarked out (# sign in from of the command to ignore/remark a command). Since both NTSC, and PAL use the same horizontal value for SVCD, CVD, VCD, and DVD, you can use that as the basis for finding your vertical movies vertical for any given aspect ratio. Unfortunately, when dealing with someone elses material, they somtimes crop too much, or too little and they also often resize to odd vertical values, making it even harder to identify the correct aspect ratio for your source.

    For example. Lets use your movie (this almost sounds like a new Aspect Ratio guide ). It's SVCD, so the horizontal is 480. If you divide 480 by 2.35, you get 204. Resize your cropped movie to 480x204 and see if it looks 'right'. The same thing can be done for a 1.85:1 movie. 480 / 1.85 = 260 (rounded). Resize to 480x260 to see if 1.85:1 looks right. Whichever looks better is the one you should go with. By 'better', I mean they don't look stretched out. Widescreen video is squeezed in ->[ ]<- horizontally when placed onto DVD, and SVCD, but when resized like my two examples above in this paragraph, they should look 'right' on your PC monitor.

    Is anyone interested in a full guide on aspect ratios?
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  17. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Hi DJRumpy..

    I have some quesitons w/ respect to AR too :P
    I'm in the middle of creating an AR app (Delphi) and I'm having problems
    w/ some of the math. I remembered your Guide here, so I came back over
    to your guide to browse how you applied AR in the process.


    Question on your PAL calc, using .8334 What is the NTSC equivalent ??

    I see you are applying this to find out the "closest" match to AR's in question.
    ie, if trying to closely match 2.35:1 or 1.85:1 etc. That's a good trick, and
    I might be able to incorporate into my app. But, for now, I'm trying to
    narrow down the calc/formula for this, as prisiece as possible.

    Or, I'd like to incorporate a feature, where a user could click on the ie,
    * 2.35:1, and get the width x height values for this AR.
    * then, from there, the user can adjust the width or height, and observe
    ...the AR change on screen.

    I know the above is possible, but that it will just take some more tweaking
    and adjusting some things around a bit.


    Ok, below is a snip of what I posted elsewhere's on another form. I hope
    it better explains at least, one attempt, using Excel.

    Code:
    width  height    pixelCount   Factor:  mBlocks  RATIO
    -------------------------------------------------------------
     720    480        345,600       256       1,350     ??
     720    400        288,000       256       1,125     ??
     720    300        216,000       256         844     ??
    * pixelCount = (width x height)
    * factor = ( E7 / (( C7/16 ) * ( D7/16 )) ) ...lot of spagette here
    * mBlocks = ( E7 / ( (( C7*16 ) * ( D7*16 )) / E7 )) ...more spagette
    * RATIO = ( x, y z ) ??

    what I'm trying to figure out is how to obtian the 1.85 value for RATIO
    I'm building a small app to calc AR !! As I've said before, I always use
    MS Excel for my stating point in debuggin calcs and things.

    Thanks for any assistance you can provide,
    -vhelp
    Quote Quote  
  18. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    @ DJRumpy.. me again..

    I just thought of something, that might make some things easier.

    Ok, here we go.. try this on for size:

    EDIT: -- -- UPDATE.. below..

    Below, are a breaf list of AR values that I found around the net.
    Code:
    AspectRatio        Resolution     other Calcs
    --------------------------------------------------
    * 1:1               720 x 440 ( x480 / 1.1)
    * 4:3 --- (1.33:1)  720 x 360 ( x480 / 1.33)
    * 1.66:1            720 x 290 ( x480 / 1.66)
    * 16:9 -- (1.778:1) 720 x 270 ( x480 / 1.778)
    * 1.85:1            720 x 260 ( x480 / 1.85)
    * 2.35:1            720 x 200 ( x480 / 2.35)
    If each on of these had a formula attached to them (respectively) than
    it would be easy to show the W x H resolution for each ??
    Note, the above have formulas ie, (x480 / 2.35)=200 (or 204.25 exactly)
    The above was deduced, based off those few you provided in one of your
    responses here

    Then, when the user starts to change either one of the W or H values, (I'll
    set up a slider bar for changing) either the AR will be adjusted on the fly,
    or some other values will display, reflecting the new W x H values.

    Currently, my app is setup like this..
    * user selectable AR e, 1.85:1 or 2.35:1 etc. etc.
    * there are W x H values for user entry.
    * sliders for above adjustments
    * can increment in 16 pixel jumps (user config to other increments)
    * other calcs to display as user ajustments are made on screen.
    * other design/enhancements to be quickly added, once the math is correct.
    * possible inclusion to add AVS script for Crop() command (copy/paste)
    * WYSIWYG user entery for values and script syntax, more..

    Again, thank for any input you (or others) may offer,
    -vhelp
    Quote Quote  
  19. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    The raw math for aspect ratio is easy. Just divide width by height to get aspect ratio, multiply height * aspect ratio to get width, or last but not least, divide width by aspect ratio to get height. 3 different ways to do it, depending on which values you already know, and which you need.

    Example:
    640 / 480 = 1.333
    1.333 * 480 = 640
    640 / 1.333 = 480

    The problem with your table is two-fold. It does not take into account that all of these various different aspect ratio's are squeezed into a DVD, SVCD, or CVD resolutions (720x480, 480x480, or 352x480). This means the math above doesn't apply until you stretch the video back out according to the aspect ratio on the MPEG itself, which is the second problem. The display aspect ratio, combined with the movie's aspect ratio, is what determines how wide the video will be on playback. It also tells us how 'tall' a video needs to be.

    You must factor 2 things. The display aspect ratio, and then the movie aspect ratio. SVCD for instance, technically only supports 4:3 displays (4/3=1.333 decimal), so anything going to SVCD/CVD would use 1.333 (see below). You can format SVCD for widescreen without creating a non-compliant disc, but you must use the widescreen figures to do it (see below yet again). Anything going to DVD should use 1.77 (1.77 is the aspect of widescreen television). DVD will 'auto format' widescreen for 4:3 televisions, so you should always format full D1 (720x480 or 720x576) video as widescreen, letting the player format it automatically for 4:3. If you format your full D1 DVD video as 4:3, it will look about half height on a widescreen tv.

    In regards to your table, your dividing the compressed (squeezed) width of 480 by the aspect ratio, which is incorrect. You must first expand the video to it's full width according to the format's aspect ratio (4:3 for svcd supported displays), and then divide your expanded width by the movies aspect ratio.

    With an SVCD video that is w480 x h480, you first expand it to it's full width. We have the aspect (4/3=1.333), and height (480), so we can get width like so:

    h480 * 1.333 = 640 Full Width

    You then can divide your movies width by the movies aspect ratio to get the actual height:

    640 / 2.35 = 272

    Since we used 1.333 (4:3 aspect), then this vertical value of 272 would be correct for a 4:3 television or 4:3 format like SVCD or CVD.

    Even DVD formats compresses the width into the supported widths for DVD, which means you must first stretch it out to it's full (actual) width, and then divide by the video's aspect ratio, just like we did for SVCD. Lets look at widescreen (1.77) formats and do the math:

    720x480 widescreen (1.77 decimal), with a movie that has a 2.35 aspect
    480 * 1.77 = 850 (our actual width)
    850 / 2.35 = 362 (our actual height)

    So a anamorphic widescreen movie's resolution is actually 850 x 362, with letterboxing used to fill the 362 to 480.

    Same example as above, but with a widescreen 1.85:1 movie:
    480*1.77 = 850
    850 / 1.85 = 460

    This type of movie (1.85) is typically resized up to 480 vertical, with no letterboxing, but to be technically correct, it should have 20 pixels of letterboxing (10 on top, 10 on bottom). Only videos that are 1.77:1 should have no letterboxing if you want to be a stickler for details.

    To format any of these for 4:3 displays, you would simply multiply by 1.333 instead of 1.77. The aspect ratio 1.77 is a widescreen aspect ratio used on widescreen televisions. To figure out widths and heights for 4:3 (1.333 decimal), since 4:3 is used for a standard TV, we would do like so:

    (480*1.333 = 640) - remember 1.333 is the decimal value of 4/3
    640 / 1.85 = 346
    640 / 2.35 = 272
    640 / 1.33 = 480

    If anyone is interested, I will put all of the above into a guide format, rather than a disucssion format. The guide would be easier to follow...
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  20. Member vhelp's Avatar
    Join Date
    Mar 2001
    Location
    New York
    Search Comp PM
    Hello DJRumpy

    This is the kind of help I love to see around here. You've ben gone a few
    days, and I missed you here.. waiting for your response. Anyways..

    I'm glad your back.

    I will be giving your response some heavy looking over, because I need it
    for my app I'm developing

    Thanks again for all your hard work, very appreciated.
    -vhelp
    Quote Quote  
  21. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    Make sure you glance over it again. I put in a few edits where I swapped the height with the width...
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  22. Argh! Stupid DVDMaestro! Its telling me that the resulting m2v file is an invalid frame rate, yet TmpGEnc and DVD2AVI both say its 23.976 NTSC. The only difference is that its not listed in TMPGEnc as 23.976 (internally 29.97).

    I'm almost positive I did everything listed and the result played in powerdvd looks awesome, but I can't compile the darn thing into VOBs. Any suggestions, DJStumpy?

    Here's my AVS Script I used:

    -------------------------

    LoadPlugin("D:\AVSFilters\MPEG2Dec3.dll")

    vid=Mpeg2Source("video.d2v")
    aud=WAVSource("audio.wav")
    AudioDub(vid,aud)
    ResampleAudio(48000)
    AssumeFPS(23.976,True)
    ConvertToYUY2()
    Clip1=Trim(0,66915)
    Clip2=Trim(66991,132654)
    Clip3=Trim(132715,0)
    Clip1 ++ Clip2 ++ clip3
    Crop(0,128,480,320)
    LanczosResize(720,360)
    AddBorders(0,60,0,60)


    Could I have missed something to do with the framerate in CCE or should there be another spec in AVS for the frame rate to be 23.976(internally 29.97)? Any help would be invaluable!

    Thanks!

    Chaz
    Quote Quote  
  23. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    LOL...I forgot one item in the guide. You need to run Pulldown against the file, to make it look like a 29.97 FPS video. Hopefully your familiar with the software, or you can hang tight until I get it added to the end. I had forgotten to add that section to the guide, although I did put the links for it

    I'm adding it in as we speak...
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  24. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    I've posted an Aspect and Resolution Guide. You can find it here:

    https://www.videohelp.com/forum/viewtopic.php?t=174200
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  25. Hey DJStumpy!

    Those final steps worked! I was able to burn in DVDMaestro without errors. Now here's a question for you, though. When I play the final result of:

    Crop(0,128,480,320)
    LanczosResize(720,360)
    AddBorders(0,60,0,60)

    I used the 2.35:1 ratio because my result for 320x.8334 = 267 (rounded)

    "NTSC Vertical Values close to 272 are 2.35:1"

    1. On my Sony 4:3 TV - everything looks stretched from top to bottom. There are widescreen borders but thinner than they should be to render 16:9 properly. Almost looks like its trying to render it as 4:3.

    2. Autoplay through PowerDVD - same aspect ratio as TV, I play the disc on my computer through PowerDVD and it gives me the the stretched out look. However, I checked the M2v file resulting from the pulldown.exe process and its 16:9 with no issues.

    3. Individual VOBs through PowerDVD - this is weird. Same compilation as #2 but instead of using autoplay, I drag and drop a VOB, say VOB_5_1 into PowerDVD and the aspect ratio looks as it should in 16:9.

    This is so bizarre. What is causing a 16:9 aspect ratio to get distorted during autoplay or on TV when the individual VOBs play correctly? Is there some kind of config file or setting that prompts Autoplay on computers or commercial DVD players to cause this?

    I'm afraid that if I screw with the crop, LanczosResize, or addborders values then it may work on TV but look crushed top to bottom on the computer. Any insight?

    Thanks!

    Chaz
    Quote Quote  
  26. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    DVD uses only two common NTSC resolutions for widescreen video. Either 720x360 with letterboxing, or fullscreen (720x480), with no letterboxing. If your movie is indeed 2.35:1, then your video image area should be 720x360.

    Since your saying it looks tall, I would suspect that either the IFO is not set correctly, or the setting on your DVD player is incorrect. Specifically the setting on your player for 'Display Type'. You should have at least two options (you might possibly have more):

    4:3 Display
    16:9 Display

    If your DVD player is set to a 16:9 display, and you have a 4:3 standard television, it will look tall on your television, rather than being properly letterboxed.

    As to the settings you used, if your movie was 1.85:1 widescreen, then it should have no letterboxing. Encoding a 2.35:1 video as 1.85:1 would give you 'tall' video, but it sounds like you did a 2.35:1 conversion, with letterboxing, which is correct.

    Your source SVCD was PAL?
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  27. Yes, the original is definitely PAL SVCD 576 x 480 running at 25fps. DVD2AVI and TmpGEnc both confirm it.

    I did double check the dvd player and the tv, both are set to 4:3 picture as the default. Another check was to play commerical dvds - All other NTSC commercial dvds that are native 16:9 such as 'Attack of the Clones' look as they should in powerDVD autoplay and on my TV both in widescreen.

    Whats confusing is that PowerDVD autoplay and the TV both show the same stretched result, but if I drag a VOB into the PowerDVD player, it looks 16:9. Perhaps it could be some misconfig'd info in the IFO file(s), but I didn't know there was any way of manipulating that. Perhaps there's a setting in DVDMaestro that I'm unfamilar with or missing...
    Quote Quote  
  28. Ah! Here's something I found on Doom9's site:

    http://www.doom9.org/index.html?/mpg/maestro2.htm

    "..Change the default “4:3” setting in Maestro to “16:9"

    It doesn't say where, but that must be the issue. According to this screen shot off a german site, it is near the bottom of the workarea where that is specified, perhaps that can be changed.

    http://www.4me2.de/images1/workspace_film_format.jpg

    Always something...;-P

    Thanks for the patience DJ, I'll keep ya posted!

    -Chaz
    Quote Quote  
  29. Member DJRumpy's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Texas
    Search Comp PM
    If you have the IFO's generated, you can use IFOEdit to change the aspect, without having to reproduce the whole thing. Just open each IFO, find any reference to 4:3, and change it to 16:9. You should also select 'Automatic Letterboxed' too. Make sure you save each IFO when your finished.

    If the aspect is set on the M2V file incorrectly, then you can also change it with the PullDown GUI referenced in the guide. Just put a check on the line referring to Aspect Ratio, and ensure 16:9 is selected. If your just changing aspect ratio, and not applying pulldown, ensure that the 'No Pulldown' option is also selected.

    You can of source recompile it in Maestro, but this might save you some time
    Impossible to see the future is. The Dark Side clouds everything...
    Quote Quote  
  30. Awesome! It looks perfect! Thanks for all your help DJStumpy! Your guide and guiding are definitely examples for others to follow.

    All the best,

    Chaz
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!