How do you convert an entire directory with ffmpeg?

前端 未结 26 2099
长发绾君心
长发绾君心 2020-11-22 04:33

How do you convert an entire directory/folder with ffmpeg via command line or with a batch script?

26条回答
  •  广开言路
    2020-11-22 05:15

    Another simple solution that hasn't been suggested yet would be to use xargs:

    ls *.avi | xargs -i -n1 ffmpeg -i {} "{}.mp4"

    One minor pitfall is the awkward naming of output files (e.g. input.avi.mp4). A possible workaround for this might be:

    ls *.avi | xargs -i -n1 bash -c "i={}; ffmpeg -i {} "\${i%.*}.mp4""

提交回复
热议问题