comparison DOCS/documentation.html @ 7955:26ddd166422e

updated v4l section
author henry
date Tue, 29 Oct 2002 10:09:10 +0000
parents b582c6fb0053
children 39d486e8836d
comparison
equal deleted inserted replaced
7954:537af7663369 7955:26ddd166422e
196 </UL> 196 </UL>
197 </LI> 197 </LI>
198 <LI><A HREF="#tv">2.5 TV input</A> 198 <LI><A HREF="#tv">2.5 TV input</A>
199 <UL> 199 <UL>
200 <LI><A HREF="#tv_compilation">2.5.1 Compilation</A></LI> 200 <LI><A HREF="#tv_compilation">2.5.1 Compilation</A></LI>
201 <LI><A HREF="#tv_examples">2.5.2 Examples</A></LI> 201 <LI><A HREF="#tv_tips">2.5.2 Usage tips</A></LI>
202 <LI><A HREF="#tv_examples">2.5.3 Examples</A></LI>
202 </UL> 203 </UL>
203 </LI> 204 </LI>
204 </UL> 205 </UL>
205 </LI> 206 </LI>
206 <LI><A HREF="#usage">3. Usage</A> 207 <LI><A HREF="#usage">3. Usage</A>
940 941
941 <P>This section is about how to enable <B>watching/grabbing from V4L compatible 942 <P>This section is about how to enable <B>watching/grabbing from V4L compatible
942 TV tuner</B>. See the man page for a description of TV options and keyboard 943 TV tuner</B>. See the man page for a description of TV options and keyboard
943 controls.</P> 944 controls.</P>
944 945
945 <P><B>THIS CODE IS CURRENTLY NOT BEING WORKED ON! Do not expect it to work
946 without tweaking/experimenting!</B></P>
947
948
949 <H3><A NAME="tv_compilation">2.5.1 Compilation</A></H3> 946 <H3><A NAME="tv_compilation">2.5.1 Compilation</A></H3>
950 947
951 <OL> 948 <OL>
952 <LI>First, you have to recompile. <CODE>./configure</CODE> will autodetect 949 <LI>First, you have to recompile. <CODE>./configure</CODE> will autodetect
953 kernel headers of v4l stuff and the existence of <CODE>/dev/video*</CODE> 950 kernel headers of v4l stuff and the existence of <CODE>/dev/video*</CODE>
955 <CODE>./configure</CODE>).</LI> 952 <CODE>./configure</CODE>).</LI>
956 <LI>Make sure your tuner works with another TV software in Linux, for example 953 <LI>Make sure your tuner works with another TV software in Linux, for example
957 xawtv.</LI> 954 xawtv.</LI>
958 </OL> 955 </OL>
959 956
960 <BLOCKQUOTE> 957 <H3><A NAME="tv_tips">2.5.2 Usage tips</A></H3>
961 <B>Hint</B><BR> 958
962 Are the colors messed up? Then your tuner cannot display 959 The full listing of the options is available on the manual page. Here
963 in YV12 colorspace. Try I420 (<CODE>-vc rawi420</CODE>) or YUY2, UYVY, RGB32 960 are just a few tips:
964 (<CODE>-vo sdl</CODE>) colorspaces. 961
965 You can specify these with the <CODE>outfmt=YV12</CODE> option, see below. 962 <UL>
966 </BLOCKQUOTE> 963
967 964 <LI>
968 965 Choose some sane image dimensions. The dimensions of the resulting
969 <H3><A NAME="tv_examples">2.5.2 Examples</A></H3> 966 image should be divisible by 16.
967 </LI>
968
969 <LI>If you capture the video with the vertical resolution higher than
970 half of the full resolution (i.e. 288 for PAL or 240 for NTSC), make
971 sure you turned deinterlacing on. Otherwise you'll get a movie which
972 is distorted during fast-motion scenes and the bitrate controller will
973 be probably even unable to retain the specified bitrate as the
974 interlacing artifacts produce high amount of detail and thus consume
975 lot of bandwidth. You can enable deinterlacing with <CODE>-vop
976 pp=DEINT_TYPE</CODE>. Usually <CODE>pp=lb</CODE> does a good
977 job, but it can be matter of personal preference. See other
978 deinterlacing algorithms in the manual and give it a try.</LI>
979
980 <LI>
981 Crop out the dead space. When you capture the video, the areas at the
982 edges are usually black or contain some noise. These again consume
983 lots of unnecessary bandwidth. More precisely it's not the black
984 areas themselves but the sharp transitions between the black and the
985 brighter video image which do but that's not important for now. Before
986 you start capturing, adjust the arguments of the <CODE>crop</CODE>
987 option so that all the crap at the margins is cropped out. Again,
988 don't forget to keep the resulting dimensions sane.
989 </LI>
990
991 <LI>
992 Watch out for CPU load. It shouldn't cross the 90% boundary for most
993 of the time. If you have a large capture buffer, MEncoder can survive
994 an overload for few seconds but nothing more. It's better to turn off
995 the 3D OpenGL screensavers and similar stuff.
996 </LI>
997
998 <LI>
999 Don't mess with the system clock. MEncoder uses the system clock for
1000 doing A/V sync. If you adjust the system clock (especially backwards
1001 in time), MEncoder gets confused and you will lose frames. This is an
1002 important issue if you are hooked to a network and run some time
1003 synchronization software like NTP. You have to turn NTP off during the
1004 capture process if you want to capture reliably.
1005 </LI>
1006
1007 <LI>
1008 Don't change the <CODE>outfmt</CODE> unless you know what you are
1009 doing or your card/driver really doesn't support the default (YV12
1010 colorspace) . In the older versions of MPlayer/MEncoder it was necessary
1011 to specify the output format. This issue should be fixed in the
1012 current releases and <CODE>outfmt</CODE> isn't required anymore, and
1013 the default suits the most purposes. For example, if you are capturing
1014 into DivX using libavcodec and specify <CODE>outfmt=RGB24</CODE> in
1015 order to increase the quality of the captured images, the captured
1016 image will be actually later converted back into YV12 so the only
1017 thing you achieve is a massive waste of CPU power.
1018 </LI>
1019
1020 <LI>
1021 To specify the I420 colorspace (<CODE>outfmt=i420</CODE>), you have to
1022 add an option <CODE>-vc rawi420</CODE> due to a fourcc conflict with
1023 an Intel Indeo video codec.
1024 </LI>
1025
1026 <LI>
1027 If MEncoder cannot open the audio device, make sure that it is really
1028 available. There can be some trouble with the sound servers like arts
1029 (KDE) or esd (GNOME). If you have a full duplex soundcard (almost any
1030 decent card supports it today), and you are using KDE, try to check
1031 the "full duplex" option in the sound server preference menu.
1032 </LI>
1033
1034 </UL>
1035
1036 <H3><A NAME="tv_examples">2.5.3 Examples</A></H3>
970 1037
971 <P>Dummy output, to AAlib :)<BR> 1038 <P>Dummy output, to AAlib :)<BR>
972 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mplayer -tv on:driver=dummy:width=640:height=480 -vo aa</CODE><BR> 1039 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mplayer -tv on:driver=dummy:width=640:height=480 -vo aa</CODE><BR>
973 <BR> 1040 <BR>
974 Input from standard V4L<BR> 1041 Input from standard V4L<BR>
975 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mplayer -tv on:driver=v4l:width=640:height=480:outfmt=i420 -vc rawi420 -vo xv</CODE><BR></P> 1042 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mplayer -tv
976 1043 on:driver=v4l:width=640:height=480 -vo xv</CODE><BR>
977 <P><B>Note:</B><BR> 1044 <BR>
978 If you have a TV card with an external audio device and get only a black 1045
979 screen, although input works with xawtv or similar, then try to use the 1046 A more sophisticated example. This makes MEncoder capture the full
980 <CODE>-noaudio</CODE> option. For the example above this would be:<BR> 1047 PAL image, crop the margins, and deinterlace the picture using
981 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mplayer -tv on:noaudio:driver=v4l:width=640:height=480:outfmt=i420 -vc rawi420 -vo xv</CODE></P> 1048 a linear blend algorithm. Audio is compressed with a constant
1049 bitrate of 64kbps, using LAME codec. This setup is suitable for
1050 capturing movies.<BR> <CODE> &nbsp;&nbsp;&nbsp;&nbsp;mencoder -tv
1051 on:driver=v4l:width=768:height=576 \<BR>
1052 &nbsp;&nbsp;&nbsp;&nbsp;-ovc lavc -lavcopts
1053 vcodec=mpeg4:vbitrate=900 \<BR> &nbsp;&nbsp;&nbsp;&nbsp;-oac
1054 mp3lame -lameopts cbr:br=64 \<BR> &nbsp;&nbsp;&nbsp;&nbsp;-vop
1055 pp=lb,crop=720:540:24:18 -o output.avi </CODE><BR>
1056
1057 <BR>
1058 This will additionally rescale the image to 384x288 and compresses
1059 the video with the bitrate of 350kbps in high quality mode. The
1060 vqmax option looses the quantizer and allows the video compressor to
1061 actualy reach so low bitrate even at the expense of the
1062 quality. This can be used for capturing long TV series, where the
1063 video quality isn't so important.<BR>
1064 <CODE>
1065 &nbsp;&nbsp;&nbsp;&nbsp;mencoder -tv on:driver=v4l:width=768:height=576 \<BR>
1066 &nbsp;&nbsp;&nbsp;&nbsp;-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=350:vhq:vqmax=31:keyint=300 \<BR>
1067 &nbsp;&nbsp;&nbsp;&nbsp;-oac mp3lame -lameopts cbr:br=48 \<BR>
1068 &nbsp;&nbsp;&nbsp;&nbsp;-vop scale=384:288,pp=tn/lb,crop=720:540:24:18 -sws 1 -o output.avi
1069 </CODE><BR>
1070
1071 It's also possible to specify smaller image dimensions in the
1072 <CODE>-tv</CODE> option and omit the software scaling but this
1073 approach uses the maximum available information and is a little more
1074 resistant to noise. The bt8x8 chips can do the pixel averaging only
1075 in the horizontal direction due to a hardware limitation.
1076
1077 </P>
982 1078
983 1079
984 1080
985 <H1><A NAME="usage">3. Usage</A></H1> 1081 <H1><A NAME="usage">3. Usage</A></H1>
986 1082