ffmpeg 音频常用命令
ffmpeg的使用方式: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Stream specifier
Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers are used to precisely specify which stream(s) a given option belongs to.
A stream specifier is a string generally appended to the option name and separated from it by a colon. E.g. -codec:a:1 ac3 contains the a:1 stream specifier, which matches the second audio stream. Therefore, it would select the ac3 codec for the second audio stream.
A stream specifier can match several streams, so that the option is applied to all of them. E.g. the stream specifier in -b:a 128k matches all audio streams.
An empty stream specifier matches all streams. For example, -codec copy or -codec: copy would copy all the streams without reencoding.
Possible forms of stream specifiers are:
- stream_index
-
Matches the stream with this index. E.g.
-threads:1 4would set the thread count for the second stream to 4. - stream_type[:stream_index]
-
stream_type is one of following: ’v’ or ’V’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data, and ’t’ for attachments. ’v’ matches all video streams, ’V’ only matches video streams which are not attached pictures, video thumbnails or cover arts. If stream_index is given, then it matches stream number stream_indexof this type. Otherwise, it matches all streams of this type.
- p:program_id[:stream_index] or p:program_id[:stream_type[:stream_index]] or
-
p:program_id:m:key[:value] In first version, if stream_index is given, then it matches the stream with number stream_index in the program with the id program_id. Otherwise, it matches all streams in the program. In the second version, stream_type is one of following: ’v’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data. If stream_index is also given, then it matches stream number stream_index of this type in the program with the id program_id. Otherwise, if only stream_type is given, it matches all streams of this type in the program with the id program_id. In the third version matches streams in the program with the id program_id with the metadata tag key having the specified value. If value is not given, matches streams that contain the given tag with any value.
- #stream_id or i:stream_id
-
Match the stream by stream id (e.g. PID in MPEG-TS container).
- m:key[:value]
-
Matches streams with the metadata tag key having the specified value. If value is not given, matches streams that contain the given tag with any value.
- u
-
Matches streams with usable configuration, the codec must be defined and the essential information such as video dimension or audio sample rate must be present.
Note that in
ffmpeg, matching by metadata will only work properly for input files.
General options
-version
Show version.
-formats
Show available formats (including devices).
-demuxers
Show available demuxers.
-muxers
Show available muxers.
-devices
Show available devices.
-codecs
Show all codecs known to libavcodec.
Note that the term ’codec’ is used throughout this documentation as a shortcut for what is more correctly called a media bitstream format.
-decoders
Show available decoders.
-encoders
Show all available encoders.
-bsfs
Show available bitstream filters.
-filters
Show available libavfilter filters.
-sample_fmts
Show available sample formats.
-layouts
Show channel names and standard channel layouts.
Main options
-f fmt (input/output)
Force input or output file format. The format is normally auto detected for input files and guessed from the file extension for output files, so this option is not needed in most cases.
-i url (input)
input file url
-y (global)
Overwrite output files without asking.
-n (global)
Do not overwrite output files, and exit immediately if a specified output file already exists.
-c[:stream_specifier] codec (input/output,per-stream)-codec[:stream_specifier] codec (input/output,per-stream)
Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams. codec is the name of a decoder/encoder or a special value copy (output only) to indicate that the stream is not to be re-encoded.
-dframes number (output)
Set the number of data frames to output. This is an obsolete alias for -frames:d, which you should use instead.
-frames[:stream_specifier] framecount (output,per-stream)
Stop writing to the stream after framecount frames.
-q[:stream_specifier] q (output,per-stream)-qscale[:stream_specifier] q (output,per-stream)
Use fixed quality scale (VBR). The meaning of q/qscale is codec-dependent. If qscale is used without a stream_specifier then it applies only to the video stream, this is to maintain compatibility with previous behavior and as specifying the same codec specific value to 2 different codecs that is audio and video generally is not what is intended when no stream_specifier is used.
-filter[:stream_specifier] filtergraph (output,per-stream)
Create the filtergraph specified by filtergraph and use it to filter the stream.
filtergraph is a description of the filtergraph to apply to the stream, and must have a single input and a single output of the same type of the stream. In the filtergraph, the input is associated to the label in, and the output to the label out. See the ffmpeg-filters manual for more information about the filtergraph syntax.
See the -filter_complex option if you want to create filtergraphs with multiple inputs and/or outputs.
Audio Options
-aframes number (output)
Set the number of audio frames to output. This is an obsolete alias for -frames:a, which you should use instead.
-ar[:stream_specifier] freq (input/output,per-stream)
Set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options.
-aq q (output)
Set the audio quality (codec-specific, VBR). This is an alias for -q:a.
-ac[:stream_specifier] channels (input/output,per-stream)
Set the number of audio channels. For output streams it is set by default to the number of input audio channels. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options.
-an (output)
Disable audio recording. For full manual control see the -map option.
-acodec codec (input/output)
Set the audio codec. This is an alias for -codec:a.
-sample_fmt[:stream_specifier] sample_fmt (output,per-stream)
Set the audio sample format. Use -sample_fmts to get a list of supported sample formats.
-af filtergraph (output)
Create the filtergraph specified by filtergraph and use it to filter the stream.
This is an alias for -filter:a,
常用命令:
提取视频中的音频:
ffmpeg -i input.mp4 -acodec copy -vn output.aac
如果stream红包含多个音频(多个PID),使用map指定要提取的音频。
ffmpeg -i xxx.ts -map 0:1 -acodec copy -vn output.ac3
解码音频:
ffmpeg -i input.aac -ar 48000 -ac 2 output.wav
编码:
ffmpeg -i input.wav output.ac3
ffmpeg 音频常用命令的更多相关文章
- FFMPEG 音频转换命令
音频转换: .转换amr到mp3: ffmpeg -i shenhuxi.amr amr2mp3.mp3 .转换amr到wav: ffmpeg -acodec libamr_nb -i shenhux ...
- ffmpeg CLI常用命令
使用-copy参数: CLI压缩视频时保持音频不变
- FFmpeg 常用命令收集
FFmpeg 常用命令 合并视频 ffmpeg -i "KTDS-820A_FHD.mp4" -c copy -bsf:v h264_mp4toannexb -f mpegts i ...
- ffmpeg 常用命令汇总
最近工作常用到ffmpeg 做一些视频数据的处理转换等,用来做测试,今天总结了一下,并参考了网上一些部分朋友的经验,一起在这里汇总了一下,有需要的朋友可以收藏测试一下,有问题可以回帖交流. 1.ffm ...
- 第二章 FFmpeg常用命令
2.1 FFmpeg常见的命令大概分为6个部分 ffmpeg信息查询部分 公共操作参数部分 文件主要操作参数部分 视频操作参数部分 字幕操作参数部分 2.1.1 FFmpeg的封装转换 FFmpeg ...
- FFMpeg 常用命令格式转换,视频合成
FFmpeg都是命令行的,用起来肯定不方便.但是,这对技术宅应该不成问题.下面,我就罗列一些比较实用的使用方法吧. FFmpeg的下载与安装 FFmpeg是开源的.但我们不必去下载它的源代码.下载已经 ...
- ffmpeg常用命令-学习
文章标题:FFmpeg常用命令合集 文章地址:https://blog.csdn.net/lemon_tree12138/article/details/99719520
- FFmpeg常用命令学习笔记(二)录制命令
录制命令 1.FFmpeg录屏命令 ffmpeg -f avfoundation -i 1 -r 30 out.yuv -f:指定使用avfoundation采集数据 -i:指定从哪采集数据,它是一个 ...
- ffmpg常用命令解析
1 相关学习官网地址 官网地址:https://www.ffmpeg.org 安装步骤:https://www.johnvansickle.com/ffmpeg/faq/ 2 涉及的常用命令 视频格式 ...
随机推荐
- Firefox下载.net服务器文件时中文乱码
ASP.NET中产生一个Excel报表,供浏览器下载.显然,下载时经常有汉字报表名称.针对当前的两个主流的浏览器IE和Firefox,似乎没有兼容的解决办法.网上搜索了一些解决方法,但在Firefox ...
- PP: Deep clustering based on a mixture of autoencoders
Problem: clustering A clustering network transforms the data into another space and then selects one ...
- ISCC2018 Reverse & Pwn writeup
Reference:L1B0 Re RSA256 春秋欢乐赛原题..flag都不变的 给了三个加密文件和公钥证书public.key,可以使用openssl进行处理 $openssl rsa -pub ...
- 一道CTF针对XXE漏洞的练习
题目链接:http://web.jarvisoj.com:9882/ 目的很明确获取/home/ctf/flag.txt的内容 一般读取目标机的本地文件都会用到file协议. 思路: 那么思路一:文件 ...
- MySql 中IFNULL、ISNULL、NULLIF用法(数据库判空)
来源:http://blog.csdn.net/a466350665/article/details/52994761 http://blog.csdn.net/xingyu0806/article/ ...
- SSM项目集成Lucene+IKAnalyzer在Junit单元测试中执行异常
个人博客 地址:http://www.wenhaofan.com/article/20181108132519 问题描述 在项目运行以及main方法中能够正常运行,但是使用junit单元测试时却报如下 ...
- 自定义Ribbon客户端策略
说明 为了实现Ribbon细粒度的划分,让调用不同的微服务时采用不同的客户端负载均衡策略, 通常情况下我们会自定义配置策略. 本文以内容中心(content-center)调用户中心微服务(u ...
- http接口的调用
1.按照文档先写入参数,这里主要介绍 Json格式的String字符串,包括拼接数组 String sqr_arry [] = new String[rowList.size()]; for(int ...
- View -->Controller传值的几种方法
1.参数名称必须和表单的name是一致的. //参数的名称需要和表单的字段名称一致,这样系统便会直接赋值. public ActionResult GetUserInfo(string usernam ...
- 自己动手系列----使用数组实现一个简单的Set
Set:注重独一无二的性质,该体系集合可以知道某物是否已近存在于集合中,不会存储重复的元素用于存储无序(存入和取出的顺序不一定相同)元素,值不能重复.主要有HashSet和TreeSet两大实现类. ...