【问题标题】:FFMPEG multiple file pattern not working in single commandFFMPEG 多文件模式在单个命令中不起作用
【发布时间】:2019-08-10 02:43:03
【问题描述】:

我想在单个 ffmpeg 命令中添加多个文件序列,下面是我的代码,正在创建视频但只使用第一个图像序列,第二个被忽略

ffmpeg -y -i input.mp4 -start_number 0000001 -i 1/%07d.png -i 2/%07d.png -filter_complex "[0][1]overlay=x=10:y=10:enable='between(t,0,3)'[v1];[v1][2]overlay=x=10:y=10:enable='between(t,3.8561422222222,6.9761777777778)'[v2]" -map "[v2]" -map 0:a out.mp4

现在的问题是 FFMPEG 想要连续的图像,我没有我在每个文件夹中都有从 0000001.png 开始的图像,我怎样才能在不改变图像的情况下做到这一点

【问题讨论】:

  • @llogan 你能帮我解决这个问题吗?
  • 第二个序列有多少张图片?
  • @Gyan 将有任意数量的可用图像

标签: ffmpeg filepattern


【解决方案1】:

尝试使用 glob 模式来处理不一致的编号并用 setpts 填充 PTS,这样覆盖层在显示之前就不会被消耗:

ffmpeg -y -i input.mp4 -pattern_type glob -i "1/*.png" -pattern_type glob -i "2/*.png" -filter_complex "[0][1]overlay=x=10:y=10:enable='between(t,0,3)'[v1];[2]setpts=PTS+3.856/TB[fg];[v1][fg]overlay=x=10:y=10:enable='between(t,3.8561422222222,6.9761777777778)'[v2]" -map "[v2]" -map 0:a out.mp4

【讨论】:

  • PTS+3.856 --> PTS+3.856/TB
【解决方案2】:

你能把图片传送到-f image2pipe吗?

cat $(find 1 2 -name '*.png' -print) | ffmpeg -y -i input.mp4 \
-f image2pipe -vcodec png -i - \    
-filter_complex "[0][1]overlay=x=10:y=10:enable='between(t,0,3)'[v1];[v1][2]overlay=x=10:y=10:enable='between(t,3.8561422222222,6.9761777777778)'[v2]" \
-map "[v2]" -map 0:a out.mp4

【讨论】:

  • @l-scott-johnson Invalid file index 2 in filtergraph description [0][1]overlay=x=10:y=10:enable='between(t,0,3)'[v1];[v1][2]overlay=x=10:y=10:enable='between(t,3.8561422222222,6.9761777777778)'[v2]
  • 尝试将其分解(即,删除地图、删除 filter_complex、删除第一个输入等,直到你有一个工作部分,然后重新构建它。)
猜你喜欢
  • 1970-01-01
  • 2020-01-28
  • 2021-12-12
  • 2020-06-05
  • 1970-01-01
  • 2020-01-21
  • 2012-04-24
  • 1970-01-01
  • 2014-05-03
相关资源
最近更新 更多