Rich
Rich

Reputation: 55

How do I ffmpeg to iterate through 10,000+ datetime stamped files

I have a large number of jpgs captured from a cctv camera which I mistakenly used a dashed date time stamp in my curl command. The file names are

 Underwater-Cam-2017-10-20_17-58-22.jpg

If I do a wildcard I get

bash: /Applications/ffmpeg: Argument list too long

I understand from other posts that I don't want avoid the pattern being expanded using a glob, but I'm not sure how to iterate through these files with multiple sequential numbers. I tried this consecutive integer counting sequence which is in retrospect obviously not going to work, but I lack enough knowledge to resolve this through searching.

/Applications/ffmpeg -y -i '/path/to/src/2017-10-20/Underwater-Cam-2017-10-20_%02d-%02d-%02d.jpg' -r 24 -vf "scale=hd720" -metadata:s:v rotate=0 -vcodec libx265 -preset veryfast -crf 24 -an -movflags +faststart /path/to/dest/uwcam-2017-10-20.mp4

I'm doing this on a mac using bash 4.

Upvotes: 0

Views: 883

Answers (1)

cody
cody

Reputation: 11157

What about outputting the list to a file (without any globbing) and using ffmpeg's concat demuxer?

Example:

$ ls
Underwater-Cam-2017-10-20_17-58-21.jpg  Underwater-Cam-2017-10-20_17-58-23.jpg
Underwater-Cam-2017-10-20_17-58-22.jpg

$ find -type f -name '*.jpg' -printf '%P\n' | xargs -I {} echo "file '{}'" > list

$ cat list
file 'Underwater-Cam-2017-10-20_17-58-21.jpg'
file 'Underwater-Cam-2017-10-20_17-58-22.jpg'
file 'Underwater-Cam-2017-10-20_17-58-23.jpg'

And then ffmpeg -f concat -i list ... <output>

Upvotes: 3

Related Questions