How to compile video clips from sd card into one long mp4 file?

You’re welcome!

Work in what sense? Since you’re asking me about dir /s /b, I’ll operate under the assumption that you’re using Microsoft Windows until you correct me. :grin:

That’s part of the command that was recommended by @steemium in the original post to generate a list of video files that would then be edited and fed to FFmpeg. When I decided to play around with it, I agreed that those were the switches I’d use with the dir command—/b for bare format and /s to include results from subdirectories—but the file list that the command generated didn’t give me everything I wanted in order, even if I added /od or /on to order my file list by date or name, so I eventually came up with this:

for /f %r in ('dir /b /s *.mp4 ^| sort') do echo file '%r' >> file.txt

That takes a little longer to run when I have a lot of files, but it sorts everything for me according to date and time and doesn’t require additional editing to get it ready to feed to FFmpeg. (I described my process for getting to that point in post #9 in that topic.)

Assuming that file.txt either doesn’t exist or is empty when you start, that should generate a complete list of files—in chronological order—that FFmpeg can use.

That seems like it’d be pretty easy to do, and I noted in my post (in the other topic) that writing a script (e.g., a .CMD file) is probably how I’d do it if it was something I needed to do on a routine basis. I just haven’t had that need, so I haven’t played around with it, but I could probably tinker with it later when I’m on a Windows machine (I’m using Linux at present) if you still need help. Since you mentioned wanting a script that uses FFmpeg, I’ll just leave it at this for now (the single command I noted above) for you to generate the list of video files, and I’d also note that the one time I played with FFmpeg to concatenate video files from a Wyze camera, I had to change the audio encoding in order to get the command to work.

Thinking some more….

Now that I’m looking at a Windows command reference for dir, I’m wondering if the list creation could just be simplified to for /f %r in ('dir /b /s /t *.mp4') do echo file '%r' >> file.txt. I might have to play with this some more…. :thinking:

I don’t (yet) have any experience with that one. I mentioned it only because it was a free cross-platform solution suggested by another post in that topic. If it’s all GUI, then that could get tedious to use pretty quickly, especially if your goal is to regularly process a large number of individual video files.