具有相同质量输出的 Mencoder

xra*_*alf 7 ffmpeg conversion mencoder

我喜欢mencoder转换视频文件,因为它显示了转换结束还剩下多少时间(与 相反ffmpeg)。

mencoder file.wmv -ofps 23.976 -ovc lavc -oac copy -o file.avi
Run Code Online (Sandbox Code Playgroud)

问题是生成的文件与输入文件的质量不同。随着ffmpegsameq选择。是否有类似的选择mencoder来实现相同的质量?

这只是我的感觉,还是当我达到相同的质量时,mencoder 比 ffmpeg 快?

谢谢你

led*_*d42 11

好吧,首先...

ffmpeg 的 sameq 选项并不意味着相同的质量,并且在许多情况下不会做任何相关的事情。

这是来自 ffmpeg 手册页:

-sameq
       Use same quantizer as source (implies VBR).
Run Code Online (Sandbox Code Playgroud)

这个其实来自ffmpeg在线文档

‘-same_quant’
Use same quantizer as source (implies VBR).

Note that this is NOT SAME QUALITY. Do not use this option unless you know you need it.
Run Code Online (Sandbox Code Playgroud)

你可以在这里查看http://ffmpeg.org/ffmpeg.html,搜索 same_quant (它与 sameq 相同)。

好的,现在不碍事了,

我不确切知道您想要通过转换实现什么,但有两种可能性,我将列举并尝试提供帮助:

  1. 您只是在尝试更改Container而不是视频的编解码器。容器是一些数据,用于告诉尝试播放视频的软件如何组织事物,它包含有关 FPS、视频编解码器、音频编解码器以及数据如何存储的信息。如果您的视频是水,则容器可以是玻璃瓶、卡通瓶或塑料瓶。在这种情况下,容器是 wmv、avi、mp4、mov 等。容器很重要,因为不是所有的都支持所有的编解码器,也不是所有的软件都支持所有的容器。请记住,您仍然可以正确使用容器,但是如果里面的视频是错误的编解码器,那么您仍然不走运。因此,如果您只想更改容器,则可以使用:

        mencoder file.wmv -ofps 23.976 -ovc copy -oac copy -o file.avi
    
    Run Code Online (Sandbox Code Playgroud)
  2. 您正在尝试更改Codec。编解码器是一种算法或一组规范,它实际上说明了视频的编码方式,不同的编解码器具有不同的质量输出、大小、参数等。现在事情变得有点棘手,在更改容器时,您实际上可以复制视频而不是更改编解码器时会丢失任何质量(因为您只更改容器),您肯定会丢失一些质量,但大多数情况下,如果两个编解码器都很好并且配置了正确的参数,则在一次转换后您不会注意到太多(这是固有的)编解码器压缩视频的方式)。

我只能猜测 ffmpeg 和 mencoder 之间的不同质量,但必须发生两件事之一:

  1. 您只需要更改容器,而 ffmpeg 正在检测并且只复制视频。(如果是这种情况,请在 mencoder 上使用 -ovc copy)
  2. 您需要更改编解码器,而 ffmpeg 正在选择更好的编解码器/参数来重新压缩视频。在这种情况下,尝试检查 ffmpeg 正在使用什么编解码器(如果你不能在这里发布它们,我会看看)或尝试使用 mencoder 的不同代码(现在你没有指定任何内容)例如:

    mencoder file.wmv -ofps 23.976 -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o file.avi
    
    Run Code Online (Sandbox Code Playgroud)

这将使用 ISO 标准 MPEG-4(DivX 5,XVID 兼容),当然您可能仍然需要更改重新转换使用的比特率,查看源比特率将是一个很好的指标。

此外,mencoder 支持很多不同的库,有些是像 lavc 这样的多编解码器,有些则不支持,请尝试

mencoder -ovc help
Run Code Online (Sandbox Code Playgroud)

要获得支持的编解码器列表,我得到了:

MEncoder SVN-r33094-4.5.3 (C) 2000-2011 MPlayer Team

Available codecs:
   copy     - frame copy, without re-encoding. Doesn't work with filters.   
   frameno  - special audio-only file for 3-pass encoding, see DOCS.
   raw      - uncompressed video. Use fourcc option to set format explicitly.
   nuv      - nuppel video
   lavc     - libavcodec codecs - best quality!
   libdv    - DV encoding with libdv v0.9.5
   xvid     - XviD encoding
   x264     - H.264 encoding
Run Code Online (Sandbox Code Playgroud)

所以我可以这样做:

    mencoder file.wmv -ofps 23.976 -ovc xvid -oac copy -o file.avi
Run Code Online (Sandbox Code Playgroud)

或者

    mencoder file.wmv -ofps 23.976 -ovc x264 -oac copy -o file.avi
Run Code Online (Sandbox Code Playgroud)

对于较小的文件大小和较长的压缩时间