# HG changeset patch # User gpoirier # Date 1116025400 0 # Node ID 39b8eafcf94a58c7d0fed5dbc79c20940cd7de81 # Parent 6c2bae3ac404bb53f3503843763db0c8f74a159e Preparing to encode: Identifying source material and framerate + how to encode interlaced content diff -r 6c2bae3ac404 -r 39b8eafcf94a DOCS/xml/en/mencoder.xml --- a/DOCS/xml/en/mencoder.xml Fri May 13 22:29:07 2005 +0000 +++ b/DOCS/xml/en/mencoder.xml Fri May 13 23:03:20 2005 +0000 @@ -519,10 +519,243 @@ for you. + +Preparing to encode: Identifying source material and framerate + + Before you even think about encoding a movie, you need to take + several preliminary steps. + + + + The first and most important step before you encode should be + determining what type of content you are dealing with. + If your source material comes from DVD or broadcast/cable/satellite + TV, it will be stored in one of two formats: NTSC for North + America and Japan, and PAL for Europe, etc. + But it is important to realize that this is just the formatting for + presentation on a television, and often does + not correspond to the + original format of the movie. + In order to produce a suitable encode, you need to know the original + format. + Failure to take this into account will result in ugly combing + (interlacing) artifacts in your encode. + Besides being ugly, the artifacts also harm coding efficiency: + You will get worse quality per bitrate. + + + +Identifying source framerate + + Here is a list of common types of source material, where you are + likely to find them, and their properties: + + + + Standard Film: Produced for + theatrical display at 24fps. + + + PAL video: Recorded with a PAL + video camera at 50 fields per second. + A field consists of just the even or odd numbered lines of a + frame. + Television was designed to refresh these in alternation as a + cheap form of analog compression. + The human eye supposedly compensates for this, but once you + understand interlacing you will learn to see it on TV too and + never enjoy TV again. + Two fields do not make a + complete frame, because they are captured 1/50 of a second apart + in time, and thus they do not line up unless there is no motion. + + + NTSC Video: Recorded with an + NTSC video camera at 59.94 fields per second, or 60 fields per + second in the pre-color era. + Otherwise similar to PAL. + + + Animation: Usually drawn at + 24fps, but animation also comes in mixed-framerate varieties. + + + Computer Graphics (CG): Can be + any framerate, but 24 and 30 fps are the most frequently + encountered in NTSC regions, and 25 fps in PAL regions. + + + Old Film: Various lower + framerates. + + + + + +Identifying source material + + Movies consisting of frames are referred to as progressive, + while those consisting of independent fields are called + interlaced, or sometimes video, although this latter term is + ambiguous. + + + To further complicate matters, some movies will be a mix of + several of the above. + + + The most important distinction to make between all of these + formats is that some are frame-based, while others are + field-based. + Whenever a movie is prepared + for display on television (including DVD), it is converted to a + field-based format. + The various methods by which this can be done are collectively + referred to as "pulldown", of which the infamous NTSC + "3:2 telecine" is one variety. + Unless the original material was also field-based (and the same + fieldrate), you are getting the movie in a format other than the + original. + + + +There are several common types of pulldown: + + PAL 2:2 pulldown: The nicest of + them all. + Each frame is shown for two fields duration, by extracting the + even and odd lines and showing them in alternation. + If the original material is 24fps, this process speeds up the + movie by 4%. + + + PAL 2:2:2:2:2:2:2:2:2:2:2:3 pulldown: + Every 12th frame is shown for three fields duration, instead of + just two. + This avoids the 4% speedup issue, but makes the process much + more difficult to reverse. + It is usually seen in musical productions where adjusting the + speed by 4% would seriously damage the musical score. + + + NTSC 3:2 telecine: Frames are + shown alternatively for 3 fields or 2 fields duration. + This gives a fieldrate 5/2 times the original framerate. + The result is also slowed down very slightly from 60 fields per + second to 59.94 fields per second to maintain NTSC fieldrate. + + + NTSC 2:2 pulldown: Used for + showing 30fps material on NTSC. + Nice, just like 2:2 PAL pulldown. + + + + + There are also methods for converting between NTSC and PAL video. + Such topics are beyond the scope of this guide. + If you encounter such a movie and want to encode it, your best + bet is to find a copy in the original format. + NTSC/PAL conversion is highly destructive and cannot be reversed + cleanly, so your encode will greatly suffer if it is made from a + converted source. + + + When video is stored on DVD, consecutive pairs of fields are + grouped as a frame, even though they are not intended to be shown + at the same moment in time. + The MPEG-2 standard used on DVD and digital TV provides a way to + encode the original progressive frames, and store the number of + fields for which each should be shown in the frame headers. + If this method has been used, the term "soft telecine" will often + be used to describe the movie, since the process only directs the + DVD player to apply pulldown to the movie rather than altering + the movie itself. + This case is highly preferable since it can easily be reversed + (actually ignored) by the encoder, and since it preserves maximal + quality. + However, many DVD and broadcast production studios do not use + proper encoding techniques, and instead produce movies with + "hard telecine", where fields are actually duplicated in the + encoded MPEG-2. + + + The procedures for dealing with these cases will be covered later + in this guide. + For now, we leave you with some guides to identifying which type + of material you are dealing with: + + + +NTSC regions: + + If MPlayer prints that the framerate + has changed to 23.976 when watching your movie, and never changes + back, it is almost certainly 24fps content that has been + "soft telecined". + + + If MPlayer shows the framerate + switching back and forth between 23.976 and 29.97, and you see + "combing" at times, then there are several possibilities. + The 23.976 fps segments are almost certainly 24fps progressive + content, "soft telecined", but the 29.97 fps parts could be + either hard-telecined 24fps content or NTSC video content. + Use the same guidelines as the following two cases to determine + which. + + + If MPlayer never shows the framerate + change, and every single frame with motion appears combed, your + movie is NTSC video at 59.94 fields per second. + + + If MPlayer never shows the framerate + change, and two frames out of every five appear combed, your + movie is "hard telecined" + 24fps content. + + + + +PAL regions: + + If you never see any combing, your movie is 2:2 pulldown. + + + If you see combing alternating in and out every half second, + then your movie is 2:2:2:2:2:2:2:2:2:2:2:3 pulldown. + + + If you always see combing during motion, then your movie is PAL + video at 50 fields per second. + + + +Hint: + + MPlayer can slow down movie playback + with the -speed option. + Try using 0.2 to watch the movie very + slowly and identify the pattern, if you cannot see it at full speed. + + + + + Constant Quantizer vs. two pass + It is possible to encode your movie at a wide range of qualities. + With modern video encoders and a bit of pre-codec compression + (downscaling and denoising), it is possible to achieve very good + quality at 700 MB, for a 90-110 minute widescreen movie. + And all but the longest movies can be encoded with near-perfect + quality at 1400 MB. + + + There are three approaches to encoding the video: constant bitrate (CBR), constant quantizer, and two pass (ABR, or average bitrate). @@ -1354,6 +1587,59 @@ + +Encoding interlaced video + + + If the movie you want to encode is interlaced (NTSC video or + PAL video), you will need to choose whether you want to + deinterlace or not. + While deinterlacing will make your movie usable on progressive + scan displays such a computer monitors and projectors, it comes + at a cost: The field rate of 50 or 59.94 fields per second + is halved to 25 or 29.97 frames per second, and roughly half + the information in your movie will be lost during scenes with + significant motion. + + + + Therefore, if you are encoding for high quality archival purposes, + it is recommended not to deinterlace. + You can always deinterlace the movie at playback time when + displaying it on progressive scan devices, and future players will + be able to deinterlace to full fieldrate, interpolating 50 or + 59.94 entire frames per second from the interlaced video. + + + +Special care must be taken when working with interlaced video: + + + + + Crop height and y-offset must be multiples of 4. + + + Any vertical scaling must be performed in interlaced mode. + + + Postprocessing and denoising filters may not work as expected + unless you take special care to operate them a field at a time, + and they may damage the video if used incorrectly. + + + + +With these things in mind, here is our first example: + + + mencoder capture.avi -mc 0 -oac lavc -ovc lavc -lavcopts \ + vcodec=mpeg2video:vbitrate=6000:ilmv:ildct:acodec=mp2:abitrate=224 + + +Note the and options. + + Filtering