I'm trying to convert all files in folders given by
allFolders.txt
> head folderNames.txt
0001
0002
0003
0004
0005
...
to a video using ffmpeg
ffmpeg version 2.2.3 Copyright (c) 2000-2014 the FFmpeg developers built on Apr 20 2015 13:38:52 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/home/myUsername/usr/local --enable-nonfree --enable-gpl --enable-pic --enable-shared --enable-libx264 --disable-vaapi
According to some answers here on stackoverflow I wrote the following bash script:
#!/bin/bash
while read p; do
cd "$p"
ffmpeg -f concat -i "allImgNames.txt" -framerate 30 -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4
cd -
done < folderNames.txt
where allImgNames.txt
is a text file containing all the image names.
The strange thing is that it works for a few videos but for the rest of the filelist it fails saying allImgNames.txt: No such file or directory
, which is not true. I checked all paths several times. Also I can execute the ffmpeg ...
command above manually without problems.
I don't know what I'm doing wrong. All file / folder names are normal (no special characters). Maybe I don't understand enough about bash or ffmpeg.