简体   繁体   English

如何使用ffmpeg将目录中的所有视频有序合并?

[英]How to use ffmpeg merge all the videos in the catalog in an orderly manner?

I have a lot of regular video clips 1.mp4 2.mp4 ... 11.mp4我有很多常规视频剪辑 1.mp4 2.mp4 ... 11.mp4

I use command below to combine all the clips:我使用下面的命令来组合所有剪辑:
ffmpeg -f concat -safe 0 -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy -pix_fmt yuv420p -r 30 all.mp4

But the sequence will be disordered, For example, the file #1 is not file #2, but file #11。但是顺序会乱,比如文件#1不是文件#2,而是文件#11。

how can I correctly merge according to the number size sequence?如何根据数字大小序列正确合并?

添加 sort -V 如下:

ffmpeg -f concat -safe 0 -i <(for f in ./*.webm; do echo "file '$PWD/$f'"; done | sort -V) -c copy -pix_fmt yuv420p -r 30 output.webm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bash-如何按顺序格式化文件? - Bash - How to format file in orderly manner? FFmpeg如何使用bash生成视频序列 - FFmpeg how generate a sequence of videos with bash 如何合并 4 个透明视频,使它们堆叠在一起 - How to merge 4 transparent videos so they stack together 如何使用ffmpeg和shaka-packager优化编码和打包视频 - How to optimize encoding and packaging videos using ffmpeg and shaka-packager FFmpeg如何拼接视频和output相同的文件前缀 - How does FFmpeg concat videos and output same file prefix 是否可以使用FFmpeg从视频文件夹中剪切“随机”部分并将其合并为1个视频? - Is it possible to use FFmpeg to cut “random” sections from a folder of videos and concat them into 1 video? 如何以有序的方式粘贴多个文件中的列? - How to paste columns from multiple files in an orderly way? 如何为Android设备的所有体系结构构建FFMPEG? - How to build FFMPEG for all architecture of android device? 如何在终端循环中运行 ffmpeg 以使用每个子目录中的文件生成视频 - How to run ffmpeg in a loop in the terminal to generate videos using files from every subdirectory 合并视频FFMPEG时出错“没有这样的过滤器&#39;&#39;” - Error “ No such filter '' ” while merging videos FFMPEG
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM