ffmpeg concat 过滤器正在丢弃第二个视频的第一秒
con.txt
file one.mp4
file two.mp4
该命令
ffmpeg -f concat -safe 0 -i con.txt out.mp4
生成的视频不包含 two.mp4
的第一秒。
ffprobe Two.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'two.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
Duration: 00:00:15.20, start: 0.000000, bitrate: 1644 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 428x640, 1644 kb/s, 10 fps, 10 tbr, 10240 tbn, 20 tbc (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
我在尝试另一种串联方法时遇到一个有趣的错误(顺便说一句,两个视频都没有音频)
ffmpeg -i one.mp4 -i Two.mp4 -filter_complex "[0:v] [ 1:v] concat=n=2:v=1:a=0 [v]" -map "[v]" out.mp4
输入链接 in0:v0 参数(大小 428x640,SAR 0:1)与相应的输出链接 in0:v0 参数(428x640,SAR 1576:1575)不匹配
如何将这两个视频按顺序连接在一起而不丢失任何帧?
con.txt
file one.mp4
file two.mp4
The command
ffmpeg -f concat -safe 0 -i con.txt out.mp4
produces a video that doesn't contain the first second of two.mp4
.
ffprobe two.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'two.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
Duration: 00:00:15.20, start: 0.000000, bitrate: 1644 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 428x640, 1644 kb/s, 10 fps, 10 tbr, 10240 tbn, 20 tbc (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
I get an interesting error attempting another concatenation method (neither video has audio btw)
ffmpeg -i one.mp4 -i two.mp4 -filter_complex "[0:v] [1:v] concat=n=2:v=1:a=0 [v]" -map "[v]" out.mp4
Input link in0:v0 parameters (size 428x640, SAR 0:1) do not match the corresponding output link in0:v0 parameters (428x640, SAR 1576:1575)
How can I join these two videos together sequentially without losing any frames from either?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
concat 过滤器期望连接的流具有相同的属性(大小、样本宽高比 (SAR)、pix_fmt 等)。错误消息表明 SAR 不匹配。您可以在
concat
过滤器上游插入setsar
过滤器来解决此问题。假设这些视频具有方形像素(1576:1575 非常接近 1:1),我们可以这样做:如果出现其他错误,则需要预先添加更多过滤器来调节流以相互匹配。
编辑:向第二个视频 (10 fps) 添加了
fps
过滤器以匹配第一个视频 (30 fps)The
concat
filter expects the streams to be concatenated to have the identical properties (size, sample aspect ratio (SAR), pix_fmt, etc.). The error message is saying that SARs are not matching up. You can insertsetsar
filters upstream ofconcat
filter to resolve this. Assuming these videos have square pixels (1576:1575 is pretty darn close to 1:1), we can do this:If you get other errors, you need to prepend more filters to condition your streams to match each other.
Edit: Added
fps
filter to the second video (10 fps) to match the first (30 fps)