comparison DOCS/xml/en/encoding-guide.xml @ 16086:6c16b60516f3

Moves the "audio" section just before the "muxing" section. + fixes suggested by Jeff
author gpoirier
date Sun, 24 Jul 2005 21:37:24 +0000
parents c1dd920e736c
children e56a9eacfbc7
comparison
equal deleted inserted replaced
16085:c1dd920e736c 16086:6c16b60516f3
970 Other parameters such as scaling, cropping, etc. will 970 Other parameters such as scaling, cropping, etc. will
971 <emphasis role="bold">not</emphasis> alter the file size unless you 971 <emphasis role="bold">not</emphasis> alter the file size unless you
972 change the bitrate as well!. 972 change the bitrate as well!.
973 </para> 973 </para>
974 <para> 974 <para>
975 Bitrate does <emphasis role="bold">not</emphasis> scale proportional 975 Bitrate does <emphasis role="bold">not</emphasis> scale proportionally
976 to resolution. 976 to resolution.
977 That is to say, a 320x240 file at 200 kbit/sec will not be the same 977 That is to say, a 320x240 file at 200 kbit/sec will not be the same
978 quality as the same movie at 640x480 and 800 kbit/sec! 978 quality as the same movie at 640x480 and 800 kbit/sec!
979 There are two reasons for this: 979 There are two reasons for this:
980 <orderedlist> 980 <orderedlist>
1008 comparable to 640x480 at 800 kbit/sec. 1008 comparable to 640x480 at 800 kbit/sec.
1009 However this has not been verified with theoretical or empirical 1009 However this has not been verified with theoretical or empirical
1010 rigor. 1010 rigor.
1011 Further, given that movies vary greatly with regard to noise, detail, 1011 Further, given that movies vary greatly with regard to noise, detail,
1012 degree of motion, etc., it's futile to make general recommendations 1012 degree of motion, etc., it's futile to make general recommendations
1013 for bits per length-of-diagonal (the analogue of bits per pixel, 1013 for bits per length-of-diagonal (the analog of bits per pixel,
1014 using the square root). 1014 using the square root).
1015 </para> 1015 </para>
1016 <para> 1016 <para>
1017 So far we have discussed the difficulty of choosing a bitrate and 1017 So far we have discussed the difficulty of choosing a bitrate and
1018 resolution. 1018 resolution.
1079 be wasting bits without any noticeable quality gain. 1079 be wasting bits without any noticeable quality gain.
1080 </para> 1080 </para>
1081 </sect3> 1081 </sect3>
1082 1082
1083 </sect2> 1083 </sect2>
1084
1085 <sect2 id="menc-feat-dvd-mpeg4-filtering">
1086 <title>Filtering</title>
1087
1088 <para>
1089 In general, you want to do as little filtering as possible to the movie
1090 in order to remain close to the original DVD source. Cropping is often
1091 necessary (as described above), but avoid to scale the video. Although
1092 scaling down is sometimes preferred to using higher quantizers, we want
1093 to avoid both these things: remember that we decided from the start to
1094 trade bits for quality.
1095 </para>
1096
1097 <para>
1098 Also, do not adjust gamma, contrast, brightness, etc. What looks good
1099 on your display may not look good on others. These adjustments should
1100 be done on playback only.
1101 </para>
1102
1103 <para>
1104 One thing you might want to do, however, is pass the video through a
1105 very light denoise filter, such as <option>-vf hqdn3d=2:1:2</option>.
1106 Again, it is a matter of putting those bits to better use: why waste them
1107 encoding noise when you can just add that noise back in during playback?
1108 Increasing the parameters for <option>hqdn3d</option> will further
1109 improve compressibility, but if you increase the values too much, you
1110 risk degrading the image visibily. The suggested values above
1111 (<option>2:1:2</option>) are quite conservative; you should feel free to
1112 experiment with higher values and observe the results for yourself.
1113 </para>
1114
1115 </sect2>
1116
1117
1118 <sect2 id="menc-feat-dvd-mpeg4-interlacing">
1119 <title>Interlacing and Telecine</title>
1120
1121 <para>
1122 Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some
1123 processing must be done to this 24 fps video to make it run at the correct
1124 NTSC framerate. The process is called 3:2 pulldown, commonly referred to
1125 as telecine (because pulldown is often applied during the telecine
1126 process), and, naively described, it works by slowing the film down to
1127 24000/1001 fps, and repeating every fourth frame.
1128 </para>
1129
1130 <para>
1131 No special processing, however, is done to the video for PAL DVDs, which
1132 run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown,
1133 but this does not become an issue in practice.) The 24 fps film is simply
1134 played back at 25 fps. The result is that the movie runs slightly faster,
1135 but unless you are an alien, you probably will not notice the difference.
1136 Most PAL DVDs have pitch-corrected audio, so when they are played back at
1137 25 fps things will sound right, even though the audio track (and hence the
1138 whole movie) has a running time that is 4% less than NTSC DVDs.
1139 </para>
1140
1141 <para>
1142 Because the video in a PAL DVD has not been altered, you needn't worry
1143 much about framerate. The source is 25 fps, and your rip will be 25
1144 fps. However, if you are ripping an NTSC DVD movie, you may need to
1145 apply inverse telecine.
1146 </para>
1147
1148 <para>
1149 For movies shot at 24 fps, the video on the NTSC DVD is either telecined
1150 30000/1001, or else it is progressive 24000/1001 fps and intended to be telecined
1151 on-the-fly by a DVD player. On the other hand, TV series are usually
1152 only interlaced, not telecined. This is not a hard rule: some TV series
1153 are interlaced (such as Buffy the Vampire Slayer) whereas some are a
1154 mixture of progressive and interlaced (such as Angel, or 24).
1155 </para>
1156
1157 <para>
1158 It is highly recommended that you read the section on
1159 <link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link>
1160 to learn how to handle the different possibilities.
1161 </para>
1162
1163 <para>
1164 However, if you are mostly just ripping movies, likely you are either
1165 dealing with 24 fps progressive or telecined video, in which case you can
1166 use the <option>pullup</option> filter <option>-vf
1167 pullup,softskip</option>.
1168 </para>
1169
1170 </sect2>
1171
1172 <sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced">
1173 <title>Encoding interlaced video</title>
1174
1175 <para>
1176 If the movie you want to encode is interlaced (NTSC video or
1177 PAL video), you will need to choose whether you want to
1178 deinterlace or not.
1179 While deinterlacing will make your movie usable on progressive
1180 scan displays such a computer monitors and projectors, it comes
1181 at a cost: The fieldrate of 50 or 60000/1001 fields per second
1182 is halved to 25 or 30000/1001 frames per second, and roughly half of
1183 the information in your movie will be lost during scenes with
1184 significant motion.
1185 </para>
1186
1187 <para>
1188 Therefore, if you are encoding for high quality archival purposes,
1189 it is recommended not to deinterlace.
1190 You can always deinterlace the movie at playback time when
1191 displaying it on progressive scan devices, and future players will
1192 be able to deinterlace to full fieldrate, interpolating 50 or
1193 60000/1001 entire frames per second from the interlaced video.
1194 </para>
1195
1196 <para>
1197 Special care must be taken when working with interlaced video:
1198 </para>
1199
1200 <orderedlist>
1201 <listitem><para>
1202 Crop height and y-offset must be multiples of 4.
1203 </para></listitem>
1204 <listitem><para>
1205 Any vertical scaling must be performed in interlaced mode.
1206 </para></listitem>
1207 <listitem><para>
1208 Postprocessing and denoising filters may not work as expected
1209 unless you take special care to operate them a field at a time,
1210 and they may damage the video if used incorrectly.
1211 </para></listitem>
1212 </orderedlist>
1213
1214 <para>
1215 With these things in mind, here is our first example:
1216 </para>
1217 <screen>
1218 mencoder <replaceable>capture.avi</replaceable> -mc 0 -oac lavc -ovc lavc -lavcopts \
1219 vcodec=mpeg2video:vbitrate=6000:ilmv:ildct:acodec=mp2:abitrate=224
1220 </screen>
1221 <para>
1222 Note the <option>ilmv</option> and <option>ildct</option> options.
1223 </para>
1224 </sect2>
1225
1084 1226
1085 <sect2 id="menc-feat-dvd-mpeg4-audio"> 1227 <sect2 id="menc-feat-dvd-mpeg4-audio">
1086 <title>Audio</title> 1228 <title>Audio</title>
1087 1229
1088 <para> 1230 <para>
1140 containers as an output, each of which may lead to audio/video 1282 containers as an output, each of which may lead to audio/video
1141 playback synchronization problems with some players when the AVI file 1283 playback synchronization problems with some players when the AVI file
1142 contain VBR audio streams such as Vorbis. 1284 contain VBR audio streams such as Vorbis.
1143 Do not worry, this document will show you how you can do that with third 1285 Do not worry, this document will show you how you can do that with third
1144 party programs. 1286 party programs.
1145 </para>
1146
1147 </sect2>
1148
1149 <sect2 id="menc-feat-dvd-mpeg4-interlacing">
1150 <title>Interlacing and Telecine</title>
1151
1152 <para>
1153 Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some
1154 processing must be done to this 24 fps video to make it run at the correct
1155 NTSC framerate. The process is called 3:2 pulldown, commonly referred to
1156 as telecine (because pulldown is often applied during the telecine
1157 process), and, naively described, it works by slowing the film down to
1158 24000/1001 fps, and repeating every fourth frame.
1159 </para>
1160
1161 <para>
1162 No special processing, however, is done to the video for PAL DVDs, which
1163 run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown,
1164 but this does not become an issue in practice.) The 24 fps film is simply
1165 played back at 25 fps. The result is that the movie runs slightly faster,
1166 but unless you are an alien, you probably will not notice the difference.
1167 Most PAL DVDs have pitch-corrected audio, so when they are played back at
1168 25 fps things will sound right, even though the audio track (and hence the
1169 whole movie) has a running time that is 4% less than NTSC DVDs.
1170 </para>
1171
1172 <para>
1173 Because the video in a PAL DVD has not been altered, you needn't worry
1174 much about framerate. The source is 25 fps, and your rip will be 25
1175 fps. However, if you are ripping an NTSC DVD movie, you may need to
1176 apply inverse telecine.
1177 </para>
1178
1179 <para>
1180 For movies shot at 24 fps, the video on the NTSC DVD is either telecined
1181 30000/1001, or else it is progressive 24000/1001 fps and intended to be telecined
1182 on-the-fly by a DVD player. On the other hand, TV series are usually
1183 only interlaced, not telecined. This is not a hard rule: some TV series
1184 are interlaced (such as Buffy the Vampire Slayer) whereas some are a
1185 mixture of progressive and interlaced (such as Angel, or 24).
1186 </para>
1187
1188 <para>
1189 It is highly recommended that you read the section on
1190 <link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link>
1191 to learn how to handle the different possibilities.
1192 </para>
1193
1194 <para>
1195 However, if you are mostly just ripping movies, likely you are either
1196 dealing with 24 fps progressive or telecined video, in which case you can
1197 use the <option>pullup</option> filter <option>-vf
1198 pullup,softskip</option>.
1199 </para>
1200
1201 </sect2>
1202
1203 <sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced">
1204 <title>Encoding interlaced video</title>
1205
1206 <para>
1207 If the movie you want to encode is interlaced (NTSC video or
1208 PAL video), you will need to choose whether you want to
1209 deinterlace or not.
1210 While deinterlacing will make your movie usable on progressive
1211 scan displays such a computer monitors and projectors, it comes
1212 at a cost: The fieldrate of 50 or 60000/1001 fields per second
1213 is halved to 25 or 30000/1001 frames per second, and roughly half of
1214 the information in your movie will be lost during scenes with
1215 significant motion.
1216 </para>
1217
1218 <para>
1219 Therefore, if you are encoding for high quality archival purposes,
1220 it is recommended not to deinterlace.
1221 You can always deinterlace the movie at playback time when
1222 displaying it on progressive scan devices, and future players will
1223 be able to deinterlace to full fieldrate, interpolating 50 or
1224 60000/1001 entire frames per second from the interlaced video.
1225 </para>
1226
1227 <para>
1228 Special care must be taken when working with interlaced video:
1229 </para>
1230
1231 <orderedlist>
1232 <listitem><para>
1233 Crop height and y-offset must be multiples of 4.
1234 </para></listitem>
1235 <listitem><para>
1236 Any vertical scaling must be performed in interlaced mode.
1237 </para></listitem>
1238 <listitem><para>
1239 Postprocessing and denoising filters may not work as expected
1240 unless you take special care to operate them a field at a time,
1241 and they may damage the video if used incorrectly.
1242 </para></listitem>
1243 </orderedlist>
1244
1245 <para>
1246 With these things in mind, here is our first example:
1247 </para>
1248 <screen>
1249 mencoder <replaceable>capture.avi</replaceable> -mc 0 -oac lavc -ovc lavc -lavcopts \
1250 vcodec=mpeg2video:vbitrate=6000:ilmv:ildct:acodec=mp2:abitrate=224
1251 </screen>
1252 <para>
1253 Note the <option>ilmv</option> and <option>ildct</option> options.
1254 </para>
1255 </sect2>
1256
1257 <sect2 id="menc-feat-dvd-mpeg4-filtering">
1258 <title>Filtering</title>
1259
1260 <para>
1261 In general, you want to do as little filtering as possible to the movie
1262 in order to remain close to the original DVD source. Cropping is often
1263 necessary (as described above), but do not scale the video. Although
1264 scaling down is sometimes preferred to using higher quantizers, we want
1265 to avoid both these things: remember that we decided from the start to
1266 trade bits for quality.
1267 </para>
1268
1269 <para>
1270 Also, do not adjust gamma, contrast, brightness, etc. What looks good
1271 on your display may not look good on others. These adjustments should
1272 be done on playback only.
1273 </para>
1274
1275 <para>
1276 One thing you might want to do, however, is pass the video through a
1277 very light denoise filter, such as <option>-vf hqdn3d=2:1:2</option>.
1278 Again, it is a matter of putting those bits to better use: why waste them
1279 encoding noise when you can just add that noise back in during playback?
1280 Increasing the parameters for <option>hqdn3d</option> will further
1281 improve compressibility, but if you increase the values too much, you
1282 risk degrading the image visibily. The suggested values above
1283 (<option>2:1:2</option>) are quite conservative; you should feel free to
1284 experiment with higher values and observe the results for yourself.
1285 </para> 1287 </para>
1286 1288
1287 </sect2> 1289 </sect2>
1288 1290
1289 1291