﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>学习日记 &#187; 视频音频转码</title>
	<atom:link href="https://www.softwareace.cn/?cat=25&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://www.softwareace.cn</link>
	<description>时刻想着为自己的产品多做一些对他好的事情</description>
	<lastBuildDate>Fri, 20 Mar 2026 06:58:28 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>ffmpeg快速命令使用</title>
		<link>https://www.softwareace.cn/?p=640</link>
		<comments>https://www.softwareace.cn/?p=640#comments</comments>
		<pubDate>Wed, 06 Nov 2013 02:50:54 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[视频音频转码]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=640</guid>
		<description><![CDATA[ffmpeg使用语法 ffmpeg [[options][`-i' input_file]]&#8230; { [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>ffmpeg使用语法<br />
ffmpeg [[options][`-i' input_file]]&#8230; {[options] output_file}&#8230;<br />
如果没有输入文件，那么视音频捕捉（只在Linux下有效，因为Linux下把音视频设备当作文件句柄来处理）就会起作用。作为通用的规则，选项一般用于下一个特定的文件。如果你给 –b 64选项，改选会设置下一个视频速率。对于原始输入文件，格式选项可能是需要的。缺省情况下，ffmpeg试图尽可能的无损转换，采用与输入同样的音频视频参数来输出。</p>
<p>ffmpeg转换所涉及到的选项较多，可参考ffmpeg选项详解。</p>
<p>ffmpeg支持多种文件格式和多种音频、视频编码器，可参考ffmepg格式详解，</p>
<div></div>
<div>
<h2><a>代码片段(20)</a><a href="http://www.oschina.net/code/piece_full?code=25379" target="_blank">[全屏查看所有代码]</a></h2>
<div>
<h3>1. [代码]截取一张352&#215;240尺寸大小的，格式为jpg的图片     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42188#42188" target="_blank" name="42188"></a></h3>
<div id="highlighter_541440">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i </code><code>test</code><code>.asf -y -f image2 -t 0.001 -s 352x240 a.jpg</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>2. [代码]把视频的前30帧转换成一个Animated Gif      <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42189#42189" target="_blank" name="42189"></a></h3>
<div id="highlighter_194015">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i </code><code>test</code><code>.asf -vframes 30 -y -f gif a.gif</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>3. [代码]截取指定时间的缩微图,-ss后跟的时间单位为秒     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42190#42190" target="_blank" name="42190"></a></h3>
<div id="highlighter_699237">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i </code><code>test</code><code>.avi -y -f image2 -ss 8 -t 0.001 -s 350x240 </code><code>test</code><code>.jpg</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>4. [代码]转换文件为3GP格式     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42191#42191" target="_blank" name="42191"></a></h3>
<div id="highlighter_820708">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -y -i </code><code>test</code><code>.mpeg -bitexact -vcodec h263 -b 128 -r 15 -s 176x144 -acodec aac -ac 2 -ar 22500 -ab 24 -f 3gp </code><code>test</code><code>.3gp</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>5. [代码]转换文件为3GP格式 v2     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42192#42192" target="_blank" name="42192"></a></h3>
<div id="highlighter_149436">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -y -i </code><code>test</code><code>.wmv -ac 1 -acodec libamr_nb -ar 8000 -ab 12200 -s 176x144 -b 128 -r 15 </code><code>test</code><code>.3gp</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>6. [代码]如何使用 ffmpeg 编码得到高质量的视频     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42193#42193" target="_blank" name="42193"></a></h3>
<div id="highlighter_774959">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg.exe -i </code><code>"D:\Video\Fearless\Fearless.avi"</code> <code>-target film-dvd -s 720x352 -padtop 64 -padbottom 64 -maxrate 7350000 -b 3700000 -sc_threshold 1000000000 -trellis -cgop -g 12 -bf 2 -qblur 0.3 -qcomp 0.7 -me full -</code><code>dc</code> <code>10 -mbd 2 -aspect 16:9 -pass 2 -passlogfile</code><code>"D:\Video\ffmpegencode"</code> <code>-an -f mpeg2video </code><code>"D:\Fearless.m2v"</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>7. [代码]转换指定格式文件到FLV格式     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42194#42194" target="_blank" name="42194"></a></h3>
<div id="highlighter_430756">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg.exe -i </code><code>test</code><code>.mp3 -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 f:\</code><code>test</code><code>.flv</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>ffmpeg.exe -i </code><code>test</code><code>.wmv -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 f:\</code><code>test</code><code>.flv</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>8. [代码]转码解密的VOB     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42195#42195" target="_blank" name="42195"></a></h3>
<div id="highlighter_117867">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp3 -ab 128 snatch.avi</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>上面的命令行将vob的文件转化成avi文件，mpeg4的视频和mp3的音频。注意命令中使用了B帧，所以mpeg4流是divx5兼容的。GOP大小是300意味着29.97帧频下每10秒就有INTRA帧。该映射在音频语言的DVD转码时候尤其有用。</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>echo</code> <code>同时编码到几种格式并且在输入流和输出流之间建立映射</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>9. [代码]转换wav到mp2格式     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42196#42196" target="_blank" name="42196"></a></h3>
<div id="highlighter_197883">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>上面的命令行转换一个64Kbits 的a.wav到128kbits的a.mp2 ‘-map </code><code>file</code><code>:index’在输出流的顺序上定义了哪一路输入流是用于每一个输出流的。</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>10. [代码]转换文件为3GP格式     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42197#42197" target="_blank" name="42197"></a></h3>
<div id="highlighter_890290">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i </code><code>test</code><code>.avi -y -b 20 -s sqcif -r 10 -acodec amr_wb -ab 23.85 -ac 1 -ar 16000</code><code>test</code><code>.3gp</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>注：如果要转换为3GP格式，则ffmpeg在编译时必须加上–</code><code>enable</code><code>-amr_nb –</code><code>enable</code><code>-amr_wb，详细内容可参考：转换视频为3GPP格式</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>11. [代码]转换文件为MP4格式（支持iPhone/iTouch）      <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42198#42198" target="_blank" name="42198"></a></h3>
<div id="highlighter_352590">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg  -y  -i input.wmv  -f mp4 -async 1-s 480x320  -acodec libfaac -vcodec libxvid  -qscale 7 -dts_delta_threshold 1 output.mp4</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>ffmpeg  -y  -i source_video.avi input -acodec libfaac -ab 128000 -vcodec mpeg4 -b 1200000 -mbd 2 -flags +4mv+trell -aic 2 -</code><code>cmp</code> <code>2 -subcmp 2 -s 320x180 -title X final_video.mp4</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>12. [代码]将一段音频与一段视频混合      <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42199#42199" target="_blank" name="42199"></a></h3>
<div id="highlighter_14244">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i son.wav -i video_origine.avi video_finale.mpg</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>13. [代码]将一段视频转换为DVD格式     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42200#42200" target="_blank" name="42200"></a></h3>
<div id="highlighter_962150">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i source_video.avi -target pal-dvd -</code><code>ps</code> <code>2000000000 -aspect 16:9 finale_video.mpeg</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>注：target pal-dvd : Output </code><code>format</code> <code>ps</code> <code>2000000000 maximum size </code><code>for</code> <code>the output </code><code>file</code><code>,</code><code>in</code> <code>bits (here, 2 Gb) aspect 16:9 : Widescreen</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>14. [代码]转换一段视频为DivX格式      <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42201#42201" target="_blank" name="42201"></a></h3>
<div id="highlighter_282909">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i video_origine.avi -s 320x240 -vcodec msmpeg4v2 video_finale.avi</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>15. [代码]Turn X images to a video sequence      <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42202#42202" target="_blank" name="42202"></a></h3>
<div id="highlighter_645732">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -f image2 -i image%d.jpg video.mpg</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>注：This </code><code>command</code> <code>will transform all the images from the current directory (named image1.jpg, image2.jpg, etc...) to a video </code><code>file</code> <code>named video.mpg.</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>16. [代码]Turn a video to X images      <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42203#42203" target="_blank" name="42203"></a></h3>
<div id="highlighter_846697">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -i video.mpg image%d.jpg</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>注：This </code><code>command</code> <code>will generate the files named image1.jpg, image2.jpg, ...</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>echo</code> <code>The following image formats are also availables : PGM, PPM, PAM, PGMYUV, JPEG, GIF, PNG, TIFF, SGI.</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>17. [代码]使用ffmpeg录像屏幕(仅限Linux平台)     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42204#42204" target="_blank" name="42204"></a></h3>
<div id="highlighter_320060">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1024x768 ~/</code><code>test</code><code>.avi</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>其中，-vd x11:0,0 指录制所使用的偏移为 x=0 和 y=0，-s 1024×768 指录制视频的大小为 1024×768。录制的视频文件为 </code><code>test</code><code>.avi，将保存到用户主目录中</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>echo</code> <code>如果你只想录制一个应用程序窗口或者桌面上的一个固定区域，那么可以指定偏移位置和区域大小。使用xwininfo -frame命令可以完成查找上述参数。</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>18. [代码]重新调整视频尺寸大小(仅限Linux平台)     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42205#42205" target="_blank" name="42205"></a></h3>
<div id="highlighter_689033">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -i ~/</code><code>test</code><code>.avi -s 800×600 ~/</code><code>test</code><code>-800-600.avi</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>19. [代码]把摄像头的实时视频录制下来，存储为文件(仅限Linux平台)     <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42206#42206" target="_blank" name="42206"></a></h3>
<div id="highlighter_19760">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg  -f video4linux -s 320*240 -r 10 -i /dev/video0 </code><code>test</code><code>.asf</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>更多信息可参考ffmpeg工程组论坛的讨论贴：有关ffmpeg的视频采集</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<h3>20. [代码]使用ffmpeg压制H.264视频     <a>跳至</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42188">[1]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42189">[2]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42190">[3]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42191">[4]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42192">[5]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42193">[6]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42194">[7]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42195">[8]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42196">[9]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42197">[10]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42198">[11]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42199">[12]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42200">[13]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42201">[14]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42202">[15]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42203">[16]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42204">[17]</a><a href="http://www.oschina.net/code/snippet_222150_25379#42205">[18]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42206">[19]</a> <a href="http://www.oschina.net/code/snippet_222150_25379#42207">[20]</a> <a href="http://www.oschina.net/code/piece_full?code=25379&amp;piece=42207#42207" target="_blank" name="42207">[全屏预览]</a></h3>
<div id="highlighter_84038">
<div>
<div><a title="view source" href="http://www.oschina.net/code/snippet_222150_25379#viewSource">view source</a></p>
<div></div>
<p><a title="print" href="http://www.oschina.net/code/snippet_222150_25379#printSource">print</a><a title="?" href="http://www.oschina.net/code/snippet_222150_25379#about">?</a></div>
</div>
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>ffmpeg -threads 4 -i INPUT -r 29.97 -vcodec libx264 -s 480x272 -flags +loop -</code><code>cmp</code> <code>chroma -deblockalpha 0 -deblockbeta 0 -crf 24 -bt 256k -refs 1 -coder 0 -me umh -me_range 16 -subq 5 -partitions parti4x4+parti8x8+partp8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec libfaac -ab 128k -ar 48000 -ac 2 OUTPUT</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>echo</code> <code>注：使用该指令可以压缩出比较清晰，而且文件转小的H.264视频文件</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=640</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>youtube视频解析下载</title>
		<link>https://www.softwareace.cn/?p=227</link>
		<comments>https://www.softwareace.cn/?p=227#comments</comments>
		<pubDate>Thu, 28 Feb 2013 06:15:26 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[视频音频转码]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=227</guid>
		<description><![CDATA[ https://github.com/rg3/youtube-dl http://rg3.github.co [&#8230;]]]></description>
				<content:encoded><![CDATA[<ul>
<li> https://github.com/rg3/youtube-dl</li>
<li>http://rg3.github.com/youtube-dl/documentation.html</li>
<li>http://www.soimort.org/posts/119/</li>
<li>http://liaojieliao.blog.163.com/blog/static/44078131200791793613617/</li>
<li>http://bbs.pediy.com/archive/index.php?t-152974.html</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=227</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another YouTube Downloader js</title>
		<link>https://www.softwareace.cn/?p=153</link>
		<comments>https://www.softwareace.cn/?p=153#comments</comments>
		<pubDate>Thu, 31 Jan 2013 04:19:25 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[视频音频转码]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=153</guid>
		<description><![CDATA[[crayon-69fab3a0e9360745508463/]]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">// ==UserScript==
// @name           Another YouTube Downloader
// @version        1.2.7
// @namespace      http://pradip.x10.mx/
// @author         Pradip Vadher
// @license        GPL3+ (http://www.gnu.org/copyleft/gpl.html)
// @description    Download now playing video in available formats.
// @include        http://*.youtube.com/*
// @include        https://*.youtube.com/*
// @exclude        http://m.youtube.com/*
// @exclude        https://m.youtube.com/*
// @grant          GM_log
// @grant          GM_getValue
// @grant          GM_setValue
// @grant          GM_xmlhttpRequest
// @grant          GM_addStyle
// @grant          GM_registerMenuCommand
// @grant          unsafeWindow
// ==/UserScript==

/*

Changelog for SourceForge:

v1.1.9:
	-&amp;gt; Initial version on SourceForge.
	
v1.2.0:
	-&amp;gt; CSS fixed for buttons.
	-&amp;gt; Some debug information added.
	
v1.2.1
	-&amp;gt; NoScript supported again. Works without JavaScript enabled.

v1.2.2
	-&amp;gt; Some fixes
	-&amp;gt; One more method added to find download links. 5 methods to find them all.
	
v1.2.3
	-&amp;gt; Tooltips styled.
	
v1.2.4
	-&amp;gt; New layout support.
	
v1.2.5
	-&amp;gt; Two new preferences: Enable/Disable ToolTips and Sort/Unsort Video Formats.
	-&amp;gt; New &amp;quot;signature&amp;quot; flashvar added.
	-&amp;gt; grants added for new Greasemonkey versions.

v1.2.6
	-&amp;gt; Bug fix: Only first link was working.

V1.2.7
	-&amp;gt; Bug fix: No title on new layout.
	
*/

/*

YouTube urls to test

* Blocked in USA:		https://www.youtube.com/watch?v=1UR6klggoJo
* Another:				https://www.youtube.com/watch?v=F4P3j8dh2ro
* Embed disabled:		https://www.youtube.com/watch?v=7vMUvgce_5s
* Slash in filename:	https://www.youtube.com/watch?v=JL6Wasm2J-8
* RTMPE Streaming:		https://www.youtube.com/watch?v=R9upjxi7_lk
* No embed:				https://www.youtube.com/watch?v=Rb43gnZI1A0

*/

var AnotherYouTubeDownloaderTranslation = {};
AnotherYouTubeDownloaderTranslation = { // You can add your own translation. Debug strings, video properties and helper application strings are not translated.
	strTranslations: {
		&amp;quot;en&amp;quot; : { // English
			0: &amp;quot;LQ Download button is shown.nnPress OK to hide.&amp;quot;,
			1: &amp;quot;LQ Download button is not shown.nnPress OK to show. (Needs refresh)&amp;quot;,
			2: &amp;quot;Add mobile compatible links to download links&amp;quot;,
			3: &amp;quot;LQ&amp;quot;,
			4: &amp;quot;LQ Download&amp;quot;,
			5: &amp;quot;Loading&amp;quot;,
			6: &amp;quot;Unable to fetch links. Try again.&amp;quot;,
			7: &amp;quot;Unknown&amp;quot;,
			8: &amp;quot;Download this video&amp;quot;,
			9: &amp;quot;Download&amp;quot;,
			10: &amp;quot;Stream&amp;quot;,
			11: &amp;quot;Show/Hide LQ Download Button&amp;quot;,
			12: &amp;quot;Enable/Disable ToolTips&amp;quot;,
			13: &amp;quot;Press OK to disable ToolTips. (Needs refresh)&amp;quot;,
			14: &amp;quot;Press OK to enable ToolTips. (Needs refresh)&amp;quot;,
			15: &amp;quot;Sort/Unsort Formats&amp;quot;,
			16: &amp;quot;Press OK to sort formats. (Needs refresh)&amp;quot;,
			17: &amp;quot;Press OK to unsort formats. (Needs refresh)&amp;quot;
		},
		&amp;quot;sms&amp;quot; : { // SMS
			0: &amp;quot;LQDL is shown.nnPress OK to hide.&amp;quot;,
			1: &amp;quot;LQDL is hidden.nnPress OK to show.&amp;quot;,
			2: &amp;quot;Mob links&amp;quot;,
			3: &amp;quot;LQ&amp;quot;,
			4: &amp;quot;LQDL&amp;quot;,
			5: &amp;quot;Wait&amp;quot;,
			6: &amp;quot;Err. Retry.&amp;quot;,
			7: &amp;quot;?&amp;quot;,
			8: &amp;quot;DL&amp;quot;,
			9: &amp;quot;DL&amp;quot;,
			10: &amp;quot;STRM&amp;quot;,
			11: &amp;quot;LQDL Config&amp;quot;,
			12: &amp;quot;ToolTips&amp;quot;,
			13: &amp;quot;Press OK to disable ToolTips.&amp;quot;,
			14: &amp;quot;Press OK to enable ToolTips.&amp;quot;,
			15: &amp;quot;Sort/Unsort Fmt&amp;quot;,
			16: &amp;quot;Press OK to sort formats.&amp;quot;,
			17: &amp;quot;Press OK to unsort formats.&amp;quot;
		}
	},
	getLanguage: function () {
		var preferedLanguage = &amp;quot;&amp;quot;,  strUserLang; // Set preferedLanguage to your prefered language short, like preferedLanguage=&amp;quot;sms&amp;quot;;
		if (preferedLanguage.length !== 0) {
			strUserLang = preferedLanguage;
		} else if (navigator &amp;amp;&amp;amp; navigator.language) {
			strUserLang = navigator.language.toLowerCase();
		} else {
			strUserLang = &amp;quot;en&amp;quot;;
		}
		if (strUserLang.indexOf(&amp;quot;-&amp;quot;) !== -1 &amp;amp;&amp;amp; !AnotherYouTubeDownloaderTranslation.strTranslations[strUserLang]) {
			strUserLang = strUserLang.substring(0, strUserLang.indexOf(&amp;quot;-&amp;quot;));
		}
		if (!AnotherYouTubeDownloaderTranslation.strTranslations[strUserLang]) {
			strUserLang = &amp;quot;en&amp;quot;;
		}
		return strUserLang;
	},
	getTranslation:function (id) {
		return AnotherYouTubeDownloaderTranslation.strTranslations[AnotherYouTubeDownloaderTranslation.getLanguage()][id];
	}
};
Logger={
	blLog: false, 
	LOG_TYPE_CONSOLE: 0,
	LOG_TYPE_GM_LOG: 1,
	LOG_TYPE_ALERT: 2,
	LOG_TYPE_GM_ALERT: 3,
	log: function (strMessage, intType){
		if(Logger.blLog==false)
			return;
		switch(intType){
			case Logger.LOG_TYPE_GM_LOG:
				if(typeof GM_log!=&amp;quot;undefined&amp;quot;){
					GM_log(strMessage);
					break;
				} else {
					Logger.log(strMessage, Logger.LOG_TYPE_CONSOLE);
				}
			case Logger.LOG_TYPE_CONSOLE:
				if(typeof console != &amp;quot;undefined&amp;quot; &amp;amp;&amp;amp; console.log)
					console.log(strMessage);
				else
					Logger.log(strMessage, Logger.LOG_TYPE_ALERT);
				break;
			case Logger.LOG_TYPE_ALERT:
				if(typeof unsafeWindow!=&amp;quot;undefined&amp;quot; &amp;amp;&amp;amp; unsafeWindow.alert){
					unsafeWindow.alert(strMessage);
					break;
				} else {
					Logger.log(strMessage, Logger.LOG_TYPE_GM_ALERT);
				}
			case Logger.LOG_TYPE_GM_ALERT: // Don&amp;#39;t use for too many alerts
				alert(strMessage); 
				break;
		}
	},
	space: function (intTimes){
		if(Logger.blLog==false)
			return &amp;quot;[Logger Disabled]&amp;quot;;
		var strReturn=&amp;quot;&amp;quot;;
		for(var i=0;i&amp;lt;intTimes;i++){
			strReturn+=&amp;quot; &amp;quot;;
		}
		return strReturn;
	},
	formatArray: function (aArray, intLevel){
		if(Logger.blLog==false)
			return &amp;quot;[Logger Disabled]&amp;quot;;
		if(!intLevel)
			intLevel=0;
		var strReturn=Logger.space(intLevel)+&amp;quot;[&amp;quot;;
		for(var i in aArray){
			if(typeof aArray[i]!=&amp;quot;string&amp;quot; &amp;amp;&amp;amp; aArray[i].length)
				strReturn+=formatArray(aArray[i], intLevel+1);
			else
				strReturn+=Logger.space(intLevel+1)+&amp;quot;n&amp;quot;+i+&amp;quot;: &amp;#39;&amp;quot;+aArray[i]+&amp;quot;&amp;#39;,&amp;quot;;
		}
		strReturn+=&amp;quot;n]&amp;quot;;
		return strReturn;
	}
};
AnotherYouTubeDownloader={
	blHelperInstalled: false, // Helper finds the file size of video without downloading.
	$: function(id){
		if(document &amp;amp;&amp;amp; document.getElementById)
			return document.getElementById(id);
		else
			return null;
	},
	$$: function(tag){
		if(document &amp;amp;&amp;amp; document.getElementsByTagName)
			return document.getElementsByTagName(tag);
		else
			return null;
	},
	isWatchPage: function(){
		return (location.pathname.indexOf(&amp;quot;/watch&amp;quot;)==0);
	},
	isUserChannelPage: function(){
		return (!AnotherYouTubeDownloader.isWatchPage() &amp;amp;&amp;amp; (location.pathname.indexOf(&amp;quot;/user&amp;quot;)==0 || AnotherYouTubeDownloader.$(&amp;quot;playnav-title-bar&amp;quot;)));
	},
	isGreasemonkey: function(){
		try{
			if(typeof GM_getValue!=&amp;quot;undefined&amp;quot; &amp;amp;&amp;amp; GM_getValue(&amp;quot;test&amp;quot;,&amp;quot;test&amp;quot;)){
				return true;
			} else {
				return false;
			}
		}catch(e){
			return false;
		}
	},
	fetchDownloadLinks: function(){
		if(AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;))
			return;
		if (AnotherYouTubeDownloader.isUserChannelPage()){
			if(document.body.removeEventListener)
				document.body.removeEventListener(&amp;quot;DOMNodeInserted&amp;quot;,AnotherYouTubeDownloader.domChanged,false);
		}
		var divEmbed=AnotherYouTubeDownloader.$$(&amp;quot;embed&amp;quot;);
		var divVideos=AnotherYouTubeDownloader.$$(&amp;quot;video&amp;quot;);
		if(divEmbed.length&amp;gt;0)
			divEmbed=divEmbed[0];
		else
			divEmbed=null;
		var blLinksAdded=false;
		
		// Method 1: Find from &amp;lt;embed&amp;gt; tag.
		if(blLinksAdded==false &amp;amp;&amp;amp; divEmbed &amp;amp;&amp;amp; divEmbed.getAttribute(&amp;quot;flashvars&amp;quot;)) {
			try{
				AnotherYouTubeDownloader.putDownloadLinksFromFlashVars(divEmbed.getAttribute(&amp;quot;flashvars&amp;quot;));
				if(AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;)){
					if(divEmbed.getAttribute(&amp;quot;flashvars&amp;quot;).indexOf(&amp;quot;cc_module&amp;quot;)!=-1)
						AnotherYouTubeDownloader.addDownloadLink(&amp;quot;http://www.youtube.com/api/timedtext?name=&amp;amp;format=1&amp;amp;hl=en&amp;amp;type=track&amp;amp;lang=en&amp;amp;v=&amp;quot;+AnotherYouTubeDownloader.getVidId()+&amp;quot;&amp;amp;kind=&amp;quot;,&amp;quot;text/xml&amp;quot;,&amp;quot;Subtitles&amp;quot;,&amp;quot;x&amp;quot;,0,&amp;quot;x&amp;quot;);
					blLinksAdded=true;
				}
			}catch(e){
				Logger.log(&amp;quot;Error while adding links from embed-&amp;gt;flashvars: &amp;quot;+e, Logger.LOG_TYPE_ALERT);
			}
		}
		if(blLinksAdded==false){
			Logger.log(&amp;quot;Unable to find links from embed-&amp;gt;flashvars .&amp;quot;, Logger.LOG_TYPE_CONSOLE);
			Logger.log(&amp;quot;Trying to find links from yt.config_-&amp;gt;flashvars .&amp;quot;, Logger.LOG_TYPE_CONSOLE);
		}
		
		// Method 2: Find from yt object set by page js
		if (blLinksAdded==false &amp;amp;&amp;amp; (window.yt || (typeof unsafeWindow != &amp;quot;undefined&amp;quot; &amp;amp;&amp;amp; unsafeWindow.yt))) {
			try{
				var yt;
				if(window.yt)
					yt=window.yt;
				else
					yt=unsafeWindow.yt;
				if(yt.config_ &amp;amp;&amp;amp; yt.config_.PLAYER_CONFIG &amp;amp;&amp;amp; yt.config_.PLAYER_CONFIG.args &amp;amp;&amp;amp; yt.config_.PLAYER_CONFIG.args.fmt_list &amp;amp;&amp;amp; yt.config_.PLAYER_CONFIG.args.url_encoded_fmt_stream_map){
					AnotherYouTubeDownloader.putDownloadLinks(yt.config_.PLAYER_CONFIG.args.fmt_list, yt.config_.PLAYER_CONFIG.args.url_encoded_fmt_stream_map);
				}
				if(AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;)){
					if(yt.config_.PLAYER_CONFIG.args.cc_module)
						AnotherYouTubeDownloader.addDownloadLink(&amp;quot;http://www.youtube.com/api/timedtext?name=&amp;amp;format=1&amp;amp;hl=en&amp;amp;type=track&amp;amp;lang=en&amp;amp;v=&amp;quot;+AnotherYouTubeDownloader.getVidId()+&amp;quot;&amp;amp;kind=&amp;quot;,&amp;quot;text/xml&amp;quot;,&amp;quot;Subtitles&amp;quot;,&amp;quot;?&amp;quot;,0,&amp;quot;?&amp;quot;);
					blLinksAdded=true;
				}
			}catch(e){
				Logger.log(&amp;quot;Error while adding links from yt.config_-&amp;gt;flashvars: &amp;quot;+e, Logger.LOG_TYPE_ALERT);
			}
		}
		if (blLinksAdded==false) {
			Logger.log(&amp;quot;Unable to find links from yt.config_-&amp;gt;flashvars .&amp;quot;, Logger.LOG_TYPE_CONSOLE);
			Logger.log(&amp;quot;Trying to find links from js embed-&amp;gt;flashvars .&amp;quot;, Logger.LOG_TYPE_CONSOLE);
		}
		
		// Method 3: Find from &amp;lt;embed&amp;gt; tag in js, but not executed, only for NoScript
		if (blLinksAdded==false &amp;amp;&amp;amp; document.scripts.length&amp;gt;0){
			try{
				for(var i=0;i&amp;lt;document.scripts.length;i++){
					var scriptCode=document.scripts[i].innerHTML;
					if(scriptCode.indexOf(&amp;quot;fmt_list=&amp;quot;)!=-1 &amp;amp;&amp;amp; scriptCode.indexOf(&amp;quot;url_encoded_fmt_stream_map=&amp;quot;)!=-1){
						//scriptCode=scriptCode.replace(/\/g, &amp;quot;&amp;quot;);
						scriptCode=scriptCode.replace(/\//g, &amp;quot;/&amp;quot;).replace(/\u0026/g, &amp;quot;&amp;amp;&amp;quot;);
						//scriptCode=unescape(unescape(unescape(scriptCode)));
						AnotherYouTubeDownloader.putDownloadLinksFromFlashVars(scriptCode);
					}
				}
				if(AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;)){
					blLinksAdded=true;
				}
			}catch(e){
				Logger.log(&amp;quot;Error while adding links from js embed-&amp;gt;flashvars: &amp;quot;+e, Logger.LOG_TYPE_ALERT);
			}
		}
		if (blLinksAdded==false){
			Logger.log(&amp;quot;Unable to find links from js embed-&amp;gt;flashvars .&amp;quot;, Logger.LOG_TYPE_CONSOLE);
			Logger.log(&amp;quot;Trying to find links from javascript-&amp;gt;flashvars.&amp;quot;, Logger.LOG_TYPE_CONSOLE);
		}
		
		// Method 4: Find from yt object in js, not executed or removed by js
		if (blLinksAdded==false &amp;amp;&amp;amp; document.scripts.length&amp;gt;0){
			try{
				for(var i=0;i&amp;lt;document.scripts.length;i++){
					var scriptCode=document.scripts[i].innerHTML;
					if(scriptCode.indexOf(&amp;quot;&amp;quot;fmt_list&amp;quot;:&amp;quot;)!=-1 &amp;amp;&amp;amp; scriptCode.indexOf(&amp;quot;&amp;quot;url_encoded_fmt_stream_map&amp;quot;:&amp;quot;)!=-1){
						var fmt_list=scriptCode.substr(scriptCode.indexOf(&amp;quot;&amp;quot;fmt_list&amp;quot;:&amp;quot;)+(&amp;quot;&amp;quot;fmt_list&amp;quot;:&amp;quot;).length).trim();
						fmt_list=fmt_list.substring(1, fmt_list.substr(1).indexOf(&amp;quot;&amp;quot;&amp;quot;)+1);
						fmt_list=fmt_list.replace(/\//g, &amp;quot;/&amp;quot;).replace(/\u0026/g, &amp;quot;&amp;amp;&amp;quot;);
						var fmt_stream_map=scriptCode.substr(scriptCode.indexOf(&amp;quot;&amp;quot;url_encoded_fmt_stream_map&amp;quot;:&amp;quot;)+(&amp;quot;&amp;quot;url_encoded_fmt_stream_map&amp;quot;:&amp;quot;).length).trim();
						fmt_stream_map=fmt_stream_map.substring(1, fmt_stream_map.substr(1).indexOf(&amp;quot;&amp;quot;&amp;quot;)+1);
						fmt_stream_map=fmt_stream_map.replace(/\//g, &amp;quot;/&amp;quot;).replace(/\u0026/g, &amp;quot;&amp;amp;&amp;quot;);
						AnotherYouTubeDownloader.putDownloadLinks(fmt_list, fmt_stream_map);
					}
				}
				if(AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;)){
					blLinksAdded=true;
				}
			}catch(e){
				Logger.log(&amp;quot;Error while adding links from javascript-&amp;gt;flashvars: &amp;quot;+e, Logger.LOG_TYPE_ALERT);
			}
		}
		if (blLinksAdded==false){
			Logger.log(&amp;quot;Unable to find links from javascript-&amp;gt;flashvars .&amp;quot;, Logger.LOG_TYPE_CONSOLE);
			Logger.log(&amp;quot;Trying to find links from HTML5 Video.&amp;quot;, Logger.LOG_TYPE_CONSOLE);
		}
		
		// Method 5: Find from &amp;lt;video&amp;gt; tag
		if (blLinksAdded==false &amp;amp;&amp;amp; divVideos.length&amp;gt;0){
			try{
				for(var i=0;i&amp;lt;divVideos.length;i++){
					if(divVideos[i].src)
						AnotherYouTubeDownloader.addLink(divVideos[i].src);
				}
				if(AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;))
					blLinksAdded=true;
			}catch(e){
				Logger.log(&amp;quot;Error while adding links from html5video-&amp;gt;flashvars: &amp;quot;+e, Logger.LOG_TYPE_ALERT);
			}
		}
		if (blLinksAdded==false) {
			Logger.log(&amp;quot;Unable to find links from HTML5 Video. No downloads available.&amp;quot;, Logger.LOG_TYPE_CONSOLE);
		}
		
		if(blLinksAdded==true &amp;amp;&amp;amp; AnotherYouTubeDownloader.isGreasemonkey()){
			AnotherYouTubeDownloader.putMobileCompatibleLinks();
		}
		
		if (AnotherYouTubeDownloader.isUserChannelPage()){
			if(document.body.addEventListener)
				document.body.addEventListener(&amp;quot;DOMNodeInserted&amp;quot;,AnotherYouTubeDownloader.domChanged,false);
		}
	},
	putDownloadLinksFromFlashVars: function(strFlashVars){
		strFlashVars=unescape(strFlashVars.replace(/&amp;amp;amp;/g,&amp;quot;&amp;amp;&amp;quot;)); //.replace(/amp;/g, &amp;quot;&amp;amp;&amp;quot;);
		var fmt_list=strFlashVars.match(/fmt_list=([0-9/x,]*)&amp;amp;/)[1];
		/*if(fmt_list.indexOf(&amp;quot;&amp;amp;&amp;quot;)!=-1)
			fmt_list=fmt_list.substr(0,fmt_list.indexOf(&amp;quot;&amp;amp;&amp;quot;));*/
		/*if(fmt_list.indexOf(&amp;quot;amp;&amp;quot;)!=-1)
			fmt_list=fmt_list.substr(0,fmt_list.indexOf(&amp;quot;amp;&amp;quot;));*/;
		var fmt_stream_map=strFlashVars.match(/url_encoded_fmt_stream_map=(.*)/)[1];
		AnotherYouTubeDownloader.putDownloadLinks(fmt_list, fmt_stream_map);
	},
	putDownloadLinks: function(fmt_list, fmt_stream_map){
		var fmt_list_s=fmt_list.split(&amp;quot;,&amp;quot;);
		var fmt_stream_maps=fmt_stream_map.split(&amp;quot;,&amp;quot;);
		Logger.log(&amp;quot;fmt_list:n&amp;quot;+fmt_list, Logger.LOG_TYPE_CONSOLE);
		Logger.log(&amp;quot;fmt_list_s:n&amp;quot;+Logger.formatArray(fmt_list_s), Logger.LOG_TYPE_CONSOLE);
		Logger.log(&amp;quot;fmt_stream_map:n&amp;quot;+fmt_stream_map, Logger.LOG_TYPE_CONSOLE);
		Logger.log(&amp;quot;fmt_stream_maps:n&amp;quot;+Logger.formatArray(fmt_stream_maps), Logger.LOG_TYPE_CONSOLE);
		for(var i=0;i&amp;lt;fmt_list_s.length;i++){
			var vid_vars=fmt_stream_maps[i].split(&amp;quot;&amp;amp;&amp;quot;);
			var url=&amp;quot;&amp;quot;;
			var conn=&amp;quot;&amp;quot;;
			var stream=&amp;quot;&amp;quot;;
			var type=&amp;quot;&amp;quot;;
			var quality=&amp;quot;&amp;quot;;
			var stereo3d=0;
			var itag=-1;
			var resolution=&amp;quot;&amp;quot;;
			var sig=&amp;quot;&amp;quot;; // signature is *required* to fetch the vid.
			
			for(var j=0;j&amp;lt;vid_vars.length;j++){
				var key=vid_vars[j].substr(0,vid_vars[j].indexOf(&amp;quot;=&amp;quot;));
				var value=unescape(vid_vars[j].substr(vid_vars[j].indexOf(&amp;quot;=&amp;quot;)+1));
				switch(key){
					case &amp;quot;itag&amp;quot;: if(itag==-1) itag=value;break;
					case &amp;quot;url&amp;quot;: if(url==&amp;quot;&amp;quot; &amp;amp;&amp;amp; conn==&amp;quot;&amp;quot;) url=value;break;
					case &amp;quot;conn&amp;quot;: if(conn==&amp;quot;&amp;quot;) conn=value; break;
					case &amp;quot;stream&amp;quot;: if(stream==&amp;quot;&amp;quot;) stream=value; break;
					case &amp;quot;type&amp;quot;: if(type==&amp;quot;&amp;quot;) type=value;break;
					case &amp;quot;quality&amp;quot;: if(quality==&amp;quot;&amp;quot;) quality=value;break;
					case &amp;quot;stereo3d&amp;quot;: if(stereo3d==0) stereo3d=value;break;
					case &amp;quot;fallback_host&amp;quot;: break;
					case &amp;quot;sig&amp;quot;: if(sig==&amp;quot;&amp;quot;) sig=value;break;
					//case &amp;quot;signature&amp;quot;: if(signature=&amp;quot;&amp;quot;) signature=value;break;
					default: if(key.trim().length&amp;gt;0 &amp;amp;&amp;amp; i!=fmt_list_s.length-1){
						Logger.log(&amp;quot;New parameter found. To help make script better, please report this video URL at script forum/support.nnMore details:nnparameter name: &amp;quot;+key+&amp;quot;nparameter value: &amp;quot;+value+&amp;quot;nfmt_stream_maps[&amp;quot;+i+&amp;quot;]: &amp;quot;+fmt_stream_maps[i], Logger.LOG_TYPE_ALERT);
					};break;
				}
			}
			if(url.length!=0 &amp;amp;&amp;amp; sig.length!=0){
				url=url+&amp;quot;&amp;amp;signature=&amp;quot;+escape(sig); // &amp;quot;sig&amp;quot; should be sent as &amp;quot;signature&amp;quot; instead.
			}
			
			if(itag==fmt_list_s[i].split(&amp;quot;/&amp;quot;)[0]){
				resolution=fmt_list_s[i].split(&amp;quot;/&amp;quot;)[1];
			} else if(itag&amp;gt;0 &amp;amp;&amp;amp; !isNaN(parseInt(itag))) {
				Logger.log(&amp;quot;fmt_list and fmt_stream_maps mismatch. Please report this video URL at script forum/support.nnMore details:nnitag: &amp;quot;+itag, Logger.LOG_TYPE_ALERT);
			}
			if(url.length!=0)
				AnotherYouTubeDownloader.addDownloadLink(url, type, resolution, quality, stereo3d, itag);
			else if(conn.length!=0)
				AnotherYouTubeDownloader.addDownloadLink(conn+(stream.length!=0?&amp;quot;?&amp;quot;+stream:&amp;quot;&amp;quot;), type, resolution, quality, stereo3d, itag);
			else if(type.trim().length&amp;gt;0) {
				Logger.log(&amp;quot;Unsupported protocol found. To help make script better, please report this video URL at script forum/support.nnMore details:nntype: &amp;quot;+type+&amp;quot;nresolution: &amp;quot;+resolution+&amp;quot;nquality:&amp;quot;+quality+&amp;quot;nfmt_stream_maps[&amp;quot;+i+&amp;quot;]: &amp;quot;+fmt_stream_maps[i], Logger.LOG_TYPE_ALERT);
			}
		}
	},
	gmShowHideLQLinks: function(){
		var blShowLQLinks=GM_getValue(&amp;quot;LQDownload&amp;quot;,true);
		if(confirm(AnotherYouTubeDownloaderTranslation.getTranslation((blShowLQLinks ? 0 : 1))))
			blShowLQLinks=!blShowLQLinks;
		GM_setValue(&amp;quot;LQDownload&amp;quot;,blShowLQLinks);
		if(!blShowLQLinks &amp;amp;&amp;amp; AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;)){
			AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;).parentNode.removeChild(AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;));
		}
	},
	gmSortUnsortFormats: function (){
		var blFormatsSorted=GM_getValue(&amp;quot;SortFormats&amp;quot;, false);
		if(confirm(AnotherYouTubeDownloaderTranslation.getTranslation((blFormatsSorted ? 17 : 16))))
			blFormatsSorted=!blFormatsSorted;
		GM_setValue(&amp;quot;SortFormats&amp;quot;, blFormatsSorted);
	},
	formatsSorted: function (){
		if(AnotherYouTubeDownloader.isGreasemonkey())
			return GM_getValue(&amp;quot;SortFormats&amp;quot;, false);
		return false;
	},
	gmEnableDisableToolTips: function (){
		var blToolTips=GM_getValue(&amp;quot;ToolTips&amp;quot;, true);
		if(confirm(AnotherYouTubeDownloaderTranslation.getTranslation((blToolTips ? 13 : 14))))
			blToolTips=!blToolTips;
		GM_setValue(&amp;quot;ToolTips&amp;quot;, blToolTips);
	},
	toolTipsEnabled: function (){
		if(AnotherYouTubeDownloader.isGreasemonkey())
			return GM_getValue(&amp;quot;ToolTips&amp;quot;, true);
		return true;
	},
	putMobileCompatibleLinks: function(){
		var btnMLinksButton=AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;);
		if(GM_getValue(&amp;quot;LQDownload&amp;quot;,true)==false){
			if(AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;))
				AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;).parentNode.removeChild(AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;));
			return;
		}
		var divWatchActions=AnotherYouTubeDownloader.getWatchActionsEl();
		if(divWatchActions &amp;amp;&amp;amp; !btnMLinksButton){
			btnMLinksButton=document.createElement(&amp;quot;button&amp;quot;);
			btnMLinksButton.id=&amp;quot;watch-low-quality-download&amp;quot;;
			btnMLinksButton.className=&amp;quot;yt-uix-tooltip-reverse yt-uix-tooltip yt-uix-button yt-uix-button-text yt-uix-button-default b&amp;quot;;
			if(AnotherYouTubeDownloader.toolTipsEnabled())
				btnMLinksButton.title=AnotherYouTubeDownloaderTranslation.getTranslation(2);
			btnMLinksButton.addEventListener(&amp;quot;click&amp;quot;, AnotherYouTubeDownloader.fetchLowQualityLinks, false);
			divWatchActions.appendChild(btnMLinksButton);
		}
		if(btnMLinksButton){
			btnMLinksButton.innerHTML=&amp;quot;&amp;lt;span class=&amp;quot;yt-uix-button-content&amp;quot;&amp;gt;&amp;quot;+(AnotherYouTubeDownloader.isCosmicPanda()?AnotherYouTubeDownloaderTranslation.getTranslation(3):AnotherYouTubeDownloaderTranslation.getTranslation(4))+&amp;quot;&amp;lt;/span&amp;gt;&amp;quot;;
			if(AnotherYouTubeDownloader.isCosmicPanda() &amp;amp;&amp;amp; AnotherYouTubeDownloader.$(&amp;quot;watch-like&amp;quot;) &amp;amp;&amp;amp; AnotherYouTubeDownloader.$(&amp;quot;watch-like&amp;quot;).getElementsByClassName(&amp;quot;yt-uix-button-content&amp;quot;).length&amp;gt;0){
				AnotherYouTubeDownloader.$(&amp;quot;watch-like&amp;quot;).getElementsByClassName(&amp;quot;yt-uix-button-content&amp;quot;)[0].innerHTML=&amp;quot;&amp;quot;;
			}
		}
	},
	fetchLowQualityLinks: function(){
		AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;).disabled=true;
		AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;).innerHTML=&amp;quot;&amp;lt;span class=&amp;quot;yt-uix-button-content&amp;quot;&amp;gt;&amp;quot;+(AnotherYouTubeDownloader.isCosmicPanda()?&amp;quot;...&amp;quot;:AnotherYouTubeDownloaderTranslation.getTranslation(5))+&amp;quot;&amp;lt;/span&amp;gt;&amp;quot;;
		GM_xmlhttpRequest({
			method : &amp;quot;GET&amp;quot;,
			url: &amp;quot;http://m.youtube.com/watch?ajax=1&amp;amp;layout=mobile&amp;amp;tsp=1&amp;amp;v=&amp;quot;+AnotherYouTubeDownloader.getVidId(),
			headers: {
				&amp;quot;User-Agent&amp;quot;:&amp;quot;iPhone&amp;quot;
			},
			onload: function (res){
				try{
					AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;).parentNode.removeChild(AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;));
					var strResponse=res.responseText;
					var strLinksPart=strResponse.substr(0,strResponse.indexOf(&amp;quot;related_videos&amp;quot;));
					var strLinksString=strLinksPart.split(&amp;quot;stream_url&amp;quot;: &amp;quot;);
					for(var i=1;i&amp;lt;strLinksString.length;i++){
						var strLQLinkURL=strLinksString[i].substr(0,strLinksString[i].indexOf(&amp;quot;&amp;quot;&amp;quot;,1)+1);
						if(strLQLinkURL.length&amp;gt;2)
							AnotherYouTubeDownloader.addLink(eval(strLQLinkURL));
					}
				}catch(e){
				}finally{
					AnotherYouTubeDownloader.toggleDownloadMenu(true);
				}
			},
			onerror: function (res){
				AnotherYouTubeDownloader.$(&amp;quot;watch-low-quality-download&amp;quot;).disabled=false;
				AnotherYouTubeDownloader.putMobileCompatibleLinks();
				alert(AnotherYouTubeDownloaderTranslation.getTranslation(6));
			}
		});
		return false;
	},
	addLink: function(strLink){
		var itag=parseInt(strLink.substr(strLink.indexOf(&amp;quot;itag=&amp;quot;)+5));
		var itags={
			13 : { type: &amp;quot;video/3gpp&amp;quot;, resolution:&amp;quot;176x144&amp;quot;, quality:&amp;quot;small&amp;quot; },
			17 : { type: &amp;quot;video/3gpp&amp;quot;, resolution:&amp;quot;176x144&amp;quot;, quality:&amp;quot;medium&amp;quot; },
			18 : { type: &amp;quot;video/mp4&amp;quot;, resolution:&amp;quot;640x360&amp;quot;, quality:&amp;quot;medium&amp;quot; },
			36 : { type: &amp;quot;video/3gpp&amp;quot;, resolution:&amp;quot;320x240&amp;quot;, quality:&amp;quot;high&amp;quot; }
		};
		if(itags[itag])
			AnotherYouTubeDownloader.addDownloadLink(strLink, itags[itag].type, itags[itag].resolution, itags[itag].quality, 0, itag);
		else
			AnotherYouTubeDownloader.addDownloadLink(strLink, AnotherYouTubeDownloaderTranslation.getTranslation(7)+&amp;quot; (&amp;quot;+itag+&amp;quot;)&amp;quot;, AnotherYouTubeDownloaderTranslation.getTranslation(7)+&amp;quot; (&amp;quot;+itag+&amp;quot;)&amp;quot;, AnotherYouTubeDownloaderTranslation.getTranslation(7)+&amp;quot; (&amp;quot;+itag+&amp;quot;)&amp;quot;, 0, itag);
	},
	getVidId: function(){
		var strVidId;
		if(AnotherYouTubeDownloader.isWatchPage()){
			strVidId=location.search.substring(location.search.indexOf(&amp;quot;v=&amp;quot;)+2);
		} else if (AnotherYouTubeDownloader.isUserChannelPage()){
			var divPlayNavCurrentTitle=AnotherYouTubeDownloader.$(&amp;quot;playnav-curvideo-title&amp;quot;);
			if(!divPlayNavCurrentTitle)
				return &amp;quot;&amp;quot;;
			var aVidLink=divPlayNavCurrentTitle.getElementsByTagName(&amp;quot;a&amp;quot;);
			if(aVidLink.length==0)
				return &amp;quot;&amp;quot;;
			strVidId=aVidLink[0].search.substring(aVidLink[0].search.indexOf(&amp;quot;v=&amp;quot;)+2);
		}
		if(strVidId.indexOf(&amp;quot;&amp;amp;&amp;quot;)!=-1)
			strVidId=strVidId.substring(0,strVidId.indexOf(&amp;quot;&amp;amp;&amp;quot;));
		if(strVidId.indexOf(&amp;quot;#&amp;quot;)!=-1)
			strVidId=strVidId.substring(0,strVidId.indexOf(&amp;quot;#&amp;quot;));
		return strVidId;
	},
	getWatchActionsEl: function(){
		if(AnotherYouTubeDownloader.isWatchPage()){
			var divWatchActions=AnotherYouTubeDownloader.$(&amp;quot;watch-actions&amp;quot;);
			if(!divWatchActions){
				divWatchActions=AnotherYouTubeDownloader.$(&amp;quot;watch-content&amp;quot;);
			}
			if(!divWatchActions){
				divWatchActions=AnotherYouTubeDownloader.$(&amp;quot;watch7-action-buttons&amp;quot;);
			}
			if(!divWatchActions){
				divWatchActions=AnotherYouTubeDownloader.$(&amp;quot;vo&amp;quot;);
			}
			if(divWatchActions)
				return divWatchActions;
		} else if (AnotherYouTubeDownloader.isUserChannelPage()){
			var divPlayNavInfoLine=AnotherYouTubeDownloader.$(&amp;quot;playnav-curvideo-info-line&amp;quot;);
			if(divPlayNavInfoLine)
				return divPlayNavInfoLine;
		}
		return null;
	},
	isCosmicPanda: function(){
		return AnotherYouTubeDownloader.$(&amp;quot;watch-content&amp;quot;)!=null;
	},
	toggleDownloadMenu: function(blForce){
		var divDLContainer=AnotherYouTubeDownloader.$(&amp;quot;watch-download-area-container&amp;quot;);
		if(blForce==true || divDLContainer.className==&amp;quot;hid&amp;quot;){
			divDLContainer.className=&amp;quot;&amp;quot;;
		} else if(blForce==false || divDLContainer.className==&amp;quot;&amp;quot;){
			divDLContainer.className=&amp;quot;hid&amp;quot;;
		}
	},
	getDownloadMenu: function(){
		var tblDownloadMenu=AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;);
		if(!tblDownloadMenu){
			var divWatchActions=AnotherYouTubeDownloader.getWatchActionsEl();
			if(divWatchActions){ // &amp;amp;&amp;amp; divWatchActions.nextSibling){ // v1.2.4
				var divDownloadContainer=document.createElement(&amp;quot;div&amp;quot;);
				divDownloadContainer.id=&amp;quot;watch-download-area-container&amp;quot;;
				divDownloadContainer.className=(navigator.userAgent.indexOf(&amp;quot;Opera Mini&amp;quot;)==-1)?&amp;quot;hid&amp;quot;:&amp;quot;&amp;quot;;
				divDownloadContainer.innerHTML=&amp;quot;&amp;quot;+
					&amp;quot;&amp;lt;div class=&amp;quot;yt-rounded&amp;quot; id=&amp;quot;watch-download-area&amp;quot;&amp;gt;&amp;quot;+
						&amp;quot;&amp;lt;div class=&amp;quot;watch-actions-panel&amp;quot; id=&amp;quot;watch-download-display&amp;quot;&amp;gt;&amp;quot;+
							&amp;quot;&amp;lt;table id=&amp;quot;table-download-menu&amp;quot; cellspacing=0 cellpadding=0&amp;gt;&amp;quot;+
								&amp;quot;&amp;lt;tr&amp;gt;&amp;quot;+
									&amp;quot;&amp;lt;td width=40&amp;gt;&amp;lt;/td&amp;gt;&amp;quot;+
								&amp;quot;&amp;lt;/tr&amp;gt;&amp;quot;+
							&amp;quot;&amp;lt;/table&amp;gt;&amp;quot;+
						&amp;quot;&amp;lt;/div&amp;gt;&amp;quot;+
						&amp;quot;&amp;lt;div class=&amp;quot;close&amp;quot;&amp;gt;&amp;quot;+
							&amp;quot;&amp;lt;img class=&amp;quot;close-button&amp;quot; id=&amp;quot;watch-download-close&amp;quot; src=&amp;quot;http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif&amp;quot;&amp;gt;&amp;quot;+
						&amp;quot;&amp;lt;/div&amp;gt;&amp;quot;+
					&amp;quot;&amp;lt;/div&amp;gt;&amp;quot;+
				&amp;quot;&amp;quot;;
				if(divWatchActions.nextSibling)
					divWatchActions.parentNode.insertBefore(divDownloadContainer, divWatchActions.nextSibling);
				else
					divWatchActions.parentNode.appendChild(divDownloadContainer);
					
				AnotherYouTubeDownloader.addCSS(&amp;quot;&amp;quot;+
					&amp;quot;#watch-download-area-container{margin-bottom:10px;height:auto}&amp;quot;+
					&amp;quot;#watch-download-area{border:1px solid #CCCCCC;padding:5px;position:relative}&amp;quot;+
					&amp;quot;#watch-download-area .close{cursor:pointer;position:absolute;right:5px;top:5px}&amp;quot;+
					&amp;quot;#table-download-menu{width:100%;}&amp;quot;+
					&amp;quot;#table-download-menu td{border:1px solid #E0E0E0;padding:3px 9px}&amp;quot;+
					&amp;quot;#table-download-menu td.bold{font-weight:bold}&amp;quot;+
					&amp;quot;#watch-download{margin-left:10px}&amp;quot;+
					&amp;quot;#watch-low-quality-download{margin-left:4px}&amp;quot;+
				&amp;quot;&amp;quot;);
			
				var btnDownloadButton=document.createElement(&amp;quot;button&amp;quot;);
				btnDownloadButton.id=&amp;quot;watch-download&amp;quot;;
				btnDownloadButton.className=&amp;quot;yt-uix-tooltip-reverse yt-uix-tooltip yt-uix-button yt-uix-button-text yt-uix-button-default b&amp;quot;;
				if(AnotherYouTubeDownloader.toolTipsEnabled())
					btnDownloadButton.title=AnotherYouTubeDownloaderTranslation.getTranslation(8);
				btnDownloadButton.innerHTML=&amp;quot;&amp;lt;span class=&amp;quot;yt-uix-button-content&amp;quot;&amp;gt;&amp;quot;+AnotherYouTubeDownloaderTranslation.getTranslation(9)+&amp;quot;&amp;lt;/span&amp;gt;&amp;quot;;
				if(btnDownloadButton.addEventListener)
					btnDownloadButton.addEventListener(&amp;quot;click&amp;quot;, AnotherYouTubeDownloader.toggleDownloadMenu, false);
				else if(btnDownloadButton.attachEvent)
					btnDownloadButton.attachEvent(&amp;quot;onclick&amp;quot;, AnotherYouTubeDownloader.toggleDownloadMenu);
				else
					btnDownloadButton.onclick=AnotherYouTubeDownloader.toggleDownloadMenu;
				divWatchActions.appendChild(btnDownloadButton);
				
				if(AnotherYouTubeDownloader.$(&amp;quot;watch-download-close&amp;quot;) &amp;amp;&amp;amp; AnotherYouTubeDownloader.$(&amp;quot;watch-download-close&amp;quot;).addEventListener){
					AnotherYouTubeDownloader.$(&amp;quot;watch-download-close&amp;quot;).addEventListener(&amp;quot;click&amp;quot;, AnotherYouTubeDownloader.toggleDownloadMenu, false);
				} else if(AnotherYouTubeDownloader.$(&amp;quot;watch-download-close&amp;quot;) &amp;amp;&amp;amp; AnotherYouTubeDownloader.$(&amp;quot;watch-download-close&amp;quot;).attachEvent){
					AnotherYouTubeDownloader.$(&amp;quot;watch-download-close&amp;quot;).attachEvent(&amp;quot;onclick&amp;quot;, AnotherYouTubeDownloader.toggleDownloadMenu);
				} else {
					AnotherYouTubeDownloader.$(&amp;quot;watch-download-close&amp;quot;).onclick=AnotherYouTubeDownloader.toggleDownloadMenu;
				}
					
				tblDownloadMenu=AnotherYouTubeDownloader.$(&amp;quot;table-download-menu&amp;quot;);
			}
		}
		return tblDownloadMenu;
	},
	getType: function(type){
		if(type.indexOf(&amp;quot;;&amp;quot;)!=-1)
			type=type.substring(0,type.indexOf(&amp;quot;;&amp;quot;));
		if(type.indexOf(&amp;quot;/&amp;quot;)!=-1)
			type=type.substring(type.indexOf(&amp;quot;/&amp;quot;)+1);
		switch(type){
			case &amp;quot;webm&amp;quot;:
				type=&amp;quot;WebM&amp;quot;;
				break;
			case &amp;quot;mp4&amp;quot;:
				type=&amp;quot;MP4&amp;quot;;
				break;
			case &amp;quot;x-flv&amp;quot;:
				type=&amp;quot;FLV&amp;quot;;
				break;
			case &amp;quot;3gpp&amp;quot;:
				type=&amp;quot;3GP&amp;quot;;
				break;
			case &amp;quot;xml&amp;quot;:
				type=&amp;quot;XML&amp;quot;;
				break;
		}
		return type;
	},
	getHeight: function(resolution){
		if(resolution.indexOf(&amp;quot;x&amp;quot;)!=-1)
			resolution=resolution.substring(resolution.indexOf(&amp;quot;x&amp;quot;)+1)+&amp;quot;p&amp;quot;;
		return resolution;
	},
	maintainTableCells: function(tblTable){
		var intCols=0;
		var i=0;
		for(i=0;i&amp;lt;tblTable.rows.length;i++){
			if(intCols&amp;lt;tblTable.rows[i].cells.length)
				intCols=tblTable.rows[i].cells.length;
		}
		for(i=0;i&amp;lt;tblTable.rows.length;i++){
			while(tblTable.rows[i].cells.length&amp;lt;intCols){
				tblTable.rows[i].insertCell(tblTable.rows[i].cells.length).innerHTML=&amp;quot;&amp;quot;;
			}
		}
	},
	addDownloadLink: function(url, type, resolution, quality, stereo3d, itag){
		var tblMenu=AnotherYouTubeDownloader.getDownloadMenu();
		if(!tblMenu){
			return;
		}
		var strHType=AnotherYouTubeDownloader.getType(type);
		var strHHeight=AnotherYouTubeDownloader.getHeight(resolution);
		var rowHeights=tblMenu.rows[0];
		var i;
		
		var intHeightIndex=-1; 
		for(i=1;i&amp;lt;rowHeights.cells.length;i++){
			if(rowHeights.cells[i].innerHTML==strHHeight)
				intHeightIndex=i;
		}
		if(intHeightIndex==-1){
			intHeightIndex=rowHeights.cells.length;
			rowHeights.insertCell(intHeightIndex).innerHTML=strHHeight;
			rowHeights.cells[intHeightIndex].className=&amp;quot;bold&amp;quot;;
		}
		
		var intTypeIndex=-1; 
		for(i=1;i&amp;lt;tblMenu.rows.length;i++){
			if(tblMenu.rows[i].cells[0] &amp;amp;&amp;amp; tblMenu.rows[i].cells[0].innerHTML==strHType)
				intTypeIndex=i;
		}
		if(intTypeIndex==-1 &amp;amp;&amp;amp; AnotherYouTubeDownloader.formatsSorted()){
			for(i=1;i&amp;lt;tblMenu.rows.length;i++){
				if(tblMenu.rows[i].cells[0] &amp;amp;&amp;amp; tblMenu.rows[i].cells[0].innerHTML.localeCompare(strHType) &amp;gt; 0){
					intTypeIndex=i;
					var curRow=tblMenu.insertRow(intTypeIndex);
					curRow.insertCell(0).innerHTML=strHType;
					curRow.cells[0].className=&amp;quot;bold&amp;quot;;
					break;
				}
			}
		}
		if(intTypeIndex==-1){
			intTypeIndex=tblMenu.rows.length;
			var curRow=tblMenu.insertRow(intTypeIndex);
			curRow.insertCell(0).innerHTML=strHType;
			curRow.cells[0].className=&amp;quot;bold&amp;quot;;
		}
		AnotherYouTubeDownloader.maintainTableCells(tblMenu);
		var strNewLink=url;
		if(AnotherYouTubeDownloader.getVideoTitle()!=&amp;quot;&amp;quot;)
			strNewLink=strNewLink.substring(0,strNewLink.indexOf(&amp;quot;?&amp;quot;)+1)+&amp;quot;title=&amp;quot;+escape(AnotherYouTubeDownloader.getVideoTitle())+&amp;quot;&amp;amp;&amp;quot;+strNewLink.substring(strNewLink.indexOf(&amp;quot;?&amp;quot;)+1)
		var tdCell=tblMenu.rows[intTypeIndex].cells[intHeightIndex];
		tdCell.innerHTML=&amp;quot;&amp;quot;;
		
		var aFirstLink=document.createElement(&amp;quot;a&amp;quot;);
		aFirstLink.setAttribute(&amp;quot;href&amp;quot;, strNewLink);
		aFirstLink.setAttribute(&amp;quot;class&amp;quot;, &amp;quot;yt-uix-tooltip&amp;quot;);
		if(AnotherYouTubeDownloader.toolTipsEnabled())
			aFirstLink.setAttribute(&amp;quot;title&amp;quot;, &amp;quot;&amp;lt;b&amp;gt;Resolution: &amp;lt;/b&amp;gt;&amp;quot;+resolution+&amp;quot;&amp;lt;br/&amp;gt;n&amp;lt;b&amp;gt;MIME Type: &amp;lt;/b&amp;gt;&amp;quot;+type.replace(/&amp;quot;/g,&amp;quot;&amp;#39;&amp;quot;)+&amp;quot;&amp;lt;br/&amp;gt;n&amp;lt;b&amp;gt;Quality: &amp;lt;/b&amp;gt;&amp;quot;+quality+(stereo3d==1?&amp;quot;&amp;lt;br/&amp;gt;n&amp;lt;b&amp;gt;3D: &amp;lt;/b&amp;gt;stereo3d audio&amp;quot;:&amp;quot;&amp;quot;)+&amp;quot;&amp;lt;br/&amp;gt;n&amp;lt;b&amp;gt;YT iTag: &amp;lt;/b&amp;gt;&amp;quot;+itag);
		aFirstLink.innerHTML=(url.indexOf(&amp;quot;rtmpe://&amp;quot;)==0?AnotherYouTubeDownloaderTranslation.getTranslation(10):AnotherYouTubeDownloaderTranslation.getTranslation(9));
		
		tdCell.appendChild(aFirstLink);
		
		if(url.indexOf(&amp;quot;rtmpe://&amp;quot;)==0){
			var aSecondLink=document.createElement(&amp;quot;a&amp;quot;);
			aSecondLink.setAttribute(&amp;quot;href&amp;quot;, location.protocol+strNewLink.substr(6));
			aSecondLink.setAttribute(&amp;quot;class&amp;quot;, &amp;quot;yt-uix-tooltip&amp;quot;);
			if(AnotherYouTubeDownloader.toolTipsEnabled())
				aSecondLink.setAttribute(&amp;quot;title&amp;quot;, aFirstLink.getAttribute(&amp;quot;title&amp;quot;));
			aSecondLink.innerHTML=AnotherYouTubeDownloaderTranslation.getTranslation(9);
			
			tdCell.appendChild(document.createTextNode(&amp;quot;/&amp;quot;));
			tdCell.appendChild(aSecondLink);
		}
		
		if(AnotherYouTubeDownloader.blHelperInstalled){
			var aFileSizeLink=document.createElement(&amp;quot;a&amp;quot;);
			aFileSizeLink.href=&amp;quot;javascript:void(0);&amp;quot;;
			aFileSizeLink.setAttribute(&amp;quot;class&amp;quot;, &amp;quot;yt-uix-tooltip&amp;quot;);
			aFileSizeLink.setAttribute(&amp;quot;url&amp;quot;,(url.indexOf(&amp;quot;rtmpe://&amp;quot;)==0?&amp;quot;http:&amp;quot;+url.substr(6):url));
			aFileSizeLink.addEventListener(&amp;quot;click&amp;quot;,AnotherYouTubeDownloader.fetchFileSize,false);
			aFileSizeLink.innerHTML=&amp;quot;?&amp;quot;;
			if(AnotherYouTubeDownloader.toolTipsEnabled())
				aFileSizeLink.title=&amp;quot;Find file size of this download link&amp;quot;;
			
			tdCell.appendChild(document.createTextNode(&amp;quot; (&amp;quot;));
			tdCell.appendChild(aFileSizeLink);
			tdCell.appendChild(document.createTextNode(&amp;quot;)&amp;quot;));
			
		}
	},
	fetchFileSize: function(){
		var me=this;
		var url=me.getAttribute(&amp;quot;url&amp;quot;);
		me.innerHTML=&amp;quot;...&amp;quot;;
		if(AnotherYouTubeDownloader.toolTipsEnabled())
			me.title=&amp;quot;Loading...&amp;quot;;
		me.removeEventListener(&amp;quot;click&amp;quot;,AnotherYouTubeDownloader.fetchFileSize,false);
		GM_xmlhttpRequest({
			method : &amp;quot;GET&amp;quot;,
			url: &amp;quot;http://127.0.0.1:9688/&amp;quot;+url,
			headers: {
				&amp;quot;Referer&amp;quot;: location.href // If cookies are cleared after page is loaded, this will lead to 403 Forbidden. Better disable cookies.
			},
			onload: function (res){
				//unsafeWindow.testRes = res;
				/*for(var resAttr in res){
					Logger.log(resAttr + &amp;quot;: &amp;quot; + res[resAttr], Logger.LOG_TYPE_CONSOLE);	
				}*/
				var lngFileSize=parseInt(res.responseText);
				var strFileSize=&amp;quot;&amp;quot;;
				if(lngFileSize==-2){
					me.innerHTML=&amp;quot;!2&amp;quot;;
					if(AnotherYouTubeDownloader.toolTipsEnabled())
						me.title=&amp;quot;Helper application was unable to connect. Check internet settings.&amp;quot;;
					me.addEventListener(&amp;quot;click&amp;quot;,AnotherYouTubeDownloader.fetchFileSize,false);
					return;
				}
				if(lngFileSize==-3){
					me.innerHTML=&amp;quot;!3&amp;quot;;
					if(AnotherYouTubeDownloader.toolTipsEnabled())
						me.title=&amp;quot;Helper application does not support this protocol.&amp;quot;;
					me.addEventListener(&amp;quot;click&amp;quot;,AnotherYouTubeDownloader.fetchFileSize,false);
					return;
				}
				if(lngFileSize==-4){
					me.innerHTML=&amp;quot;!4&amp;quot;;
					if(AnotherYouTubeDownloader.toolTipsEnabled())
						me.title=&amp;quot;Helper application denied checking file size for this url.&amp;quot;;
					me.addEventListener(&amp;quot;click&amp;quot;,AnotherYouTubeDownloader.fetchFileSize,false);
					return;
				}
				if(lngFileSize==-1){
					strFileSize=&amp;quot;Unknown&amp;quot;;
				} else if(lngFileSize&amp;lt;9999){
					strFileSize=lngFileSize+&amp;quot;bytes&amp;quot;;
				} else if(lngFileSize&amp;lt;9999*1024){
					strFileSize=(Math.round(lngFileSize/10.24)/100)+&amp;quot;KB&amp;quot;;
				} else if(lngFileSize&amp;lt;9999*1024*1024){
					strFileSize=(Math.round(lngFileSize/(10.24*1024))/100)+&amp;quot;MB&amp;quot;;
				} else {
					strFileSize=(Math.round(lngFileSize/(10.24*1024*1024))/100)+&amp;quot;GB&amp;quot;;
				}
				me.removeAttribute(&amp;quot;href&amp;quot;);
				me.style.textDecoration=&amp;quot;none&amp;quot;;
				me.style.color=&amp;quot;auto&amp;quot;;
				me.innerHTML=strFileSize;
				if(AnotherYouTubeDownloader.toolTipsEnabled())
					me.title=lngFileSize+&amp;quot; bytes&amp;quot;;
			},
			onerror: function (res){
				me.innerHTML=&amp;quot;!1&amp;quot;;
				if(AnotherYouTubeDownloader.toolTipsEnabled())
					me.title=&amp;quot;Unable to fetch file size. Make sure Helper application is running and browser is online.&amp;quot;;
				me.addEventListener(&amp;quot;click&amp;quot;,AnotherYouTubeDownloader.fetchFileSize,false);
			}
		});
	},
	getVideoTitle: function(){
		var spanEowTitle;
		var strReturnValue=&amp;quot;&amp;quot;;
		if(AnotherYouTubeDownloader.isWatchPage()){
			spanEowTitle=AnotherYouTubeDownloader.$(&amp;quot;eow-title&amp;quot;);
			if(spanEowTitle &amp;amp;&amp;amp; spanEowTitle.title) {
				strReturnValue=spanEowTitle.title;
			} else {
				spanEowTitle=AnotherYouTubeDownloader.$(&amp;quot;watch-headline-title&amp;quot;);
				if(spanEowTitle &amp;amp;&amp;amp; spanEowTitle.textContent)
					strReturnValue=spanEowTitle.textContent.trim();
			}
		} else if (AnotherYouTubeDownloader.isUserChannelPage()){
			spanEowTitle=AnotherYouTubeDownloader.$(&amp;quot;playnav-curvideo-title&amp;quot;);
			if(spanEowTitle &amp;amp;&amp;amp; spanEowTitle.textContent)
				strReturnValue=spanEowTitle.textContent.trim();
		}
		return strReturnValue.replace(/(&amp;quot;|*|:|&amp;lt;|&amp;gt;|?|||\|/)/g,&amp;quot;_&amp;quot;);
	},
	domChanged: function(){
		setTimeout(function (){
			AnotherYouTubeDownloader.fetchDownloadLinks();
		},0);
	},
	addCSS: function(css){
		if (typeof GM_addStyle != &amp;quot;undefined&amp;quot;) {
			GM_addStyle(css);
		} else if (typeof PRO_addStyle != &amp;quot;undefined&amp;quot;) {
			PRO_addStyle(css);
		} else if (typeof addStyle != &amp;quot;undefined&amp;quot;) {
			addStyle(css);
		} else {
			var heads = AnotherYouTubeDownloader.$$(&amp;quot;head&amp;quot;);
			if (heads.length &amp;gt; 0) {
				var node = document.createElement(&amp;quot;style&amp;quot;);
				node.type = &amp;quot;text/css&amp;quot;;
				try{
					node.appendChild(document.createTextNode(css));
				}catch(e){}
				heads[0].appendChild(node); 
			}
		}
	},
	runScript: function(){
		if(!document.body || !document.body.innerHTML)
			return;
		if(AnotherYouTubeDownloader.blHelperInstalled &amp;amp;&amp;amp; !AnotherYouTubeDownloader.isGreasemonkey())
			AnotherYouTubeDownloader.blHelperInstalled=false;
		if(AnotherYouTubeDownloader.isGreasemonkey()){
			GM_registerMenuCommand(&amp;quot;Another YouTube Downloader -&amp;gt; &amp;quot;+AnotherYouTubeDownloaderTranslation.getTranslation(11),AnotherYouTubeDownloader.gmShowHideLQLinks);
			GM_registerMenuCommand(&amp;quot;Another YouTube Downloader -&amp;gt; &amp;quot;+AnotherYouTubeDownloaderTranslation.getTranslation(12),AnotherYouTubeDownloader.gmEnableDisableToolTips);
			GM_registerMenuCommand(&amp;quot;Another YouTube Downloader -&amp;gt; &amp;quot;+AnotherYouTubeDownloaderTranslation.getTranslation(15),AnotherYouTubeDownloader.gmSortUnsortFormats);
		}
		if(AnotherYouTubeDownloader.isWatchPage()){
			AnotherYouTubeDownloader.fetchDownloadLinks();
		} else if (AnotherYouTubeDownloader.isUserChannelPage()){
			if(document.body.addEventListener)
				document.body.addEventListener(&amp;quot;DOMNodeInserted&amp;quot;,AnotherYouTubeDownloader.domChanged,false);
		}
	}
};
try{
	AnotherYouTubeDownloader.runScript();
}catch(e){
	window.alert(&amp;quot;Another YouTube Downloader Error: &amp;quot;+e);
}</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=153</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ffmpeg 与 mencoder 命令行压片运用备忘</title>
		<link>https://www.softwareace.cn/?p=134</link>
		<comments>https://www.softwareace.cn/?p=134#comments</comments>
		<pubDate>Sat, 26 Jan 2013 02:27:04 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[视频音频转码]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=134</guid>
		<description><![CDATA[先从Mencoder这个开始，将所有格式转AVI， RMVB转AVI mencoder 1.rmvb -oac [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	先从Mencoder这个开始，将所有格式转AVI，</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	RMVB转AVI<br />
	mencoder 1.rmvb -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o rmvb.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	MPEG转AVI</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder mp4.mpeg -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o mp4.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	MOV转AVI</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder qtime.mov -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o qtime.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	WMV转AVI 包括WMV7到WMV9，只实验到WMV9</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder m7.wmv -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o m7.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	RV转AVI</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder 1.rv -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o rv.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	等等&hellip;&hellip;格式，参数不变，改文件名就好了。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	压DVD：</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder.exe dvd://1 -dvd-device i:/ -ovc lavc -ffourcc DX50 -lavcopts vcodec=mpeg4:vhq:vbitrate=500 -oac mp3lame -lameopts abr:br=128:vol=2 -o &quot;c:1.avi&quot;<br />
	mencoder.exe dvd://2 -dvd-device i:/ -slang zh -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=238 -o &quot;d: 2.avi&quot;<br />
	mencoder.exe dvd://1 -dvd-device i:/ -slang zh -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=238 -of avi -srate 22050 -o &quot;c: 1.avi&quot;<br />
	mencoder.exe dvd://2 -dvd-device i:/ -slang zh -oac copy -ovc xvid -xvidencopts bitrate=238 -o &quot;d: 02.avi&quot;&nbsp;<br />
	mencoder.exe dvd://1 -chapter 1-2 -dvd-device i:/&nbsp; -oac copy -ovc xvid -xvidencopts bitrate=238 -o &quot;d: 01.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder.exe -oac copy -ovc copy -idx -o &quot;D:movmovimov3 01.avi.avi&quot;&nbsp; &quot;D:movmovimov3 01.avi&quot; &quot;D:movmovimov3 02.avi&quot;<br />
	mencoder.exe &quot;E: 802003.mp4&quot; -sws 9 -ss 00:00 -endpos 287 -af volnorm -srate 22050 -vf scale=720:-3,harddup -oac faac -faacopts br=32:mpeg=4:object=2 -ovc xvid -xvidencopts fixed_quant=11:threads=2:max_bframes=0 -o &quot;E: 802003.mp4.avi&quot;<br />
	call batch3gp.bat &quot;E: 802003.mp4.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder.exe &quot;E: 802003.mp4&quot; -sws 9 -ss 00:00 -endpos 287 -af volnorm -srate 22050 -vf-add yadif,scale=720:-3,harddup -oac faac -faacopts br=32:mpeg=4:object=2 -ovc xvid -xvidencopts bitrate=1440:threads=2:max_bframes=0 -o &quot;E: 802003.mp4.avi&quot;<br />
	call batch3gp.bat &quot;E: 802003.mp4.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	divx5:<br />
	mencoder.exe&nbsp; -srate 32000 -stereo 0 -oac mp3lame -lameopts mode=2:cbr:br=128:vol=1.1&nbsp; -ovc lavc -ffourcc DX50 -lavcopts vcodec=mpeg4:vbitrate=256&nbsp; -sws 9 -of avi -vf scale=320:-3&nbsp; &quot;D:保健功.mp4&quot; -o &quot;D:保健功.mp4.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder.exe -ovc copy -nosound -of rawvideo&nbsp; &quot;D:20101.avi&quot; -o &quot;D:20101.avi.avi&quot;<br />
	mencoder.exe -ovc frameno -oac copy -of rawaudio &quot;D:20101.avi&quot; -o &quot;D:20101.avi.mp3&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	接下来是FFMPEG上场。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg.exe&nbsp; -i&nbsp; &quot;c: 03[1].flv&quot; -f mp4 -vcodec mpeg4 -acodec libfaac -ac 2 -ab 64K -ar 48000 -y&nbsp; &quot;c: 03[1].mp4&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	AVI转FLV</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i test.avi -ab 56 -ar 22050 -b 500 -r 15 -s 320&#215;240 test.flv&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	抓图JPG。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i 2.wmv -y -f image2 -ss 8 -t 0.001 -s 350&#215;240 test.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	<br />
	以上的参数通用，只要在输入的okm9.wmv换成你自己相应的格式就好，裁图方面：</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i ok3gp.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 3gp.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okmov.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 mov.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okmpeg.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 mpeg.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okmp1.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 mp1.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okmp2.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 mp2.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okrm.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 rm.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okrmvb.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 rmvb.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okrv.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 rv.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okmp4.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 mp4.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okavi.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 avi.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okm7.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 m7.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okm8.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 m8.jpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i okm9.flv -y -f image2 -ss 8 -t 0.001 -s 320&#215;240 m9.jpg<br />
	========================================================================</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg&amp;mencoder使用说明 收藏&nbsp;<br />
	ffmpeg.exe -i F:闪客之家闪客之歌.mp3 -ab 56 -ar 22050 -b 500 -r 15 -s 320&#215;240 f:11.flv<br />
	ffmpeg -i F: 1.wmv -ab 56 -ar 22050 -b 500 -r 15 -s 320&#215;240 f:test.flv<br />
	使用-ss参数 作用（time_off set the start time offset），可以从指定时间点开始转换任务。如:<br />
	转换文件格式的同时抓缩微图：<br />
	ffmpeg -i &quot;test.avi&quot; -y -f image2 -ss 8 -t 0.001 -s 350&#215;240 &#39;test.jpg&#39;<br />
	对已有flv抓图：<br />
	ffmpeg -i &quot;test.flv&quot; -y -f image2 -ss 8 -t 0.001 -s 350&#215;240 &#39;test.jpg&#39;<br />
	-ss后跟的时间单位为秒<br />
	Ffmpeg转换命令<br />
	ffmpeg -y -i test.mpeg -bitexact -vcodec h263 -b 128 -r 15 -s 176&#215;144 -acodec aac -ac 2 -ar 22500&nbsp;<br />
	-ab 24 -f 3gp test.3gp<br />
	或者<br />
	ffmpeg -y -i test.mpeg -ac 1 -acodec amr_nb -ar 8000 -s 176&#215;144 -b 128 -r 15 test.3gp</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	<br />
	ffmpeg参数设定解说&nbsp;<br />
	-bitexact 使用标准比特率&nbsp;<br />
	-vcodec xvid 使用xvid压缩&nbsp;<br />
	-s 320&#215;240 指定分辨率&nbsp;<br />
	-r 29.97 桢速率（可以改，确认非标准桢率会导致音画不同步，所以只能设定为15或者29.97）&nbsp;<br />
	画面部分，选其一&nbsp;<br />
	-b &lt;比特率&gt; 指定压缩比特率，似乎ffmpeg是自动VBR的，指定了就大概是平均比特率，比如768，1500这样的<br />
	就是原来默认项目中有的&nbsp;<br />
	-qscale &lt;数值&gt; 以&lt;数值&gt;质量为基础的VBR，取值0.01-255，约小质量越好&nbsp;<br />
	-qmin &lt;数值&gt; 设定最小质量，与-qmax（设定最大质量）共用，比如-qmin 10 -qmax 31&nbsp;<br />
	-sameq 使用和源同样的质量&nbsp;<br />
	声音部分&nbsp;<br />
	-acodec aac 设定声音编码&nbsp;<br />
	-ac &lt;数值&gt; 设定声道数，1就是单声道，2就是立体声，转换单声道的TVrip可以用1（节省一半容量），高品质<br />
	的DVDrip就可以用2&nbsp;<br />
	-ar &lt;采样率&gt; 设定声音采样率，PSP只认24000&nbsp;<br />
	-ab &lt;比特率&gt; 设定声音比特率，前面-ac设为立体声时要以一半比特率来设置，比如192kbps的就设成96，转换<br />
	君默认比特率都较小，要听到较高品质声音的话建议设到160kbps（80）以上&nbsp;<br />
	-vol &lt;百分比&gt; 设定音量，某些DVDrip的AC3轨音量极小，转换时可以用这个提高音量，比如200就是原来的2倍&nbsp;<br />
	这样，要得到一个高画质音质低容量的MP4的话，首先画面最好不要用固定比特率，而用VBR参数让程序自己去<br />
	判断，而音质参数可以在原来的基础上提升一点，听起来要舒服很多，也不会太大（看情况调整</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	<br />
	例子：ffmpeg -y -i &quot;1.avi&quot; -title &quot;Test&quot; -vcodec xvid -s 368&#215;208 -r 29.97 &#8211; b 1500 -acodec aac -ac 2 -ar 24000 -ab 128 -vol 200 -f psp -muxvb 768 &quot;1.***&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	解释：以上命令可以在Dos命令行中输入，也可以创建到批处理文件中运行。不过，前提是：要在ffmpeg所在的目录中执行（转换君所在目录下面的cores子目录）。<br />
	参数：<br />
	-y（覆盖输出文件，即如果1.***文件已经存在的话，不经提示就覆盖掉了）<br />
	-i &quot;1.avi&quot;（输入文件是和ffmpeg在同一目录下的1.avi文件，可以自己加路径，改名字）<br />
	-title &quot;Test&quot;（在PSP中显示的影片的标题）<br />
	-vcodec xvid（使用XVID编码压缩视频，不能改的）<br />
	-s 368&#215;208（输出的分辨率为368&#215;208，注意片源一定要是16:9的不然会变形）<br />
	-r 29.97（帧数，一般就用这个吧）<br />
	-b 1500（视频数据流量，用-b xxxx的指令则使用固定码率，数字随便改，1500以上没效果；还可以用动态码率如：-qscale 4和-qscale 6，4的质量比6高）<br />
	-acodec aac（音频编码用AAC）<br />
	-ac 2（声道数1或2）<br />
	-ar 24000（声音的采样频率，好像PSP只能支持24000Hz）<br />
	-ab 128（音频数据流量，一般选择32、64、96、128）<br />
	-vol 200（200%的音量，自己改）<br />
	-f psp（输出psp专用格式）<br />
	-muxvb 768（好像是给PSP机器识别的码率，一般选择384、512和768，我改成1500，PSP就说文件损坏了）<br />
	&quot;1.***&quot;（输出文件名，也可以加路径改文件名）</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	P.S. 版主机器强劲的话，可以多开几个批处理文件，让它们并行处理。&nbsp;<br />
	E:ffmpeg.exe -i I:1.wmv -b 360 -r 25 -s 320&#215;240 -hq -deinterlace -ab 56 -ar 22050 -ac 1 D:2.flv<br />
	flvmdigui.exe 要有用户界面的，手动修复的，用这个</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	flvmdi.exe 使用方法:<br />
	命令提示符下输入&gt;flvmdi inputFile [outputFile][/s] [/x] [/e] [/k]</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	给个例子，后面的参数不加也可以修复，比如。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	flvmdi m7.flv</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	这样就行了。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	1. encode yuv file</p>
<p>	ffmpeg -s cif -vcodec mpeg4 -i paris.yuv paris.avi</p>
<p>	-s 指定帧大小 cif 为 352&#215;288，qcif 为 176&#215;144，4cif 为 704&#215;576<br />
	-vcodec 指定采用的编码器<br />
	-i 指定输入文件</p>
<p>	2. output raw YUV420P file</p>
<p>	ffmpeg -i paris.avi paris0.yuv</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
<p>	3. 将一段视频输出为图片序列</p>
<p>	ffmpeg -i 1.avi cat%d.png -vcode png</p>
<p>	-vcodec mjpeg<br />
	-vcodec ppm</p>
<p>
	ffmpeg -i 1.avi cat%04d.jpg -vcodec mjpeg -ss 0:1:2 -t 0:0:1</p>
<p>	将1.avi视频 1分02秒 处开始，持续1秒长的视频输出为jpg的序列</p>
<p>	ffmpeg -vcodec mjpeg -i 1.flv&nbsp; test%02d.jpg&nbsp; -ss 0:0:2 -t 0.001</p>
<p>	-t 表示持续时间为0.001秒，这个命令相当于截取开始2秒处的一幅jpeg的图片</p>
<p>
	4. 多输入单输出</p>
<p>	ffmpeg -i /tmp/a.wav -s 640&#215;480 -i /tmp/a.yuv /tmp/a.mpg</p>
<p>
	5. 单输入多输出</p>
<p>	ffmpeg -i /tmp/a.wav -ab 64 /tmp/a.mp2 -ab 128 /tmp/b.mp2 -map 0:0 -map 0:0</p>
<p>	-map file:stream_index 指定哪一个输入流用于输出流，顺序对应</p>
<p>
	6. DVD to mpeg4</p>
<p>	ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800 -g 300 -bf 2 -acodec mp2 -ab 128 snatch.avi</p>
<p>	压制高品质mp4的参考参数：</p>
<p>	&#39;-mbd rd -flags +4mv+trell+aic -cmp 2 -subcmp 2 -g 300 -pass 1/2&#39;&nbsp;</p>
<p>	可以试试： &#39;-bf 2&#39;, &#39;-flags qprd&#39;, &#39;-flags mv0&#39;, &#39;-flags skiprd&#39;</p>
<p>
	7. encode mpeg1/mpeg2</p>
<p>	ffmpeg -i 1.avi -vcodec mpeg2video 2.mpg</p>
<p>	注意mpeg2的codec为 mpeg2video</p>
<p>	其他codec可以使用 ffmpeg -formats 查看</p>
<p>	压制高品质mp1/mp2的参考参数：</p>
<p>	&#39;-mbd rd -flags +trell -cmp 2 -subcmp 2 -g 100 -pass 1/2&#39;&nbsp;</p>
<p>	注意，加 &#39;-g 100&#39; 可能会使某些解码器没法解码&nbsp;</p>
<p>	可以试试： &#39;-bf 2&#39;, &#39;-flags qprd&#39;, &#39;-flags mv0&#39;, &#39;-flags skiprd&#39;</p>
<p>
	8. encode flv</p>
<p>	ffmpeg -i 1.avi -ab 56 -ar 22050 -b 500 -r 15 1.flv</p>
<p>
	9. X 屏幕录像</p>
<p>	FFmpeg can grab the X11 display.</p>
<p>	ffmpeg -f x11grab -i :0.0 /tmp/out.mpg</p>
<p>	0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable.</p>
<p>	ffmpeg -f x11grab -i :0.0+10,20 /tmp/out.mpg</p>
<p>	0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable.&nbsp;<br />
	10 is the x-offset and 20 the y-offset for the grabbing.&nbsp;</p>
<p>
	10. 音视频采集</p>
<p>	ffmpeg -f audio_device -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg</p>
<p>	Note that you must activate the right video source and channel before launching FFmpeg with&nbsp;<br />
	any TV viewer such as xawtv (http://bytesex.org/xawtv/) by Gerd Knorr. You also have to set&nbsp;<br />
	the audio recording levels correctly with a standard mixer.</p>
<p>
	11. 常用选项</p>
<p>	-i filename 输入文件</p>
<p>	-f fmt 强迫采用格式fmt</p>
<p>	-y 覆盖输出文件</p>
<p>	-ss position 搜索到指定的时间处开始 [-]hh:mm:ss[.xxx]的格式也支持</p>
<p>	-b bitrate 设置比特率，缺省200kb/s</p>
<p>	-r fps 设置帧频 缺省25</p>
<p>	-s size 设置帧大小 格式为WXH 缺省160X128.下面的简写也可以直接使用：<br />
	sqcif 128X96 qcif 176X144 cif 352X288 4cif 704X576</p>
<p>	-vcodec codec 强制使用codec编解码方式。 如果用copy表示原始编解码数据必须被拷贝。</p>
<p>	-sameq 使用同样视频质量作为源（VBR）</p>
<p>	-g gop_size 设置图像组大小</p>
<p>	-intra 仅适用帧内编码</p>
<p>	-bf frames 使用frames B 帧，支持mpeg1,mpeg2,mpeg4</p>
<p>	-ab bitrate 设置音频码率</p>
<p>	-ar freq 设置音频采样率</p>
<p>	-ac channels 设置通道 缺省为1</p>
<p>	-an 不使能音频纪录</p>
<p>	-acodec codec 使用codec编解码</p>
<p>	-benchmark 为基准测试加入时间</p>
<p>	-hex 倾倒每一个输入包</p>
<p>
	12. mpayer 截图：</p>
<p>	mplayer -ss START_TIME -noframedrop -nosound -vo jpeg -frames N NAME_OF_VIDEO_FILE</p>
<p>	获取视频时长(seconds)：</p>
<p>	mplayer -identify movie-filename -nosound -vc dummy -vo null | grep ID_LENGTH</p>
<p>
	13. 快速合并视频文件：</p>
<p>	mencoder -oac copy -ovc copy -idx -o output.avi video1.avi video2.avi video3.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	本文来自CSDN博客，转载请标明出处：<a href="http://blog.csdn.net/comcat/archive/2007/04/23/1576335.aspx" style="color: rgb(159, 159, 159);">http://blog.csdn.net/comcat/archive/2007/04/23/1576335.aspx</a></p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg参数使用说明</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg.exe -i F:闪客之家闪客之歌.mp3 -ab 56 -ar 22050 -b 500 -r 15 -s 320&#215;240 f:11.flv</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i F: 1.wmv -ab 56 -ar 22050 -b 500 -r 15 -s 320&#215;240 f:test.flv</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	使用-ss参数 作用（time_off set the start time offset），可以从指定时间点开始转换任务。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	如:转换文件格式的同时抓缩微图：</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i &quot;test.avi&quot; -y -f image2 -ss 8 -t 0.001 -s 350&#215;240 &#39;test.jpg&#39;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	对已有flv抓图：</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -i &quot;test.flv&quot; -y -f image2 -ss 8 -t 0.001 -s 350&#215;240 &#39;test.jpg&#39;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-ss后跟的时间单位为秒</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	Ffmpeg转换命令</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg -y -i test.mpeg -bitexact -vcodec h263 -b 128 -r 15 -s 176&#215;144 -acodec aac -ac 2 -ar 22500&nbsp;<br />
	-ab 24 -f 3gp test.3gp<br />
	或者<br />
	ffmpeg -y -i test.mpeg -ac 1 -acodec amr_nb -ar 8000 -s 176&#215;144 -b 128 -r 15 test.3gp</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	<br />
	ffmpeg参数解释<br />
	A) 通用选项</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-L license&nbsp;<br />
	-h 帮助&nbsp;<br />
	-fromats 显示可用的格式，编解码的，协议的&#8230;&nbsp;<br />
	-f fmt 强迫采用格式fmt&nbsp;<br />
	-I filename 输入文件&nbsp;<br />
	-y 覆盖输出文件&nbsp;<br />
	-t duration 设置纪录时间 hh:mm:ss[.xxx]格式的记录时间也支持&nbsp;<br />
	-ss position 搜索到指定的时间 [-]hh:mm:ss[.xxx]的格式也支持&nbsp;<br />
	-title string 设置标题&nbsp;<br />
	-author string 设置作者&nbsp;<br />
	-copyright string 设置版权&nbsp;<br />
	-comment string 设置评论&nbsp;<br />
	-target type 设置目标文件类型(vcd,svcd,dvd) 所有的格式选项（比特率，编解码以及缓冲区大小）自动设置，只需要输入如下的就可以了：ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg&nbsp;<br />
	-hq 激活高质量设置&nbsp;<br />
	-itsoffset offset 设置以秒为基准的时间偏移，该选项影响所有后面的输入文件。该偏移被加到输入文件的时戳，定义一个正偏移意味着相应的流被延迟了 offset秒。 [-]hh:mm:ss[.xxx]的格式也支持</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	B) 视频选项</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-b bitrate 设置比特率，缺省200kb/s&nbsp;<br />
	-r fps 设置帧频 缺省25&nbsp;<br />
	-s size 设置帧大小 格式为WXH 缺省160X128.下面的简写也可以直接使用：&nbsp;<br />
	Sqcif 128X96 qcif 176X144 cif 252X288 4cif 704X576&nbsp;<br />
	-aspect aspect 设置横纵比 4:3 16:9 或 1.3333 1.7777&nbsp;<br />
	-croptop size 设置顶部切除带大小 像素单位&nbsp;<br />
	-cropbottom size &ndash;cropleft size &ndash;cropright size&nbsp;<br />
	-padtop size 设置顶部补齐的大小 像素单位&nbsp;<br />
	-padbottom size &ndash;padleft size &ndash;padright size &ndash;padcolor color 设置补齐条颜色(hex,6个16进制的数，红:绿:兰排列，比如 000000代表黑色)&nbsp;<br />
	-vn 不做视频记录&nbsp;<br />
	-bt tolerance 设置视频码率容忍度kbit/s&nbsp;<br />
	-maxrate bitrate设置最大视频码率容忍度&nbsp;<br />
	-minrate bitreate 设置最小视频码率容忍度&nbsp;<br />
	-bufsize size 设置码率控制缓冲区大小&nbsp;<br />
	-vcodec codec 强制使用codec编解码方式。如果用copy表示原始编解码数据必须被拷贝。&nbsp;<br />
	-sameq 使用同样视频质量作为源（VBR）&nbsp;<br />
	-pass n 选择处理遍数（1或者2）。两遍编码非常有用。第一遍生成统计信息，第二遍生成精确的请求的码率&nbsp;<br />
	-passlogfile file 选择两遍的纪录文件名为file</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	C)高级视频选项</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-g gop_size 设置图像组大小&nbsp;<br />
	-intra 仅适用帧内编码&nbsp;<br />
	-qscale q 使用固定的视频量化标度(VBR)&nbsp;<br />
	-qmin q 最小视频量化标度(VBR)&nbsp;<br />
	-qmax q 最大视频量化标度(VBR)&nbsp;<br />
	-qdiff q 量化标度间最大偏差 (VBR)&nbsp;<br />
	-qblur blur 视频量化标度柔化(VBR)&nbsp;<br />
	-qcomp compression 视频量化标度压缩(VBR)&nbsp;<br />
	-rc_init_cplx complexity 一遍编码的初始复杂度&nbsp;<br />
	-b_qfactor factor 在p和b帧间的qp因子&nbsp;<br />
	-i_qfactor factor 在p和i帧间的qp因子&nbsp;<br />
	-b_qoffset offset 在p和b帧间的qp偏差&nbsp;<br />
	-i_qoffset offset 在p和i帧间的qp偏差&nbsp;<br />
	-rc_eq equation 设置码率控制方程 默认tex^qComp&nbsp;<br />
	-rc_override override 特定间隔下的速率控制重载&nbsp;<br />
	-me method 设置运动估计的方法 可用方法有 zero phods log x1 epzs(缺省) full&nbsp;<br />
	-dct_algo algo 设置dct的算法 可用的有 0 FF_DCT_AUTO 缺省的DCT 1 FF_DCT_FASTINT 2 FF_DCT_INT 3 FF_DCT_MMX 4 FF_DCT_MLIB 5 FF_DCT_ALTIVEC&nbsp;<br />
	-idct_algo algo 设置idct算法。可用的有 0 FF_IDCT_AUTO 缺省的IDCT 1 FF_IDCT_INT 2 FF_IDCT_SIMPLE 3 FF_IDCT_SIMPLEMMX 4 FF_IDCT_LIBMPEG2MMX 5 FF_IDCT_PS2 6 FF_IDCT_MLIB 7 FF_IDCT_ARM 8 FF_IDCT_ALTIVEC 9 FF_IDCT_SH4 10 FF_IDCT_SIMPLEARM&nbsp;<br />
	-er n 设置错误残留为n 1 FF_ER_CAREFULL 缺省 2 FF_ER_COMPLIANT 3 FF_ER_AGGRESSIVE 4 FF_ER_VERY_AGGRESSIVE&nbsp;<br />
	-ec bit_mask 设置错误掩蔽为bit_mask,该值为如下值的位掩码 1 FF_EC_GUESS_MVS (default=enabled) 2 FF_EC_DEBLOCK (default=enabled)&nbsp;<br />
	-bf frames 使用frames B 帧，支持mpeg1,mpeg2,mpeg4&nbsp;<br />
	-mbd mode 宏块决策 0 FF_MB_DECISION_SIMPLE 使用mb_cmp 1 FF_MB_DECISION_BITS 2 FF_MB_DECISION_RD&nbsp;<br />
	-4mv 使用4个运动矢量 仅用于mpeg4&nbsp;<br />
	-part 使用数据划分 仅用于mpeg4&nbsp;<br />
	-bug param 绕过没有被自动监测到编码器的问题&nbsp;<br />
	-strict strictness 跟标准的严格性&nbsp;<br />
	-aic 使能高级帧内编码 h263+&nbsp;<br />
	-umv 使能无限运动矢量 h263+&nbsp;<br />
	-deinterlace 不采用交织方法&nbsp;<br />
	-interlace 强迫交织法编码仅对mpeg2和mpeg4有效。当你的输入是交织的并且你想要保持交织以最小图像损失的时候采用该选项。可选的方法是不交织，但是损失更大&nbsp;<br />
	-psnr 计算压缩帧的psnr&nbsp;<br />
	-vstats 输出视频编码统计到vstats_hhmmss.log&nbsp;<br />
	-vhook module 插入视频处理模块 module 包括了模块名和参数，用空格分开</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	D)音频选项</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-ab bitrate 设置音频码率&nbsp;<br />
	-ar freq 设置音频采样率&nbsp;<br />
	-ac channels 设置通道 缺省为1&nbsp;<br />
	-an 不使能音频纪录&nbsp;<br />
	-acodec codec 使用codec编解码</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	E)音频/视频捕获选项</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-vd device 设置视频捕获设备。比如/dev/video0&nbsp;<br />
	-vc channel 设置视频捕获通道 DV1394专用&nbsp;<br />
	-tvstd standard 设置电视标准 NTSC PAL(SECAM)&nbsp;<br />
	-dv1394 设置DV1394捕获&nbsp;<br />
	-av device 设置音频设备 比如/dev/dsp</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	F)高级选项</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-map file:stream 设置输入流映射&nbsp;<br />
	-debug 打印特定调试信息&nbsp;<br />
	-benchmark 为基准测试加入时间&nbsp;<br />
	-hex 倾倒每一个输入包&nbsp;<br />
	-bitexact 仅使用位精确算法 用于编解码测试&nbsp;<br />
	-ps size 设置包大小，以bits为单位&nbsp;<br />
	-re 以本地帧频读数据，主要用于模拟捕获设备&nbsp;<br />
	-loop 循环输入流（只工作于图像流，用于ffserver测试）&nbsp;&nbsp;<br />
	本文来自CSDN博客，转载请标明出处：<a href="http://blog.csdn.net/ctthen/archive/2009/06/26/4299104.aspx" style="color: rgb(159, 159, 159);">http://blog.csdn.net/ctthen/archive/2009/06/26/4299104.aspx</a></p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	ffmpeg.exe -y -i &quot;C:画皮10.flv&quot; -ss 0 -f mp4 -vcodec mpeg4 -bf 2 -flags qprd -flags mv0&nbsp; -acodec libfaac -ac 2 -ab 64K&nbsp; -ar 32000 &quot;C:画皮10.mp4&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	unsharp=l3x3:0.5</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	<br />
	-vf里还有expand和crop参数，例如：-vf scale=512:384,expand=512:384:::1,crop=512:384:0:0，expand表示膨胀，crop表示裁剪；</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder.exe -noodml &ldquo;source.avi&rdquo; -sub &ldquo;sub.srt&rdquo; -subcp cp936 -font simhei.ttf -subfont-text-scale 4 -o &ldquo;output.avi&rdquo; -ofps 20.000 -vf-add scale=640:-2 -ovc xvid -xvidencopts bitrate=500 -srate 44100 -oac mp3lame -lameopts vbr=0 -lameopts br=128 -lameopts vol=0 -lameopts mode=0 -lameopts aq=7 -lameopts padding=3 -af volnorm -xvidencopts max_bframes=0:nogmc:noqpel</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	gb2312的编码页是936，所以这里使用cp936。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	<br />
	scale=640:-2 缩放。将原始文件缩放到宽是640，高是自适应的大小</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder -oac mp3lame -lameopts vbr=3:br=64 -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=200 -sub video.srt -o new.avi -font simsun.ttf video.avi -subcp cp936 -subfont-text-scale 4 -vf scale=320:240</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder vts_23_1.vob -oac mp3lame -lameopts cbr:mode=0:br=256 -ofps 18 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:cbp:trell:vbitrate=300 -vf scale=320:240,rotate=1 -ffourcc XVID -o output_video.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&nbsp;&nbsp;&nbsp; * ffmpeg能解析的格式：（asx，asf，mpg，wmv，3gp，mp4，mov，avi，flv等）&nbsp;&nbsp;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 对ffmpeg无法解析的文件格式(wmv9，rm，rmvb等), 可以先用别的工具（mencoder）转换为avi(ffmpeg能解析的)格式.&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * mode=3:cbr:br=24单声道 音频码率为24kbps;-lameopts&nbsp;&nbsp;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * mode=0:cbr:br=24立体声，音频码率为24kbps; 还可设置音量，-lameopts&nbsp;&nbsp;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * mode=3:cbr:br=32:vol=1，设置范置为1~10，但不宜设得太高&nbsp;&nbsp;<br />
	vbr=3:br=128&nbsp;<br />
	&nbsp; &quot;vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=-1:cmp=3:vb_strategy=1&quot;<br />
	&nbsp;&nbsp; &quot;-lameopts&quot;&nbsp; &quot;abr:br=56&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	清晰度 -qscale 4 为最好可是文件大, -qscale 6就可以了&nbsp;&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder basket.rm -ovc lavc -oac mp3lame -o basket.avi -ss 5:00 -endpos 8:00<br />
	&quot;-ss 5:00 -endpos 8:00&quot;告诉mencoder仅仅转换从5分0秒到13分0秒的片段。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder a1.avi a2.avi -ovc copy -oac copy -o asum.avi<br />
	这个命令把a1.avi和a2.avi文件合并为asum.avi文件。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder basket.rm -ovc lavc -oac lavc -lavcopts vbitrate=100 -lavcopts abitrate=32 -o basket.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
	faac（-faacopts）</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	br=&lt;bitrate&gt;<br />
	&nbsp;&nbsp;&nbsp; 平均比特率，单位为kbps（与quality选项不能同时使用）<br />
	quality=&lt;1-1000&gt;<br />
	&nbsp;&nbsp;&nbsp; 质量模式，值越高效果越好（与br选项不能同时使用）<br />
	object=&lt;1-4&gt;<br />
	&nbsp;&nbsp;&nbsp; 目标类型的复杂度<br />
	&nbsp;&nbsp;&nbsp; MAIN（默认值）<br />
	&nbsp;&nbsp;&nbsp; LOW<br />
	&nbsp;&nbsp;&nbsp; SSR<br />
	&nbsp;&nbsp;&nbsp; LTP（运行极慢）<br />
	mpeg=&lt;2|4&gt;<br />
	&nbsp;&nbsp;&nbsp; MPEG版本（默认值：4）<br />
	tns&nbsp;&nbsp;&nbsp;&nbsp;<br />
	&nbsp;&nbsp;&nbsp; 启用瞬时噪声整形（TNS）功能。<br />
	cutoff=&lt;0-采样频率/2&gt;<br />
	&nbsp;&nbsp;&nbsp; 截断频率（默认值：采样频率/2）</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;-lameopts abr:br=32:mode=3 abr代表平均码率，相对于cbr(固定码率)和vbr(可变码率,貌似不支持),br就是音频的码率，越高音质越好,mode=3，0-3分别代表 Stereo,Joint Stereo,Force ms_stereo,Mono(默认为自动，事实上1和3对文件大小的影响并不是很大),另外可选的还有 vol(音量，取值0-10,数值越大音量越大</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
	　　音频：动态码率，质量 4 (0-9，0最好)，编码：MP3，采样：32000Hz,音频算法：7</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	　　视频：动态码率，质量 8(0-31，0最好)，编码：xvid，尺寸：原尺寸</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	　　CODE:</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	　　mencoder -oac MP3lame -lameopts aq=7:vbr=2:q=4 -srate 32000 -vf harddup -ovc xvid -xvidencopts fixed_quant=8 src.avi -o dst.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
	mencoder.exe -noodml &quot;j:工作区 1.wmv&quot; -of avi -o &quot;j:工作区b.avi&quot; -ofps 20 -vf-add scale=224:176 -vf-add expand=224:176:-1:-1:1,rotate=2,flip -srate 44100 -ovc xvid -xvidencopts bitrate=350:max_bframes=0:quant_type=h263:me_quality=4 -oac lavc -lavcopts acodec=mp2:abitrate=96</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	-noodml&nbsp; （仅用于-of avi的情况下）对于大于1GB的AVI文件不写入OpenDML索引。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	rotate[=&lt;0-7&gt;] 以90度为单位旋转图像并有选择地将其翻转</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	flip&nbsp; 上下翻转图像。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	me_quality=&lt;0-6&gt;&nbsp;<br />
	&nbsp;该选项控制运动估计子系统。值越高，运动估计就越精确（默认值：6）。运动估计越精确，就能节省越多的比特。提高精度是以牺牲CPU时间为代价的，所以如果你需要实时编码，那么就降低这个设置。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mbd=2:cbp:trell<br />
	padding=0-2<br />
	nogmc:noqpel<br />
	unsharp=l3x3:0.5 反锐化修饰 / 高斯模糊</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	音视频文件合成:<br />
	ffmpeg -i &quot;d:2010.avi&quot; -i &quot;d: 000.mp3&quot; -vcodec copy -acodec copy -y &quot;d:2010x.avi&quot;&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	音视频文件分离：</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder.exe -ovc copy -nosound -of rawvideo &quot;C: .avi&quot; -o &quot;C: 00.avi&quot;<br />
	mencoder.exe -ovc frameno -oac copy -of rawaudio &quot;C: .avi&quot; -o &quot;C: 00.mp3&quot;<br />
	mencoder.exe -ovc frameno -oac mp3lame -lameopts cbr:br=128 -of rawaudio &quot;C: .avi&quot; -o &quot;C: 0.mp3&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -xvidencopts bitrate=200:threads=5:me_quality=6:vhq=1<br />
	&nbsp;mencoder.exe src.avi -o dst.avi -noskip -vf scale=320:240 -oac mp3lame -lameopts vbr=3:br=128:vol=1</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;-ovc xvid -xvidencopts&nbsp; pass=1:bitrate=300:keyframe_boost=20:trellis:quant_type=h263</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8211;&nbsp; 合并几个视频片段<br />
	&nbsp;mencoder -oac copy -ovc copy -idx -o output.avi 1.avi 2.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp; 将rmvb转为mp2音频mpeg2video视频的mpg文件：</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;mencoder 01.rmvb -oac lavc -lavcopts acodec=mp2:abitrate=64 -ovc lavc&nbsp;<br />
	-lavcopts vcodec=mpeg2video:vbitrate=600:vpass=1 -ofps 24000/1001 -of mpeg -o 01.mpg</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8211;&nbsp; 将rmvb转为mp3音频xvid视频的avi文件：<br />
	&nbsp;mencoder 01.rmvb -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o 01.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp; 转为FLV:<br />
	&nbsp;mencoder %1 -o %2 -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc&nbsp;-lavcopts&nbsp; vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6<br />
	&nbsp;:vb_strategy=1 -vf scale=320:-3&nbsp; -srate 22050</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp; 转为3gp:<br />
	&nbsp;mencoder.exe &quot;E:1.avi&quot;&nbsp; -ss 00:03:10 -endpos 280 -af volnorm -srate 22050&nbsp;<br />
	-vf-add scale=320:-3,harddup -ofps 15 -oac faac -faacopts br=32:mpeg=4:object=2&nbsp;<br />
	-ovc xvid -xvidencopts bitrate=500:threads=2:max_bframes=0 -o &quot;C:1.XviD.avi&quot;&nbsp;<br />
	&nbsp;call &quot;batch3gp.bat&quot; &quot;C:1.XviD.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&#8212;&#8212;&#8212;&#8211;&nbsp; 转为avi:&nbsp; （-af channels=2:2:1:0:1:1 右声道 / -af channels=2:2:0:0:0:1 左声道 / -stereo 0 立体声<br />
	&nbsp;&nbsp; 经实验，目前divx比xvid要快，在使用vhq功能时会稍稍影响速度）</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;mencoder.exe -srate 32000 -stereo 0 -oac mp3lame -lameopts mode=2:cbr:br=128:vol=2&nbsp;<br />
	-ovc lavc -ffourcc DX50 -lavcopts vcodec=mpeg4:vbitrate=1400 -ofps 18 -vf scale=480:320<br />
	&nbsp;-sws 9 &quot;K:1111.avi&quot; -o &quot;K:1111.XviD.avi&quot;&nbsp;&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	bitrate=1400&nbsp; vhq:vbitrate=350 超高画质只对应Divx编码(very high quality for Divx only)</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&#8212;&#8212;&#8212;&#8211;&nbsp; 压入字幕:&nbsp;&nbsp; 字幕 11.srt 需先行转成 UTF-8格式&nbsp; 字体选用中文字体<br />
	&nbsp;mencoder.exe &quot;F:11.mkv&quot; -ss 10:00 -endpos 60 -srate 22050 -vf scale=320:-3 -ofps 15&nbsp;<br />
	-oac faac -faacopts br=32:mpeg=4:object=2 -ovc xvid -xvidencopts bitrate=500:threads=2:max_bframes=0<br />
	&nbsp;-sub &quot;F:11.srt&quot; -subpos 99 -subfont-text-scale 3 -subfont-blur 0 -subfont-outline 0&nbsp;<br />
	-font &quot;C:WINDOWSFontsmingliu.ttc&quot; -subcp cp950 -unicode -o &quot;F:11.mkv.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;call batch3gp.bat &quot;F:11.mkv.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp; 加黑边，字幕压在黑边里<br />
	&nbsp;mencoder.exe &quot;F: 0.mkv&quot; -ss 10:00 -endpos 30 -af volnorm -srate 22050 -vf-add scale=320:-3<br />
	&nbsp;-vf-add expand=320:240:-1:-1:1,harddup -ofps 15 -oac faac -faacopts br=32:mpeg=4:object=2<br />
	&nbsp;-ovc xvid -xvidencopts bitrate=500:threads=2:max_bframes=0 -sub &quot;F: 0.srt&quot; -subpos 99&nbsp;<br />
	-subfont-text-scale 4 -subfont-blur 1 -subfont-outline 1 -font &quot;C:WINDOWSFonts苏新诗卵石体.ttf&quot;&nbsp;<br />
	-subcp cp950 -unicode -o &quot;F: 0.mkv.avi&quot;<br />
	&nbsp;call batch3gp.bat &quot;F: 0.mkv.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp; 视频滤镜&nbsp;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;缩放过程由scale视频滤镜处理：-vf scale=width:height。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	其质量由-sws选项控制。如果它没有指定， MEncoder将使用0：快速二次线性缩放。<br />
	&nbsp;-vf &#8230;,rotate=R,&#8230;harddup &#8230; R=旋转方式（0，逆时针90度&nbsp;&nbsp; 1，顺时针90度 ）<br />
	&nbsp;-vf &#8230;,mirror,&#8230;harddup &#8230; 水平翻转<br />
	&nbsp;-vf &#8230;flip,&#8230;harddup &#8230; 垂直翻转<br />
	&nbsp;-vf &#8230;,crop=W:H:X:Y,&#8230;harddup<br />
	&nbsp;-vf &#8230;,expand=W:H:-1:-1:1,&#8230;harddup &#8230; 加黑边将画面扩展到W:H<br />
	&nbsp;-vf&#8230;-ofps F &#8230; F=帧速率</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp; 合并几个视频片段<br />
	&nbsp;mencoder -oac copy -ovc copy -idx -o output.avi video1.avi video2.avi video3.avi<br />
	&nbsp;* 其中，-oac copy 选项告诉 mencoder 要正确拷贝音频流。而 -ovc copy 选项则是拷贝视频流。<br />
	&nbsp;* 如果在视频文件中没有找到索引的话，那么 -idx 选项会要求 mencoder 建立它。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;-vf scale=720:-3,harddup -xvidencopts fixed_quant=11&nbsp;&nbsp;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -xvidencopts bitrate=1440</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;反交错:&nbsp; -sws 9&nbsp; -vf-add yadif,scale=720:-3</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8211;&nbsp;&nbsp; DVD to AVI:<br />
	mencoder.exe dvd://33 -dvd-device i:/ -ovc lavc -ffourcc DX50 -lavcopts vcodec=mpeg4:vhq:vbitrate=300 -oac mp3lame -lameopts abr:br=128:vol=5 -o c: 33.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	mencoder.exe dvd://1 -dvd-device i:/ -slang zh -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=238 -of avi -srate 22050 -o &quot;c: 1.avi&quot;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	（Divx 视频编码，MP3 音频编码）：<br />
	　　mencoder.exe input.mpg -oac mp3lame -lameopts aq=3:abr:br=128 -srate 44100 -ovc lavc</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	&nbsp;-lavcopts vcodec=mpeg4:vbitrate=1200 -ffourcc DX50 -vf scale=480:360,crop=640:478:0:0,harddup -ofps 30 -o output.avi</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	　　1、-oac mp3lame 音频编码类型。此例中选择的是 mp3lame。<br />
	　　2、-lameopts aq=3:abr:br=128：（lame options）aq 为编码质量，它的值为 0~9，数字越小音频的数字失真就越小，编码的时间就越长；编码方式包括有 abr（按平均码率编码）、cbr（指固定码率编码）、vbr（按动态码率编码）三种；br=128 则指定编码码率为 128kbps。<br />
	　　3、-srate 44100：（sample rate）指定音频的采样频率。频率通常有 22050、32000、44100 等几种。<br />
	　　4、-ovc lavc：（output video codec）指定输出媒体文件的视频编码类型。此处选择的是 Libavcodec 的视频编码<br />
	　　5、-lavcopts vcodec=mpeg4:vbitrate=1200：（Libavcodec options）指定视频编码的设置。由于 Libavcodec 包含了多种视频编码，所以用 vcodec=mpeg4 来指定具体的使用 MPEG-4 编码，vbitrate 是设定视频编码的码率为 1200kbps。<br />
	　　7、-vf scale=480:360,crop=640:478:0:0,harddup：（video filters）指定编码的视频滤镜设置。scale=480:360 用于指定输入媒体文件的画面大小，宽度为 480 像素，高度为 360 像素。crop=638:477:1:2 是剪栽选项，从原始画面的座标（1,2）为起点，截取 638&times;477 像素的图像。<br />
	　　注意，命令里的 scale 参数放在 crop 参数之前，表示&ldquo;先缩放后剪栽&rdquo;，如果 crop 参数放于 scale 参数之前，则表示&ldquo;先剪栽后缩放&rdquo;。<br />
	　　8、-ofps 30：（output fps）指定输出媒体文件的帧速，30fps 指每秒种播放 30 个画面。<br />
	　　9、-o output.avi：（output）指定转换后输入媒体的文件名。</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	使用 Mencoder 将一个 RMVB 文件转换成一个 PMP 文件（PSP 游戏机专用）</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	　　需要使用到以下三个命令：<br />
	　　（1）mencoder.exe input.rmvb -sws 9 -ofps 23.976 -vf harddup,pp=md/lb,scale=480:272 -ovc x264 -ffourcc H264 -x264encopts qp_constant=25 -srate 44100 -af volnorm -oac mp3lame -lameopts aq=3:cbr:br=128:vol=1 -o video.avi<br />
	　　（2）mencoder.exe video.avi -oac copy -ovc copy -of rawaudio -o audio.mp3<br />
	　　（3）pmp_muxer_avc.exe -v video.avi -a audio.mp3 -s 1000 -r 23976 -d 1 -o output.pmp</p>
<p style="margin: 0px; padding: 0px; color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px; background-color: rgb(255, 255, 255);">
	　　1、第一个命令是将 RMVB 转换成视频为 H264 编码、音频为 MP3 编码的 AVI 文件，其中：-sws 9 参数指定了编码的采样使用 Lanczos3 算法（如果不指定则采用线性采样），可以获得更具体的细节和更精细的画面；qp_constant=25 指定了视频编码的质量，在压缩 PSP 媒体的时候一般选择 20（最优）~25（普通）；-af volnorm （volume normalize）设置了音频编码时音量规格化。<br />
	　　2、第二个命令是将音频部份从第一个命令生成的 video.avi 中提取出来，其中：-of rawaudio （output filter）指定了只输出音频部分而忽略视频部分。<br />
	　　3、第三个命令是将 video.avi 和 audio.mp3 合成 PMP 文件。pmp_muxer_avc.exe 文件须要另外下载，在各个 PSP 论坛里都可以找到。PMP 和 AVI 一样，是媒体文件的一种容器格式，并非是编码格式，而 MEncoder 并不直接支持 PMP 容器，所以须要借助一下第三方的工具。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=134</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mencoder avi2mp4</title>
		<link>https://www.softwareace.cn/?p=131</link>
		<comments>https://www.softwareace.cn/?p=131#comments</comments>
		<pubDate>Thu, 24 Jan 2013 07:49:02 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[视频音频转码]]></category>

		<guid isPermaLink="false">http://www.softwareace.cn/?p=131</guid>
		<description><![CDATA[[crayon-69fab3a0e9ef2922284497/] 另存为 *.bat avi视频拖到此bat]]></description>
				<content:encoded><![CDATA[<p></p><pre class="crayon-plain-tag">rem created for http://www.softwareace.cn/
echo off
set file_name=%1
%~dp0mencoder.exe &amp;quot;%1&amp;quot; -o &amp;quot;%file_name:~0,-4%.mp4&amp;quot;   -oac copy -ovc lavc -lavcopts vcodec=mpeg1video -of mpeg
echo convert finish,the mp4 saved in %file_name:~0,-4%.mp4
echo Drag files to this batch so easy
echo on
pause</pre><p></p>
<p>
	另存为 *.bat avi视频拖到此bat</p>
]]></content:encoded>
			<wfw:commentRss>https://www.softwareace.cn/?feed=rss2&#038;p=131</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
