Difference between revisions of "Mencoder howto"

From QWiki
*>XantoM
 
*>Googler1
Line 1: Line 1:
== 1 Intro ==
+
2604 <a href="http://instruktsiyao47q.pp.ua/">instruktsiyao47q.pp.ua</a> onyx boox m92m perseus инструкция <a href="http://instructionsc5f.pp.ua/">instructionsc5f.pp.ua</a>, <a href="http://rukovodsty16u.pp.ua/">rukovodsty16u.pp.ua</a>,<a href="http://rukovodst0g0p.pp.ua/">rukovodst0g0p.pp.ua</a>, уроки стекло vray.<a href="http://manuals18m.pp.ua/">manuals18m.pp.ua</a>.<a href="http://rukovodstv1du.pp.ua/">rukovodstv1du.pp.ua</a>,структурная схема мпс.<a href="http://rukovodstv0v6l.pp.ua/">rukovodstv0v6l.pp.ua</a>,<a href="http://instruktsiyaqsh8.pp.ua/">instruktsiyaqsh8.pp.ua</a> разработка урока по географии сша. <a href="http://manuals8j0k.pp.ua/">manuals8j0k.pp.ua</a> инструкция по стоматологии.<a href="http://manuali4q9t.pp.ua/">manuali4q9t.pp.ua</a> | <a href="http://rukovodstxip.pp.ua/">rukovodstxip.pp.ua</a> - <a href="http://manualsg7d.pp.ua/">manualsg7d.pp.ua</a>. <a href="http://instructionsrufh.pp.ua/">instructionsrufh.pp.ua</a><a href="http://instruktsiyab7ke.pp.ua/">instruktsiyab7ke.pp.ua</a> аккумулятор медалист инструкция <a href="http://manualix13.pp.ua/">manualix13.pp.ua</a> инструкция graco contour electra deluxe <a href="http://manualiy30.pp.ua/">manualiy30.pp.ua</a>
 
 
 
 
This how-to provides some usual information on creating [[QuakeWorld]] movies (or any other videos) with a powerful LINUX command line tool called mencoder. Mencoder is a part of mplayer and is used to deal with multimedia streams.  
 
 
 
 
 
<b>MPlayer</b>
 
<br>
 
MPlayer  is  a movie player for Linux (runs on many other platforms and CPU architectures, see the documentation). It plays most MPEG/VOB, AVI, ASF/WMA/WMV, RM, QT/MOV/MP4, Ogg/OGM, MKV, VIVO, FLI, NuppelVideo, yuv4mpeg, FILM and RoQ files, supported by many native and binary codecs. You can watch Video CD, SVCD, DVD, 3ivx, DivX 3/4/5 and even WMV movies, too.
 
 
 
 
 
<b>mencoder</b>
 
<br>
 
mencoder (MPlayer's Movie Encoder) is a simple movie encoder, designed to encode MPlayer-playable movies (see above) to other MPlayer-playable formats. It encodes to MPEG-4 (DivX/Xvid), one of the libavcodec codecs and PCM/MP3/VBRMP3 audio in 1, 2 or 3 passes. Furthermore it has stream copying abilities, a powerful filter system (crop, expand, flip, postprocess, rotate, scale,  noise, RGB/YUV conversion) and more.
 
 
 
 
 
=== 1.1. Building a video from screenshots ===
 
 
 
 
 
If you are using QW on a UNIX based operating system and [[ezQuake]] 1.9 or older, then most probably you can capture screenshots at most (unlike windows, where you can capture and encode video on the fly) with mencoder it is quite easy to compile multiple screenshots into an encoded or raw video file.
 
 
 
 
 
<b>To compile all .jpg files in the current directory and use 30 files per second:</b>
 
<pre>
 
mencoder "mf://*.jpg" -mf fps=30 -o output.avi
 
</pre>
 
 
 
 
 
To have the motion unchanged, the fps setting must match the one used during capturing. Changing this value may result in slower or faster playback later. The speed of the output video file can be also adjusted with the -speed parameter.
 
 
 
If your capture resulted in getting tga files instead of jpg just replace mf://*.jpg with mf://*.tga.
 
 
 
=== 1.2. Building a video from other video files ===
 
 
 
You can do the same with multiple video files, compiling them into one, and possibly encoding. Note though that if the video files vary in resolution, the output video's resolution will be the largest from the input videos. The other files will be decorated with black borders around them.
 
 
 
<b>To compile all .avi files in the current directory:</b>
 
<pre>
 
mencoder *.avi -o output.avi
 
</pre>
 
 
 
Note that you might have to add -nosound to the command line due to various problems.
 
 
 
== 2. Encoding ==
 
 
 
There are many codecs available to use with mencoder. Each one has it's own specific encoding options. Short description of the most popular codecs follows. To see what video and audio codecs are available to you, issue the following command:
 
 
 
<pre>mencoder -ovc help -oac help</pre>
 
 
 
You will be shown a list of possible codecs for audio and video. Selecting a codec is done by -ovc <vidcodec> and -oac <audiocodec> in the command line, where ovc stands for output video codec and oac is output audio codec. The most important encoding settings are <b>bitrate, pass, speed and aspect</b>.
 
 
 
 
 
 
 
=== 2.1. xvid codec ===
 
 
 
To encode a video file with the xvid codec (recommended for Frag Of The Week), the -ovc parameter has to be set to xvid and -xvidencopts should follow to enable custom encoding options. Possible encoding options are:
 
 
 
<pre>
 
pass=<1|2> - specify the pass in two pass mode
 
bitrate=<x> - specify the bitrate of the file being encoded (the more, the better quality and bigger file size)
 
</pre>
 
 
 
<b>Example:</b>
 
<pre>
 
mencoder input.avi -o output.avi -ovc xvid -xvidencopts bitrate=3000
 
</pre>
 
 
 
For best results use the two pass mode. Some tasks, such as encoding a live feed in real time, TV-capture or a security camera allow for single pass mode only. In any other case it is recommended to use two pass mode. It is often necessary to resize the final movie clip to the desired resolution and use gamma settings other than the default.
 
 
 
<b>Example of encoding with 2-pass mode, resizing to 320x240 and altering the gamma level to 1.5:</b>
 
 
 
<pre>
 
mencoder "mf://*.tga" -mf fps=25 -o /dev/null -ovc xvid -xvidencopts pass=1:bitrate=3000 -vf scale=320:240,eq2=1.5
 
mencoder "mf://*.tga" -mf fps=25 -o output.avi -ovc xvid -xvidencopts pass=2:bitrate=3000 -vf scale=320:240,eq2=1.5
 
</pre>
 
 
 
The bitrate setting in the first pass is not really needed and mencoder can ignore it.  
 
Mencoder uses the data gathered from the first pass via the divx2pass.log file (so stay in the same dir).
 
 
 
=== 2.2. x264 codec ===
 
 
 
This codec can give very good quality while the file size remains low. It is rapidly gaining popularity among groups releasing movies. The use is very similar to xvid. -ovc has to be set to x264 and the parameter -x264encopts allows for further customization. The nr encoding parameter stands for noise reduction, which might be useful for bad quality videos.
 
 
 
 
 
<b>Example:</b>
 
<pre>
 
mencoder input.avi -o output.avi -ovc x264 -x264encopts bitrate=3000 pass=1 nr=2000
 
</pre>
 
 
 
 
 
 
 
=== 2.3. MPEG codec ===
 
 
 
The MPEG muxer can generate 5 types of streams, each of which has reasonable default parameters that the user can override. Generally, when generating MPEG files, it is advisable to disable mencoder's frame-skip code (see -noskip and -mc).
 
 
 
<b>Example:</b>
 
<pre>
 
mencoder input.avi -o output.avi -ovc lavc -mpegopts format=mpeg2:tsaf:vbitrate=8000 -nosound
 
</pre>
 
 
 
 
 
 
 
=== 2.4. lavc filter ===
 
This filter is supposed to give best quality and relatively small files, according to MPlayer's manual.The following example shows one way of encoding a file with lavc.
 
 
 
<b>Example:</b>
 
<pre>
 
mencoder "mf://*.jpg" -mf fps=30 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4
 
</pre>
 
 
 
<b>Another example:</b>
 
<br>
 
<pre>
 
mencoder input.avi -o output.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=2800
 
</pre>
 
 
 
 
 
 
 
== 3. Using audio ==
 
 
 
 
 
At the current stage of ezQuake's development, there is no possibility to record quake sounds in Linux during capturing. It is still possible to use an audio file as soundtrack. Furthermore, it is possible to encode the audio track (-oac). The -noaudio parameter can be used to remove audio from a video file or not to use audio when compiling one. However, an audio stream can be included thanks to the -audiofile parameter.
 
 
 
 
 
<b>In this next example, mencoder adds an audio track from a .wav file and encodes it to mp3.</b>
 
<pre>
 
mencoder input.avi -o output.avi -ovc copy -oac mp3lame -audiofile soundtrack.wav
 
</pre>
 
 
 
 
 
<b>It is also possible to add an audio stream which is already encoded: </b>
 
<pre>
 
mencoder input.avi -o output.avi -ovc copy -oac copy -audiofile soundtrack.mp3
 
</pre>
 
 
 
 
 
It is a good idea to prepare the audio track beforehand. There is a great tool with GUI to do that under Linux, called <b>audacity</b>. The program is very easy to use thanks to an intuitive interface. It allows mixing, cutting and rearranging of audio files and can export the results to mp3.
 
 
 
 
 
== 4. Author ==
 
 
 
This how-to has been written by [[Faustov]] to help QuakeWorld players create basic videos under Linux.
 
 
 
 
 
[[Category:Tutorials]]
 

Revision as of 12:06, 26 April 2013

2604 <a href="http://instruktsiyao47q.pp.ua/">instruktsiyao47q.pp.ua</a> onyx boox m92m perseus инструкция <a href="http://instructionsc5f.pp.ua/">instructionsc5f.pp.ua</a>, <a href="http://rukovodsty16u.pp.ua/">rukovodsty16u.pp.ua</a>,<a href="http://rukovodst0g0p.pp.ua/">rukovodst0g0p.pp.ua</a>, уроки стекло vray.<a href="http://manuals18m.pp.ua/">manuals18m.pp.ua</a>.<a href="http://rukovodstv1du.pp.ua/">rukovodstv1du.pp.ua</a>,структурная схема мпс.<a href="http://rukovodstv0v6l.pp.ua/">rukovodstv0v6l.pp.ua</a>,<a href="http://instruktsiyaqsh8.pp.ua/">instruktsiyaqsh8.pp.ua</a> разработка урока по географии сша. <a href="http://manuals8j0k.pp.ua/">manuals8j0k.pp.ua</a> инструкция по стоматологии.<a href="http://manuali4q9t.pp.ua/">manuali4q9t.pp.ua</a> | <a href="http://rukovodstxip.pp.ua/">rukovodstxip.pp.ua</a> - <a href="http://manualsg7d.pp.ua/">manualsg7d.pp.ua</a>. <a href="http://instructionsrufh.pp.ua/">instructionsrufh.pp.ua</a><a href="http://instruktsiyab7ke.pp.ua/">instruktsiyab7ke.pp.ua</a> аккумулятор медалист инструкция <a href="http://manualix13.pp.ua/">manualix13.pp.ua</a> инструкция graco contour electra deluxe <a href="http://manualiy30.pp.ua/">manualiy30.pp.ua</a>