使用 FFmpeg 修剪过滤器修剪视频,同时保留其音频(使用 filter_complex) [英] Using a FFmpeg trim filter to trim a video, while preserving its audio (with filter_complex)

查看:40
本文介绍了使用 FFmpeg 修剪过滤器修剪视频,同时保留其音频(使用 filter_complex)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到达了可以剪切视频的部分

I reached a part where I can cut the video with

ffmpeg -i test.mp4 -filter_complex
'[0:v] trim=start=5:end=10,setpts=PTS-STARTPTS [cut]' -map [cut]  output.mp4

它成功地修剪了视频.但是,它完全删除了音频.我正在尝试链接几个不同的过滤器,所以我想保留类似的语法,只是为了以某种方式保留音频.

And it successfully trims the video. However, it completely removes the audio. I'm trying to chain a couple of different filters, so I'd like to keep the similar syntax, just to somehow preserve the audio.

推荐答案

音频的一个简单方法是声明输入两次并使用 -ss &-t,然后映射这个流:

A simple method for audio is to declare input twice and use -ss & -t, and then map this stream:

ffmpeg -i test.mp4 -ss 5 -t 5 -i test.mp4 -filter_complex 
'[0:v] trim=start=5:end=10,setpts=PTS-STARTPTS [cut]' -map [cut] -map 1:a -c:a copy output.mp4

这篇关于使用 FFmpeg 修剪过滤器修剪视频,同时保留其音频(使用 filter_complex)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆