⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video-playback.html

📁 这是很好的学习嵌入式LINUX的文章
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<h4 class="SECT4"><a id="VIDEO-MPLAYER-BUILDING" name="VIDEO-MPLAYER-BUILDING">7.4.2.1.1Building MPlayer</a></h4><p><b class="APPLICATION">MPlayer</b> resides in <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/mplayer/pkg-descr"><ttclass="FILENAME">multimedia/mplayer</tt></a>. <b class="APPLICATION">MPlayer</b> performsa variety of hardware checks during the build process, resulting in a binary which willnot be portable from one system to another. Therefore, it is important to build it fromports and not to use a binary package. Additionally, a number of options can be specifiedin the <tt class="COMMAND">make</tt> command line, as described in the <ttclass="FILENAME">Makefile</tt> and at the start of the build:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">cd /usr/ports/multimedia/mplayer</kbd><samp class="PROMPT">#</samp> <kbd class="USERINPUT">make</kbd>N - O - T - ETake a careful look into the Makefile in orderto learn how to tune mplayer towards you personal preferences!For example,make WITH_GTK1builds MPlayer with GTK1-GUI support.If you want to use the GUI, you can either install/usr/ports/multimedia/mplayer-skinsor download official skin collections fromhttp://www.mplayerhq.hu/homepage/dload.html</pre><p>The default port options should be sufficient for most users. However, if you need theXviD codec, you have to specify the <tt class="MAKEVAR">WITH_XVID</tt> option in thecommand line. The default DVD device can also be defined with the <ttclass="MAKEVAR">WITH_DVD_DEVICE</tt> option, by default <ttclass="FILENAME">/dev/acd0</tt> will be used.</p><p>As of this writing, the <b class="APPLICATION">MPlayer</b> port will build its HTMLdocumentation and two executables, <tt class="COMMAND">mplayer</tt>, and <ttclass="COMMAND">mencoder</tt>, which is a tool for re-encoding video.</p><p>The HTML documentation for <b class="APPLICATION">MPlayer</b> is very informative. Ifthe reader finds the information on video hardware and interfaces in this chapterlacking, the <b class="APPLICATION">MPlayer</b> documentation is a very thoroughsupplement. You should definitely take the time to read the <bclass="APPLICATION">MPlayer</b> documentation if you are looking for information aboutvideo support in <span class="TRADEMARK">UNIX</span>.</p></div><div class="SECT4"><h4 class="SECT4"><a id="VIDEO-MPLAYER-USING" name="VIDEO-MPLAYER-USING">7.4.2.1.2 UsingMPlayer</a></h4><p>Any user of <b class="APPLICATION">MPlayer</b> must set up a <ttclass="FILENAME">.mplayer</tt> subdirectory of her home directory. To create thisnecessary subdirectory, you can type the following:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbdclass="USERINPUT">cd /usr/ports/multimedia/mplayer</kbd><samp class="PROMPT">%</samp> <kbd class="USERINPUT">make install-user</kbd></pre><p>The command options for <tt class="COMMAND">mplayer</tt> are listed in the manualpage. For even more detail there is HTML documentation. In this section, we will describeonly a few common uses.</p><p>To play a file, such as <tt class="FILENAME"><varclass="REPLACEABLE">testfile.avi</var></tt>, through one of the various video interfacesset the <var class="OPTION">-vo</var> option:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">mplayer -vo xv testfile.avi</kbd></pre><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">mplayer -vo sdl testfile.avi</kbd></pre><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">mplayer -vo x11 testfile.avi</kbd></pre><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">mplayer -vo dga testfile.avi</kbd></pre><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">mplayer -vo 'sdl:dga' testfile.avi</kbd></pre><p>It is worth trying all of these options, as their relative performance depends on manyfactors and will vary significantly with hardware.</p><p>To play from a DVD, replace the <tt class="FILENAME">testfile.avi</tt> with <varclass="OPTION">dvd://<var class="REPLACEABLE">N</var> -dvd-device <varclass="REPLACEABLE">DEVICE</var></var> where <var class="REPLACEABLE">N</var> is thetitle number to play and <tt class="FILENAME"><var class="REPLACEABLE">DEVICE</var></tt>is the device node for the DVD-ROM. For example, to play title 3 from <ttclass="FILENAME">/dev/dvd</tt>:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">mplayer -vo xv dvd://3 -dvd-device /dev/dvd</kbd></pre><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> The default DVD device can be defined during the build of the <bclass="APPLICATION">MPlayer</b> port via the <tt class="MAKEVAR">WITH_DVD_DEVICE</tt>option. By default, this device is <tt class="FILENAME">/dev/acd0</tt>. More details canbe found in the port <tt class="FILENAME">Makefile</tt>.</p></blockquote></div><p>To stop, pause, advance and so on, consult the keybindings, which are output byrunning <tt class="COMMAND">mplayer -h</tt> or read the manual page.</p><p>Additional important options for playback are: <var class="OPTION">-fs -zoom</var>which engages the fullscreen mode and <var class="OPTION">-framedrop</var> which helpsperformance.</p><p>In order for the mplayer command line to not become too large, the user can create afile <tt class="FILENAME">.mplayer/config</tt> and set default options there:</p><pre class="PROGRAMLISTING">vo=xvfs=yeszoom=yes</pre><p>Finally, <tt class="COMMAND">mplayer</tt> can be used to rip a DVD title into a <ttclass="FILENAME">.vob</tt> file. To dump out the second title from a DVD, type this:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">mplayer -dumpstream -dumpfile out.vob dvd://2 -dvd-device /dev/dvd</kbd></pre><p>The output file, <tt class="FILENAME">out.vob</tt>, will be MPEG and can bemanipulated by the other packages described in this section.</p></div><div class="SECT4"><h4 class="SECT4"><a id="VIDEO-MENCODER" name="VIDEO-MENCODER">7.4.2.1.3mencoder</a></h4><p>Before using <tt class="COMMAND">mencoder</tt> it is a good idea to familiarizeyourself with the options from the HTML documentation. There is a manual page, but it isnot very useful without the HTML documentation. There are innumerable ways to improvequality, lower bitrate, and change formats, and some of these tricks may make thedifference between good or bad performance. Here are a couple of examples to get yougoing. First a simple copy:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbdclass="USERINPUT">mencoder input.avi -oac copy -ovc copy -o output.avi</kbd></pre><p>Improper combinations of command line options can yield output files that areunplayable even by <tt class="COMMAND">mplayer</tt>. Thus, if you just want to rip to afile, stick to the <var class="OPTION">-dumpfile</var> in <ttclass="COMMAND">mplayer</tt>.</p><p>To convert <tt class="FILENAME">input.avi</tt> to the MPEG4 codec with MPEG3 audioencoding (<a href="http://www.FreeBSD.org/cgi/url.cgi?ports/audio/lame/pkg-descr"><ttclass="FILENAME">audio/lame</tt></a> is required):</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbdclass="USERINPUT">mencoder input.avi -oac mp3lame -lameopts br=192 \     -ovc lavc -lavcopts vcodec=mpeg4:vhq -o output.avi</kbd></pre><p>This has produced output playable by <tt class="COMMAND">mplayer</tt> and <ttclass="COMMAND">xine</tt>.</p><p><tt class="FILENAME">input.avi</tt> can be replaced with <var class="OPTION">dvd://1-dvd-device /dev/dvd</var> and run as <tt class="USERNAME">root</tt> to re-encode a DVDtitle directly. Since you are likely to be dissatisfied with your results the first timearound, it is recommended you dump the title to a file and work on the file.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="VIDEO-XINE" name="VIDEO-XINE">7.4.2.2 The xine VideoPlayer</a></h3><p>The <b class="APPLICATION">xine</b> video player is a project of wide scope aiming notonly at being an all in one video solution, but also in producing a reusable base libraryand a modular executable which can be extended with plugins. It comes both as a packageand as a port, <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/xine/pkg-descr"><ttclass="FILENAME">multimedia/xine</tt></a>.</p><p>The <b class="APPLICATION">xine</b> player is still very rough around the edges, butit is clearly off to a good start. In practice, <b class="APPLICATION">xine</b> requireseither a fast CPU with a fast video card, or support for the XVideo extension. The GUI isusable, but a bit clumsy.</p><p>As of this writing, there is no input module shipped with <bclass="APPLICATION">xine</b> which will play CSS encoded DVD's. There are third partybuilds which do have modules for this built in them, but none of these are in the FreeBSDPorts Collection.</p><p>Compared to <b class="APPLICATION">MPlayer</b>, <b class="APPLICATION">xine</b> doesmore for the user, but at the same time, takes some of the more fine-grained control awayfrom the user. The <b class="APPLICATION">xine</b> video player performs best on XVideointerfaces.</p><p>By default, <b class="APPLICATION">xine</b> player will start up in a graphical userinterface. The menus can then be used to open a specific file:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">xine</kbd></pre><p>Alternatively, it may be invoked to play a file immediately without the GUI with thecommand:</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">xine -g -p mymovie.avi</kbd></pre></div><div class="SECT3"><h3 class="SECT3"><a id="VIDEO-PORTS-TRANSCODE" name="VIDEO-PORTS-TRANSCODE">7.4.2.3 Thetranscode Utilities</a></h3><p>The software <b class="APPLICATION">transcode</b> is not a player, but a suite oftools for re-encoding <tt class="FILENAME">.avi</tt> and <tt class="FILENAME">.mpg</tt>files. With <b class="APPLICATION">transcode</b>, one has the ability to merge videofiles, repair broken files, using command line tools with <ttclass="FILENAME">stdin/stdout</tt> stream interfaces.</p><p>Like <b class="APPLICATION">MPlayer</b>, <b class="APPLICATION">transcode</b> is veryexperimental software which must be build from the port <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/transcode/pkg-descr"><ttclass="FILENAME">multimedia/transcode</tt></a>. Using a great many options to the <ttclass="COMMAND">make</tt> command. We recommend:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">make WITH_LIBMPEG2=yes</kbd></pre><p>If you plan to install <ahref="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/avifile/pkg-descr"><ttclass="FILENAME">multimedia/avifile</tt></a>, then add the <varclass="LITERAL">WITH_AVIFILE</var> option to your <tt class="COMMAND">make</tt> commandline, as shown here:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">make WITH_AVIFILE=yes WITH_LIBMPEG2=yes</kbd></pre><p>Here are two examples of using <tt class="COMMAND">transcode</tt> for video conversionwhich produce rescaled output. The first encodes the output to an openDIVX AVI file,while the second encodes to the much more portable MPEG format.</p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbdclass="USERINPUT">transcode -i input.vob -x vob -V -Z 320x240 \-y opendivx -N 0x55 -o output.avi</kbd></pre><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbdclass="USERINPUT">transcode -i input.vob -x vob -V -Z 320x240 \-y mpeg -N 0x55 -o output.tmp</kbd><samp class="PROMPT">%</samp> <kbdclass="USERINPUT">tcmplex -o output.mpg -i output.tmp.m1v -p output.tmp.mpa -m 1</kbd></pre><p>There is a manual page for <tt class="COMMAND">transcode</tt>, but there is littledocumentation for the various <tt class="COMMAND">tc*</tt> utilities (such as <ttclass="COMMAND">tcmplex</tt>) which are also installed. However, the <varclass="OPTION">-h</var> command line option can always be given to get curt usageinstructions for a command.</p><p>In comparison, <tt class="COMMAND">transcode</tt> runs significantly slower than <ttclass="COMMAND">mencoder</tt>, but it has a better chance of producing a more widelyplayable file. MPEGs created by <tt class="COMMAND">transcode</tt> have been known toplay on <b class="APPLICATION"><span class="TRADEMARK">Windows Media</span>&reg;Player</b> and Apple's <b class="APPLICATION"><spanclass="TRADEMARK">Quicktime</span>&reg;</b>, for example.</p></div></div><div class="SECT2"><h2 class="SECT2"><a id="VIDEO-FURTHER-READING" name="VIDEO-FURTHER-READING">7.4.3Further Reading</a></h2><p>The various video software packages for FreeBSD are developing rapidly. It is quitepossible that in the near future many of the problems discussed here will have beenresolved. In the mean time, those who want to get the very most out of FreeBSD's A/Vcapabilities will have to cobble together knowledge from several FAQs and tutorials anduse a few different applications. This section exists to give the reader pointers to suchadditional information.</p><p>The <a href="http://www.mplayerhq.hu/DOCS/" target="_top">MPlayer documentation</a> isvery technically informative. These documents should probably be consulted by anyonewishing to obtain a high level of expertise with <span class="TRADEMARK">UNIX</span>video. The <b class="APPLICATION">MPlayer</b> mailing list is hostile to anyone who hasnot bothered to read the documentation, so if you plan on making bug reports to them,RTFM.</p><p>The <a href="http://dvd.sourceforge.net/xine-howto/en_GB/html/howto.html"target="_top">xine HOWTO</a> contains a chapter on performance improvement which isgeneral to all players.</p><p>Finally, there are some other promising applications which the reader may try:</p><ul><li><p><a href="http://avifile.sourceforge.net/" target="_top">Avifile</a> which is also aport <a href="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/avifile/pkg-descr"><ttclass="FILENAME">multimedia/avifile</tt></a>.</p></li><li><p><a href="http://www.dtek.chalmers.se/groups/dvd/" target="_top">Ogle</a> which is alsoa port <a href="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/ogle/pkg-descr"><ttclass="FILENAME">multimedia/ogle</tt></a>.</p></li><li><p><a href="http://xtheater.sourceforge.net/" target="_top">Xtheater</a></p></li><li><p><a href="http://www.FreeBSD.org/cgi/url.cgi?ports/multimedia/dvdauthor/pkg-descr"><ttclass="FILENAME">multimedia/dvdauthor</tt></a>, an open source package for authoring DVDcontent.</p></li></ul></div></div><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="sound-mp3.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="tvcard.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">MP3 Audio</td><td width="34%" align="center" valign="top"><a href="multimedia.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Setting Up TV Cards</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting &#60;<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>&#62;.<br />For questions about this documentation, e-mail &#60;<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>&#62;.</small></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -