I am following a H.264 tutorial. I am going to post my script, I am going to post what I am not understanding. I am going to post the link to the DivX tutorial. It is written by digital56k.
http://labs.divx.com/projectremoulade Just look for DivX H.264 Encoder Alpha 1 & Tutorial
That is my script I have now. I am not sure if I am missing lines, or not?Code:version().AddBorders(2,80,2,80,$000000).Info() Version().AddBorders(0,80,0,80,$000000).Crop(2,0,-2,0)
Here is what I am on but don't understand.
Code:# As before, uncomment one of the following lines of script at a time # then reopen the clip in VirtualDub (keyboard shortcut: F2) to see # the changes. # 1. Letterbox (add 160 pixels to height) and pillarbox (add 4 pixels to width) # Version().AddBorders(2,80,2,80,$000000) # 2. Letterbox as before, but instead of pillarboxing let's make the width # a multiple of 8 by cropping 4 pixels instead. # Version().AddBorders(0,80,0,80,$000000).Crop(2,0,-2,0) # 3. Preserve the complete picture by resizing # # Original resolution was 436x80, and we want to fill 440x240 pixels. To avoid # aspect distortions (which would make the picture look stretched in one dimension) # we want to scale the width and height by the same ratio. # # (New width / Old width) * Old height = New height # ( 440 / 436 ) * 80 = ~80.73 pixels # .. Let's round to the nearest whole number, 81 pixels # # So our resize is to 440x81 pixels. This leaves 240 - 81 = 159 pixels of letterboxing. # We'll add 79 pixels to the top and 80 pixels to the bottom to accomplish this. # # Let's use LanczosResize because it's a nice sharp resize filter. # (see http://avisynth.org/mediawiki/LanczosResize ) # Version().LanczosResize(440,81).AddBorders(0,79,0,80)
+ Reply to Thread
Results 1 to 30 of 47
-
-
Those examples use Version() just to give a small video as a starting point for further processing (AddBorders, Crop, etc). You need to use AviSource() or DirectShowSource() or something to open a video file. Using that last example, a simple script might look like:
DirectShowSource("filename.ext")
LanczosResize(440,81)
AddBorders(0,79,0,80)
Or, all on one line with the . syntax:
DirectShowSource("filename.ext").LanczosResize(440 ,81).AddBorders(0,79,0,80) -
Originally Posted by jagabo
Would any video that I use be 440,81? Or what would be an easier figure for any video that I am working with? Like my Dick Tracy video is, 720x416. NTSC at 23.976 fps and it's 16/9. -
Originally Posted by jagabo
1.) I rather use AL's (digital56k) tutorial.
2.) Trying to use the tutorial for H.264.
3.) Trying to encode XviD and older DivX versions to H.264.
4.) He already knows what I am trying to do but didn't say much. He only said it won't playback on standalone. I need to watch it on PC. -
I don't see much point in reencoding Divx/Xvid to h.264. But for this that type of conversion, if you're are looking at reducing the frame size you usually will want to reduce the width and height proportionally (as indicated in the sample script you posted).
The Version() function in AviSynth creates a 10 second, 428x80, 24 fps, sample video with version information imprinted on it. He was using that simply for demonstration purposes. It's an easy way to generate a sample video. To convert a real Divx AVI you'll want to use AviSource(). -
jagabo,
How is this script?
Code:AVISource("H:\DickTracy(1990)\video.avi.AddBorders(0,80,0,80,$000000).Crop(2,0,-2,0) myvideo = Version().AddBorders(2,80,2,80,$000000) myaudio = WAVSource("H:\Dick Tracy (1990)\sound.wav") mydub = AudioDub(video, sound) return ChangeFPS(mydub, 30000,1001) LanczosResize(640,352)
-
That script doesn't make any sense. You're just randomly putting things together. What are you trying to accomplish? What's the resolution of your source file? What resolution do you want for the output?
-
I got the script I posted from this tutorial. I will post the scripts below. I got it from the top part.
Code:# Let's change Version to 29.970fps using a permitted rate/scale combination. # We'll use ChangeFPS to duplicate frames as required. The rate/scale of # 30000/1001 comes from the table of permitted values for acheiving 29.970fps # on DivX Labs. # Version().AddBorders(2,80,2,80,$000000).ChangeFPS(30000,1001) # Now do the same with a clip that has an audio track. Notice that ChangeFPS # doesn't change the duration of the track or modify the audio, so there is # no extra work to do! # myvideo = Version().AddBorders(2,80,2,80,$000000) # myaudio = WAVSource("C:\SomeFolder\MyAudio.wav") # mydub = AudioDub(myvideo, myaudio) # return ChangeFPS(mydub, 30000,1001) # We can also write the above more simply. Remember that almost everything # in AVISynth is either inputting or outputting a "clip", making it easy to # chain filters together. When you use the "." symbol the clip on the left of # the "." just becomes the first argument to the filter on the right of the # symbol. In the example below we also use the "\" symbol to break an expression # between multiple lines for readability. # Version().AddBorders(2,80,2,80,$000000)\ # .AudioDub(WAVSource("C:\SomeFolder\MyAudio.wav")).ChangeFPS(30000,1001) # Okay, how about AssumeFPS? Remember, there is more work to do with AssumeFPS # and it's probably not the best choice because it implies changing the audio # or introducing a small desync. Let's assume the following AVI file has an # audio track at 44.1Khz, and simply adapt it to our new frame rate. This will # cause a pitch shift that will become more noticable for larger rate changes. # After adapting the rate we resample the audio back to a standard rate, # e.g. back to 44.1Khz ready for encoding later. We could use VirtualDub's #"Save WAV..." function (from the File menu) to write the processed audio to file. # # By using AVISynth to process the audio we're assuring everything stays in sync, # even if we use AVISynth's Trim() filter to cut up the video. # # In the example below we use the Audiorate() clip property to automatically # convert the resampled audio to the same rate as in the original file # (which we assume is a standard rate). # # See http://avisynth.org/mediawiki/Clip_properties for more clip properties. # MyVideo = AVISource("C:\SomeFolder\SomeFile.avi") # Return MyVideo.AssumeFPS(30000, 1001, sync_audio = true)\ # .ResampleAudio(MyVideo.Audiorate()) # Let's do the same again, but this time we'll time-stretch the audio to avoid # changing its pitch. With a good timestretch algorithm you should be able to # alter the duration by at least 3-4% without artifacts becoming too noticable. # Because the audio is coming from an AVISource we'll create two new clips to # cleanly separate the audio, process it, then dub everything back together again. # Note that TimeStrech is not 100% precise, the documentation states that: # # "inaccuracies should not exceed a few 10's of milliseconds for movielength samples" # # .. so we only want to use TimeStretch when we're correcting larger desync's. # # In the example below we use the FrameRate() clip property to automatically # calculate the tempo change based upon the original frame rate and the new # frame rate (tempo = 100 mean original tempo). # MySource = AVISource("C:\SomeFolder\SomeFile.avi") # MyVideo = MySource.KillAudio().AssumeFPS(30000, 1001) # MyAudio = MySource.GetChannel(1,2)\ # .TimeStretch(tempo = (100 * MyVideo.Framerate()) / MySource.Framerate()) # Return AudioDub(MyVideo, MyAudio) # Finally, keep in mind that ConvertFPS may introduce desync with subtitle formats # that are based upon associating subtitles with frame numbers, and AssumeFPS may # introduce desync with subtitle formats that are based upon associating subtitles # with timestamps. If you have have already prepared subtitle files for your video # ensure that you either choose a suitable rate adjustment method, or convert your # subtitles into an appropriate format before muxing them into the final file.
-
Originally Posted by jagabo
http://labs.divx.com/node/6992
I would like to follow that tutorial on that site to encode to H.264 using AVISynth. From his scripts, what would be a good and decent script to use? -
Originally Posted by rocky12
-
Originally Posted by jagabo
General
Complete name : H:\Movies\Dick Tracy\Dick Tracy.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 652 MiB
Duration : 1h 45mn
Overall bit rate : 867 Kbps
Video
Format : MPEG-4 Visual
Format profile : Streaming Video@L1
Format settings, BVOP : Yes
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 1h 45mn
Bit rate : 726 Kbps
Width : 720 pixels
Height : 416 pixels
Display aspect ratio : 16/9
Frame rate : 23.976 fps
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.101
Stream size : 546 MiB (84%)
Writing library : XviD 1.2.0.dev47 (UTC 2006-11-01)
Audio
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Bit rate mode : Constant
Bit rate : 128 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Resolution : 16 bits
Video delay : 24ms
Stream size : 96.2 MiB (15%)
Alignment : Split accross interleaves
Interleave, duration : 24 ms (0.58 video frame) -
If your AVI file has audio all you need is:
AviSource("H:\Movies\Dick Tracy\Dick Tracy.avi")
If the AVI file has no audio and you have to use the WAV file:
vid=AviSource("H:\Movies\Dick Tracy\Dick Tracy.avi")
aud=WavSource("H:\Movies\Dick Tracy\Dick Tracy.wav")
AudioDub(vid, aud)
That will give you a 720x416, 23.976 fps, h.264 (same as the source) file after you've encoded it. -
I was playing around with the scripts. I get an AVISource autodetect. I did a Google on it. I have to have a name for the file. I have a name. I call it video.avi
My audio file is sound.wav it's PCM. Both files are in ("H:\Dick Tracy (1990)\video.avi")
I will post a copy of my screen shot. Thank you for your help. I also would like to use ChangeFPS, WAVSource, AddBorders, Crop, like in the tutorial.
Code:AVISource("H:\DickTracy (1990)\video.avi") AddBorders(0,80,0,80,$000000) Crop(2,0,-2,0) myvideo = ("H:\Dick Tracy (1990)\video.avi").AddBorders(2,80,2,80,$000000) myaudio = WAVSource("H:\Dick Tracy (1990)\sound.wav") mydub = AudioDub(video, sound) return ChangeFPS(mydub, 30000,1001) LanczosResize(640,352)
-
Your AVISource line has no space between Dick and Tracy.
myvideo = ... is missing the AVISource (or equivalent) command.
mydub = ... will fail because video and sound are undefined variables.
Your Return line should enclose the variables in parenthesis.
LanczosResize should come before the Return line to be effective.
Edit: It's clear you don't understand what the commands are doing. Why do you want to crop? Why do you want to addborders? Why do you want to resize? The guide is a starting point that needs to be adapted to your specific needs. It is not a step by step instruction that applies to any video you want to convert. The purpose of the guide is to help you learn how to use AviSynth and it's various commands and filters to achieve the end results you want. You don't necessarily need anything more than AVISource(your movie) to feed to your H.264 encoder if the source already fits the requirements."Shut up Wesley!" -- Captain Jean-Luc Picard
Buy My Books -
Originally Posted by gadgetguy
I had to take out somes lines because they were invalid.
Code:AVISource("H:\Dick Tracy (1990)\video.avi").AddBorders(0,80,0,80,$000000).Crop(2,0,-2,0) AVISource = ("H:\Dick Tracy (1990)\video.avi") myaudio = WAVSource("H:\Dick Tracy (1990)\sound.wav") LanczosResize(640,352) return ChangeFPS(30000,1001)
That script works. I was using VirtualDub to load the script to see it will work. However, the tutorial using CLI to encode.
DivX264 -frames 100 -i "MySource.avs" -o "Output.264"
What lines do I use to that example to encode Multipasses? -
I'm surprised it doesn't still give errors. I edited my earlier post and didn't realize you would respond so fast. Go back and read/answer my questions.
"Shut up Wesley!" -- Captain Jean-Luc Picard
Buy My Books -
Originally Posted by gadgetguy
1.) Get rid of the Cropping, and AddBorders?
2.) How do I use the CLI to encode multipasses? -
If you don't want to crop or addborders then don't put them in the script. Remove them from the AVISource line.
You need to have a better answer for why you want to resize. Is the resized resolution required for H.264?
Is the changed FPS required for H.264?
Why do you want to use WavSource if the original video already has audio?
In your current script, Wavsource is loading the audio file, but it is not being included in the output. That's what the AudioDub() command would do for you, but you have to use it correctly.
Multipass encoding is a separate issue and depends on your encoder. But let's not worry about that until you get the AVISynth script right.
I suggest you start over with just the single line
AVISource("H:\Dick Tracy (1990)\video.avi")
Open that in VirtualDub and see if it plays with audio."Shut up Wesley!" -- Captain Jean-Luc Picard
Buy My Books -
Excellent. The next question then is, does it fit the parameters required by H.264? What encoder are you using?
"Shut up Wesley!" -- Captain Jean-Luc Picard
Buy My Books -
Originally Posted by gadgetguy
-
Unfortunately, I am not familiar with that encoder, or actually any H.264 encoder, as I haven't done any H.24 encoding, but there are usually resolution and colorspace requirements for any encoder, and there may be additional requirements depending on the playback device you want your file to play on. All of these requirements usually need to be met in your AviSynth script before you feed it to your encoder. Some encoders allow limited editing features, but seldom do them as well as AviSynth.
So now you need to do some research on both the encoder requirements and your playback device requirements. Once you know those, then we can help you make adjustments to your AVISynth script to meet them, and then we can turn the attention to the actual encoding command line."Shut up Wesley!" -- Captain Jean-Luc Picard
Buy My Books -
I did a Google search. I am not sure what I am looking for. I will post the results I found.
http://www.google.com/search?hl=en&q=h.264+playback+requirements&btnG=Search
http://www.google.com/search?hl=en&q=h.264+encoder+requirements&btnG=Google+Search -
What device do you plan on playing these files on?
"Shut up Wesley!" -- Captain Jean-Luc Picard
Buy My Books -
If your current source is similar to the earlier one you posted it's 720x416, 23.976 fps. That's fine for any h.264 encoder.
Multipass encoding is a matter of the encoder, not AviSynth. You can get a list of Divx264 options by typing:
divx264 -help
Or just download the help file from their web site:
http://labs.divx.com/files/DivX264_Alpha1_Help.txt
It looks like you have to envoke the two passes individually:
divx264 -npass 1 -i script.avs -o output.h264
divx264 -npass 2 -i script.avs -o output.h264
You'll have to add other argements to specify bitrate etc. -
Originally Posted by gadgetguy
-
Originally Posted by jagabo
-
Now I don't understand what you're going through all of this for. Don't your AVI files already play on your PC? What do you hope to gain by converting them to H.264?
"Shut up Wesley!" -- Captain Jean-Luc Picard
Buy My Books
Similar Threads
-
VHS to DVD Restoration. Best AviSynth scripts?
By VideoFanatic in forum RestorationReplies: 47Last Post: 25th Oct 2011, 06:34 -
About using AviSynth scripts with MeGUI 0.3.5.0.
By Nagashi in forum DVD RippingReplies: 56Last Post: 15th Jul 2010, 10:15 -
StaxRip doesn't handle 16:9 AVISynth scripts?
By Kylenol in forum Video ConversionReplies: 0Last Post: 23rd Dec 2009, 15:35 -
H.264 deinterlacing AVISynth scripts for 29.97fps
By PuzZLeR in forum Video ConversionReplies: 12Last Post: 7th May 2008, 22:36 -
Avisynth scripts and VDubMOD filters
By GangstaRap in forum Newbie / General discussionsReplies: 2Last Post: 13th May 2007, 11:39