FFmpeg有哪些常用命令?
时间: 2024-10-11 11:00:42 浏览: 44
FFmpeg的常用命令包括但不限于以下几个:
1. `ffmpeg -i input.mp4 output.mp4`: 这是最基本的视频转码命令,将输入的input.mp4视频转换成output.mp4。
2. `ffmpeg -i audio.wav -acodec copy output.mp3`: 无损音频拷贝,将wav文件转换成mp3格式。
3. `ffmpeg -i input.webm -vf scale=-1:720 output.mp4`: 视频缩放,保持宽高比,将webm格式的视频调整为720p。
4. `ffmpeg -i webcam.mpg -f mpegts | mplayer -`: 实时捕获摄像头并播放。
5. `ffprobe -i input.mp4`: 查询文件的信息,比如帧率、大小等。
6. `ffmpeg -i input.mp4 -ss start_time -t duration -c copy segment.mp4`: 截取视频的一部分作为单独文件。
每个命令后面都可以附加更多的选项来定制特定的需求。记住,在使用时需要确保所有的依赖项已经安装,并且FFmpeg的路径添加到系统的PATH环境变量中。
相关问题
FFmpeg API有哪些常用示例?
FFmpeg是一个强大的多媒体处理框架,它提供了一套API,允许开发者进行音频、视频的编码、解码、流媒体处理等操作。以下是一些常用的FFmpeg API 示例:
1. **转码视频**:
```bash
ffmpeg -i input.mp4 -c:v libx264 -preset slow -crf 23 -c:a aac output.mp4
```
这个命令将输入视频转换为H.264编码,并压缩音频为AAC。
2. **截取视频帧**:
```bash
ffmpeg -i input.mp4 -vf "select=eq(n\,0)" -vsync vfr frame%03d.jpg
```
这会从视频中选取第一帧并保存为图片序列。
3. **合并音频文件**:
```bash
ffmpeg -i sound1.wav -i sound2.wav -filter_complex "[0:a]adelay=500|500[a1];[1:a][a1]amix=inputs=2" mixed_audio.mp3
```
混合两个音频文件并延迟其中一个500毫秒。
4. **抓取网络流(直播)**:
```bash
ffmpeg -i "rtmp://example.com/live/stream" -c copy recorded_video.mp4
```
实时捕获RTMP直播流并保存为本地视频文件。
ffmpeg常用命令汇总
FFmpeg是一个开源的跨平台音视频处理工具,它可以用来录制、转换和流式传输音视频。以下是一些常用的FFmpeg命令汇总:
1. 视频转码:ffmpeg -i input.mp4 output.avi
2. 视频剪辑:ffmpeg -ss 00:00:10 -t 00:00:30 -i input.mp4 -acodec copy -vcodec copy output.mp4
3. 视频截图:ffmpeg -i input.mp4 -ss 00:00:10 -vframes 1 output.jpg
4. 视频合并:ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0]concat=n=2:v=1:a=1" output.mp4
5. 视频加水印:ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=10:10" output.mp4
6. 视频转GIF:ffmpeg -i input.mp4 -vf "scale=320:-1,fps=10,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif
阅读全文
相关推荐














