ffmpeg 截取切割视频报错

在用ffmpeg来截取只有视频没有音频的mp4文件时,有一些视频可以切割,少部分不能分割,遇到到了bug。

截取命令:

cd D:\ffmpeg\bin>
ffmpeg -ss 370 -to 389 -i 01.mp4 -y -f mp4 -vcodec copy  -q:v 1  output.mp4

报错如下:

[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mp3float @ 0000022b8220d300] Header missing

[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mpeg @ 0000022b8218dcc0] Packet corrupt (stream = 0, dts = 37275057).
01.mp4: corrupt input packet in stream 0
[mp3float @ 0000022b8220d300] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[abuffer @ 0000022b830c9100] Value inf for parameter 'time_base' out of range [0 - 2.14748e+09]
    Last message repeated 3 times
[abuffer @ 0000022b830c9100] Error setting option time_base to value 1/0.
[graph_0_in_0_1 @ 0000022b827ab240] Error applying options to the filter.
Error reinitializing filters!
Error while filtering: Result too large
Finishing stream 0:1 without any data written to it.
[abuffer @ 0000022b830c9640] Value inf for parameter 'time_base' out of range [0 - 2.14748e+09]
    Last message repeated 3 times
[abuffer @ 0000022b830c9640] Error setting option time_base to value 1/0.
[graph_0_in_0_1 @ 0000022b827ab240] Error applying options to the filter.
Error configuring filter graph
Conversion failed!

解决方法:

增加 -an 参数。

ffmpeg -ss 370 -to 389 -i 01.mp4 -y -f mp4 -vcodec copy -acodec copy -q:v 1 -an output.mp4

附ffmpeg参数含义:

'''
-ss 指定要截取的视频的起始时间。

-to 指定要截取的视频的终止时间。

-i 输入文件,这里指的就是视频文件。

-y 表示无需询问,直接覆盖输出文件(如果有原文件的话)。

-f 指定输出视频的格式。

-acodec 指定音频编码格式。copy表示编码格式不发生改变,直接复制原来的编码格式,这样会大大提升速度。

-vcodec 指定视频编码格式。copy表示编码格式不发生改变,直接复制原来的编码格式,这样会大大提升速度。

-q:v 1 q是质量,v是视频,v的取值范围是[1, 35],取值1的时候,对应着最佳的视频质量。

-an:a代表音频,n代表no an就是无音频的意思

'''

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

圆滚熊

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值