热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

convertvideo/audiofiletoaudioformatwithffmpeg

ffmpegcanconvertbetweendifferentaudioformatsincludingMP3,AAC,AIFF,AU-SUN,DTS,WMA,M

ffmpeg can convert between different audio formats including MP3, AAC, AIFF, AU-SUN , DTS, WMA, M4A, 

MP2, RA, WAV, AAC, FLAC, OGG, APE.


FFmpeg mp3

This page describes how to use the "lame" encoder within ffmpeg to creates mp3's (ffmpeg apparently has no native mp3 encoder). See also other codecs you could use, and/orAACEncodingGuide for background on FFmpeg audio encoding in general.

VBR Encoding

Example to encode VBR MP3 audio with ffmpeg using the libmp3lame library:

ffmpeg -i input.wav -codec:a libmp3lame -qscale:a 2 output.mp3

Control quality with -qscale:a (or the alias -q:a). Values are encoder specific, so for libmp3lame the range is 0-9 where a lower value is a higher quality. 0-3 will normally produce transparent results, 4 (default) should be close to perceptual transparency, and 6 produces an "acceptable" quality. The option -qscale:a is mapped to the -V option in the standalone lame command-line interface tool.

LAME Bitrate Overview
Option Kbit/s Bitrate range kbit/s ffmpeg equiv.
-b 320 320 320 CBR (non VBR) example -b:a 320k (NB this is 32KB/s, or its max)
-V 0 245 220...260 -q:a 0 (NB this is VBR from 22 to 26 KB/s...)
-V 1 225 190...250 -q:a 1
-V 2 190 170...210 -q:a 2
-V 3 175 150...195 -q:a 3
-V 4 165 140...185 -q:a 4
-V 5 130 120...150 -q:a 5
-V 6 115 100...130 -q:a 6
-V 7 100 80...120 -q:a 7
-V 8 85 70...105 -q:a 8
-V 9 65 45...85 -q:a 9

In our example above, we selected -qscale:a 2, meaning we used LAME's option -V 2, which gives us a VBR MP3 audio stream with an average stereo bitrate of 170-210 kBit/s.

CBR Encoding

If you need constant bitrate (CBR) MP3 audio, you need to use the -b:a option instead of -qscale:a. Here you can specify the number of bits per second, for example -b:a 256k if you want 256 Kbit/s (25.6 KB/s) audio. Available options are: 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, or 320 (add a k after each to get that rate). So to get the highest quality setting, it would be like -b:a 320k.

Troubleshooting

Sometimes it will give you *less* bits per second than you request. If you're doing CBR, it could be because you chose a value "in between" its allowable settings (if defaults down to the next lower). If you're doing VBR, it could be because the input itself is already in a lower bitrate than the requested, in which case, it basically just re-encodes it at the bitrate the input already was. Or possibly that the input was CBR and the VBR aspect is able to reduce bitrate by quite a lot.




推荐阅读
  • 本文讨论了如何在codeigniter中识别来自angularjs的请求,并提供了两种方法的代码示例。作者尝试了$this->input->is_ajax_request()和自定义函数is_ajax(),但都没有成功。最后,作者展示了一个ajax请求的示例代码。 ... [详细]
  • Python中的PyInputPlus模块原文:https ... [详细]
  • 本文介绍了brain的意思、读音、翻译、用法、发音、词组、同反义词等内容,以及脑新东方在线英语词典的相关信息。还包括了brain的词汇搭配、形容词和名词的用法,以及与brain相关的短语和词组。此外,还介绍了与brain相关的医学术语和智囊团等相关内容。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • HDFS2.x新特性
    一、集群间数据拷贝scp实现两个远程主机之间的文件复制scp-rhello.txtroothadoop103:useratguiguhello.txt推pushscp-rr ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 【shell】网络处理:判断IP是否在网段、两个ip是否同网段、IP地址范围、网段包含关系
    本文介绍了使用shell脚本判断IP是否在同一网段、判断IP地址是否在某个范围内、计算IP地址范围、判断网段之间的包含关系的方法和原理。通过对IP和掩码进行与计算,可以判断两个IP是否在同一网段。同时,还提供了一段用于验证IP地址的正则表达式和判断特殊IP地址的方法。 ... [详细]
  • 本文讨论了编写可保护的代码的重要性,包括提高代码的可读性、可调试性和直观性。同时介绍了优化代码的方法,如代码格式化、解释函数和提炼函数等。还提到了一些常见的坏代码味道,如不规范的命名、重复代码、过长的函数和参数列表等。最后,介绍了如何处理数据泥团和进行函数重构,以提高代码质量和可维护性。 ... [详细]
  • 使用圣杯布局模式实现网站首页的内容布局
    本文介绍了使用圣杯布局模式实现网站首页的内容布局的方法,包括HTML部分代码和实例。同时还提供了公司新闻、最新产品、关于我们、联系我们等页面的布局示例。商品展示区包括了车里子和农家生态土鸡蛋等产品的价格信息。 ... [详细]
  • 本文介绍了Java类的访问级别,包括public、private、protected和package-private,并重点解释了package-private的含义和作用。package-private表示类只能在其所在的包内可见,而不能被其他包的类访问。该文章还提到了其他访问级别的作用和范围,并对Java类的可见性进行了详细说明。 ... [详细]
  • Introduction(简介)Forbeingapowerfulobject-orientedprogramminglanguage,Cisuseda ... [详细]
  • 本博文基于《Amalgamationofproteinsequence,structureandtextualinformationforimprovingprote ... [详细]
  • Non-ASCIIhelponitsownisOK: ... [详细]
author-avatar
紫青郝_385
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有