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
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.)
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.
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….
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
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 solution vote! That makes me feel like I’ve been helpful.
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.)
I thought I would add this version here, since it is the most recent post on this topic, and it took me a while to find and figure out. It’s a mix of posts here, various websites and a bit of my own tweaking, and includes links to needed files.
Set up takes a few minutes, but once you set this up, it’s a one step method, builds a properly format text file for FFMPEG and creates the video.
Requirements:
- Powershell - like the Command prompt - uses CD, DIR etc. - but does more.
- FFMPEG
- Editing your path statement
- VLC Media Player (optional)
I had added specific links, but the forums won’t let me post more than two, even when I only had two - lol - so I put them here: https://www.pastanuts.com/wyze/
Setup:
- Install Powershell if you don’t already have it.
- Install FFMPEG if you don’t already have it
- Add your FFMPEG folder name/path to the windows Path statement:
- In Windows search for “path” and click “Edit the system environment variables”
- Click Advanced->Environment variables (bottom of Window)
- Under User Variables, click Path, then click Edit
- Click New and add the path to your FFMPEG folder.
- Click OK until the dialog boxes are all closed.
- Reboot.
How to use:
Any time you need to combine video files, open Powershell and navigate folder where your SD day/hour/minute files are stored then copy and paste the following (both lines at once) into Powershell.
Get-ChildItem -Filter *.mp4 -Recurse | % { "file '" + $_.FullName + "'"} > vidlist.txt
ffmpeg -safe 0 -f concat -i vidlist.txt -c copy combined.mkv
That’s it. Go to the folder with your files and copy/paste that in Powershell, and boom, done.
I wanted quick/easy because I’m running this for two cameras at least once a day, tracking a rat. And this way I won’t lose it if I switch computers. lol.
For viewing, I use VLC player because it has easy controls for scanning videos.
- Speed up/slow down: Numberpad + and - across a wide range of speeds. 32x helps when slogging through hours of video.
- Forward/back: Left/right arrow alone (10 secs) or with shift (3 secs), control (1 minute) or control-alt (5 minutes)
- Spacebar to stop and start.
Hope this helps someone.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.