ffmpeg -ss 0 -t 8 -i input.mp4 -acodec copy -vcodec copy output.mp4
可以设置编解码器。但是,要过滤:
ffmpeg -i input.mp4 -vf crop=100:100:0:0 output.mp4
如果结合使用:
Filtergraph 'crop=100:100:0:0' was defined for video output stream 0:0 but codec copy was selected.
Filtering and streamcopy cannot be used together.
如何设置编解码器(如时间片段)?
答案 0 :(得分:2)
过滤要求将输入视频完全解码为原始视频,然后由过滤器处理原始视频,然后对其进行编码:
_______ ______________
| | | |
| input | demuxer | encoded data | decoder
| file | ---------> | packets | -----+
|_______| |______________| |
v
_________
| |
| decoded |
| frames |
|_________|
|
v
__________
| |
| filtered |
| frames |
|__________|
________ ______________ |
| | | | |
| output | <-------- | encoded data | <----+
| file | muxer | packets | encoder
|________| |______________|
流复制模式省略了解码和编码:
_______ ______________ ________
| | | | | |
| input | demuxer | encoded data | muxer | output |
| file | ---------> | packets | -------> | file |
|_______| |______________| |________|
因此,无法同时过滤和复制流。但是,可以在过滤其他流的同时流复制未过滤的流。过滤视频和流复制音频的示例:
ffmpeg -i input -filter_complex "[0:v]scale=iw/2:-1[v]" -map "[v]" -map 0:a -c:a copy output
有关更多信息,请参见ffmpeg
documentation。