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

I pulled sd card from v3 and found bunch of ~40 thousands video clips, instead of one large mp4 file.
Is there any script perhaps to put these in one file?
Could someone share please

1 Like

There is a video file for every minute organized by hour and date. There are several programs that will stitch them together. There was a recent thread just a day or two ago here on that exact subject.

Here’s one such thread:

Others are easy to find using the Forum’s search feature, and in that particular thread I saw MP4Joiner recommended as a free cross-platform tool, but I haven’t yet taken the time to try that one. (You didn’t say what OS you’re trying to use for this.)

1 Like

Thank you for answering.
I guess what I am looking would be any OS script where I enter path to record folder and it does rest with ffmpeg.
Does dir /s/b work for you? Names of folders by date and files by time seem as organized correctly but video files creation dates do not correspond.
I am surprised there is no such script.
MP4Joiner does not offer such script, you would have to click thru every video file to build list.

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.

Yup that should do it :smiley:
You are lifesaver!
I am so bad with writing simplest script, usually spend hours to google syntax.

I dunno about that, but I genuinely appreciate the compliment and the :white_check_mark: solution vote! That makes me feel like I’ve been helpful. :upside_down_face:

Does that mean you were able to do what you wanted to do with the video files?

Some things I can do from memory, and I think I could probably brute-force (no error checking) script this in 4-5 lines, but search engines are definitely my friends, and don’t even start to ask me how to do this in Linux (yet). I tend to be a trial-and-error guy, and a DOS/Windows script I could cobble together pretty easily, though, I think, but there’s always more to learn. (PowerShell still isn’t on my list of those things.)