LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2092|回复: 7

Mencoder学习手记之一 - 基本篇

[复制链接]
发表于 2010-4-9 13:35:48 | 显示全部楼层 |阅读模式
不辞简陋,自家的学习心得,拿出来贡献给Linuxsir,在最初的debian的日子里,坛里的很多兄弟给了莫大的帮助和勇气,ths ALL!

20100512 我还是回来了,工作的事情很多,没有什么时间搞这个视频编码.不过期间对mencoder的理解也大为不同.
201004xx  应该把一些问题写下来,靠一个人的力量真的很有限,要是论坛上由人解答一下多好.

问题

* 用Mencoder压制文件的兼容性(是否可以自由地由非Mplayer播放器播放)
* 能否把低质量的音频通过再编码,换成高质量的音频?
* 能否把低质量的视频通过再编码,换成高质量的视频?
* 如果-of avi时,x264编码,-ovc部分如何?(至今没有在GOOGLE搜索到答案)
* x264编码和那种音频编码匹配?
* -of 部分真是一个怪物,这玩意究竟是什么,mencoder竟然不直接支持那些flv格式?怎么回事?
* Mencoder如何确定容器格式
* -of 和-ovc是否有关联
* lavf容器和lavc编码的关联
* -of部分似乎不是必须的
* 根据man手册页的说明,Mencoder可以拆解为两个部分而已


=======================================================

Mencoder手记第一篇  引路

这部分主要是了解一些基础概念和自身需求。
  
学习Mencoder之前了解下容器(文件格式)和编码。为什么要学习这种知识呢?举我个人的例子说明。

我个人不要求视频和音频的质量,只希望能看故事情节就行了,我又保存了非常多的电视剧和电影,有很多是700兆的AVI,可惜我的硬盘又很小,放不下,因此只能压缩下那些AVI文件,那应该怎么办呢?

这里产生了我最原始的需求----保留质量,降低视频文件的体积.

  因此我首先在Google做了以下搜索,比如“如何压缩avi文件","如何压缩avi格式","如何将avi转换成rmvb",当然成果就是找到一堆的软件,我记忆深刻的只有两个,一个是找到一个叫做Easy REAL Producder的软件,另一个成果就是找到"人人出品的AVS压缩套装”。当然,我不会使用这两个软件,因为那不是跨平台的。

  我这里犯了一个原则性的错误----原因就是不理解容器和编码的概念,其实avi文件可以很小的,比如我有个avi文件,700多兆,后来我用mencoder将其压缩为1/3,依然是avi格式的文件,但画质和音质都不变(或者说我本人感觉不到改变),这是怎么回事呢?

  OK,假如我们要将一个文件拆分开的话,你会发现有两个东西,一个是视频,没有声音的,一个是音频,你甚至发现这个音频原来是一个MP3文件。

额滴神呀,原来如此。原来那个avi是一个碗(是一种容器),这个碗里装了两种东西,一个是猪肉,一个橙汁。原来那个avi的内容是分成了两种食物,一个猪肉(视频流),一个是橙汁(音频流)

  假如这个碗里的橙汁配猪肉不好吃的话,那么换成酱油(AAC音频)也是可以的。

这里有两个理解,我摘录自网上的,但不一定精确。

  理解一、人们设定了不同的视频文件格式来把视频和音频放在一个文件中,以方便同时回放,实际上都是一个容器里面包裹着不同的轨道。容器是用来区分不同文件的数据类型的,而编码格式则由音视频的压缩算法决定,我们一般所说的文件格式或者是后缀名指的就是文件的容器。 对于一种容器,可以包含不同编码格式的一种视频和音频。

  理解二、封装格式(也叫容器):所谓封装格式就是将已经编码压缩好的视频轨和音频轨按照一定的格式放到一个文件中,也就是说仅仅是一个外壳,或者大家把它当成一个放视频轨和音频轨的文件夹也可以。说得通俗点,视频轨相当于饭,而音频轨相当于菜,封装格式就是一个碗,或者一个锅,用来盛放饭菜的容器。
  
附上维基上的容器说明 [文件格式]

容器        后缀        出品公司        特点        可封装编码
AVI        avi        Microsoft        全称是Audio Video Interactive,其含义是,就是把视频和音频编码混合在一起储存,最常见的音频视频容器。支持的视频音频编码也是最多的。AVI也是最长寿的格式,已存在 10余年了,虽然发布过改版(V2.0于1996年发布),但已显老态。                
Mov        mov        Apple         QuickTime 的音频视频容器,恐怕也是现今最强大的容器,甚至支持虚拟现实技术,Java 等,它的变种 MP4,3GP都没有这么厉害。               
MPG         mpg mpeg dat                MPEG编码采用的音频视频容器,具有流的特性。里面又分为 PS,TS 等,PS 主要用于 DVD 存储,TS 主要用于 HDTV。               
MP4        mp4                 MPEG-4编码采用的音频视频容器,基于 QuickTime MOV 开发,具有许多先进特性。               
TS                        MPEG-2 transport stream,用于数字广播等非可靠传输领域,也被蓝光采用。               
VOB        vob                 DVD采用的音频视频容器格式(即视频MPEG-2,音频用AC3或者DTS),支持多视频多音轨多字幕章节等。               
ASF        wmv asf        Microsoft        Advanced Systems Format,Windows Media 采用的音频视频容器,能够用于流传送,还能包容脚本等。 ASF封装的WMV视频具有“数位版权保护”功能。               
MKV                Matroska        MKV 它能把 Windows Media Video,RealVideo,MPEG-4 等视频音频融为一个文件,而且支持多音轨,支持章节字幕等。 开放标准,开源。               
WAV        wav                 一种音频容器(注意:只是音频),大家常说的 WAV 就是没有压缩的 PCM 编码,其实 WAV 里面还可以包括 MP3 等其他 ACM 压缩编码。
               
RM        rm
rmvb        Real         RealMedia 采用的音频视频容器,用于流传送。 由RealNetworks开发的一种容器,它通常只能容纳Real Video和Real Audio编码的媒体。可变比特率的RMVB格式,体积很小,非常受到网络下载者的欢迎。               
FLV                                       
3GP        3gp                 3GPP视频采用的格式,主要用于流媒体传送               

  wikipedia上有个容器格式比较的文章:
http://en.wikipedia.org/wiki/Comparison_of_container_formats

  由此我们可以看到,文件格式和容器格式是两个不同的概念。我们现在可以总结下,一个完整的视频包(注意:我用的是"包"这个概念)应该包含五个因素
  --容器格式
  --正确的,以及和容器匹配的文件名后缀
    (比如x264编码可以用mp4格式打包,然后用mp4作为文件名后缀)
    (另外据说MP4容器具有很多先进性)
  --视频部分
   (这里指的是原始的视频流加上编码)
  --音频部分
   (同上,原始音频流加上编码)
  --字幕
   (其实是不一定需要,不过我们的Mencoder是具备一定的字幕处理能力)

  这里还是有一点需要提及,有时候我们得到的视频文件,文件的后缀名不一定准确,比如avi文件可能是mp4文件,FLV文件可能是rmvb文件等等,大部分的播放器是不会看文件后缀来播放的。

  从上面的知识我们还可以展开很多常见的情况,比如视频文件可以没有声音,MP3格式的文件可以再次压缩(比如将采样率降低可以降低体积),等等.

  到这里,我终于明白当初的误区是如何来的,也回顾自己接触视频的过程。在最早的时候,通过买光碟来看最喜爱的《X File》,要装一大堆的Divx和xVID解码器。后来国内宽带发展的很快,于是接触了eMule,从VeryCD下载那些很大的AVI和字幕,后来字幕组发展的很好,于是我转投BT,开始下载那些质量很好但文件不大的RMVB。所以脑子里总是认为RMVB就是唯一的选择。

  最后提一个非常重要的概念,就是"码率",我是后来才理解的,wikipedia上搜索"视频",可以看到这个解释.
发表于 2010-4-13 15:26:18 | 显示全部楼层
似乎文章没有贴完?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-4-13 19:16:52 | 显示全部楼层
Post by 7dehao;2082584
似乎文章没有贴完?


是的,自己在这方面的水平并不高,贴这些文章多少有些害羞吧,也不知道是否受欢迎,所以一开始没有什么热情,呵呵
回复 支持 反对

使用道具 举报

发表于 2010-4-14 16:04:12 | 显示全部楼层
这个工具是很有用的,希望楼主能够把文章完成好,谢谢。
回复 支持 反对

使用道具 举报

发表于 2010-4-14 22:53:11 | 显示全部楼层
呵呵,不错,支持楼主继续努力把文章贴完~~
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-5-13 00:10:17 | 显示全部楼层
sir里对mencoder感兴趣的朋友好像不多阿
回复 支持 反对

使用道具 举报

发表于 2010-5-18 09:25:36 | 显示全部楼层
Post by tsangtim;2089698
sir里对mencoder感兴趣的朋友好像不多阿


实用就行,一般就是剪接部分影视片段而已,然后合并之。你懂的呀~~;)
回复 支持 反对

使用道具 举报

发表于 2010-5-19 15:33:35 | 显示全部楼层
There has been a number of 1 week bans given to people for trolling. All the threads deleted included quotes from developers, sarcasm about their skill and direction, disagreements with certain abilities damage etc

Please dont let the banhammer silence the warlock forums. Continue to post in a CONSTRUCTIVE manner, even though it is very difficult to do considering the circumstances.
They would have to make a decent look at our forums to grant bans. I will be taking the easier method, instead
wow power leveling wedding dresses wow gold aion power leveling rolex Replica wow power leveling give us the feedback that we needed to make this release as good as it is. I kjdslfkwzf know I speak for both Araband and myself when I say we couldn't have done as well without  
WowMatrix is a 100% FREE WoW AddOn Installer and Updater that is completely safe to use and contains no keyloggers or spyware. No more wasting time manually checking WoW AddOn websites and downloading addons.
World of Warcraft macros allow you to wedding dresses No more wasting time manually checking WoW AddOn websites and downloading addons.
World of Warcraft macros allow you to perform a combination of multiple actions by clicking a single action button and/or by using
The use of WoW macros can provide you with an advantage over someone who does not use them. wow gold However, just like WoW AddOns, all in-game macros are completely legal, so players do not get into trouble for using them.
We have compiled a series of useful WoW macros that you can choose from and copy and paste into aion power leveling your Macro window. Just select a macro category from the list above to begin. Enjoy!Preview of Zygor's leveling & talents guideI've been playing WoW quite a bit lately. After leveling up
to 64 on my troll hunter, my buddies rerolled to the new server, Cairne, because they didn't like their guild. I ended up joining them and casually leveled up another character, Alliance this time. A night elf hunter to be exact - like good ole' times.
My buddy John (aka Zygor) has been hard at work cranking out his new leveling guides. Luckily, I was able to rolex Replica convince him to give me a copy before everyone else gets their hands on it. He's also given me permission to show you some screenshots.
His guide is awesome. Especially for anyone that isn't very familiar with WoW or a certain race
WoW AddOn Installer and Updater that is completely safe to use and contains no keyloggers or spyware. No more wasting time manually checking WoW AddOn websites and downloading addons.
World of Warcraft macros allow you wow power leveling to perform a combination of multiple actions by clicking a single action button and/or by using a key binding.
of giving good detailed feedback as myself, maso, and others have been doing I will simply exclude my information from the forums. Its not being put to any use. I have nothing to guide me. I have no real hope for the class atm so instead i'm playing on my moonkin.
They could quite frankly archive all the posts on the entire warlock forum as it is right now and take it offline, like maso said we've said all we could have said over the past 3 months in multiple ways, anything we say from this point forward has already been said in futility.
They honestly dont seem to care anymore, the last real time they even posted asking for feedback was weeks ago on Meta, otherwise almost all the posts after have been just a buncha blabbing and sometimes didnt even make sense. CoR being to hardcore so we nerfed it - rofl or Master conjurer was gonna be a talent we wanted............ seriously you have to play the class a little to design for it. Any class can tell you that 0.15 increase in damage is terrible for talent point. And thats only on a certain type of spells.

I gave up on giving feedback and really even posting over a week ago, since nothing we have said has been looked at or changed in almost a month.
They would have to read our forums first, but it seem they have decided they have finished to interact with us and are moving on to do some small tweaks (nerfs) to piss us even more.

They want warlocks to reroll other classes. Its as simple as that. We putted a lot of good suggestions and they never acknowledged them and never used any of them.

I dare them to try some of out suggestions and see how they work so we have a chance to see if it would be viable. The game might be theirs but if the game dies they will have to answer to their shareholders xll.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表