# How to merge all 1min files into one video

**URL:** <https://forums.wyze.com/t/how-to-merge-all-1min-files-into-one-video/261833>\
**Category:** Cameras\
**Tags:** video, support\
**Created:** [March 13, 2023, 2:29pm UTC](https://forums.wyze.com/t/how-to-merge-all-1min-files-into-one-video/261833 "2023-03-13T14:29:27Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Crease](https://sea2.discourse-cdn.com/wyze/user_avatar/forums.wyze.com/crease/32/123254_2.png) [@Crease](https://forums.wyze.com/u/Crease)\
**Post date:** [May 6, 2024, 3:06am UTC](https://forums.wyze.com/t/how-to-merge-all-1min-files-into-one-video/261833/9 "2024-05-06T03:06:02Z")

</div>

> [@Customer](#):
>
> All you’d need to tweak is a sort parameter in your command, e.g., /od or /on.

I like @Customer’s suggestion of directory sorting, so I tried that:

`dir /b /od /s *.mp4 > list.txt`

Unfortunately, that didn’t quite give me the results that I wanted, because my output ended up looking like this:

```
T:\record\20240423\00\00.mp4
T:\record\20240423\00\01.mp4
T:\record\20240423\00\02.mp4
⋮
T:\record\20240505\20\15.mp4
T:\record\20240505\20\16.mp4
T:\record\20240505\20\17.mp4
T:\record\20240418\07\38.mp4
T:\record\20240418\07\39.mp4
T:\record\20240418\07\40.mp4
⋮
T:\record\20240422\23\57.mp4
T:\record\20240422\23\58.mp4
T:\record\20240422\23\59.mp4

```

This also happened when I used the `/on` switch for my `dir` command.

Since I was still on the command line, I just did this:

`sort list.txt /o list_sorted.txt`

That fixed the file order issue, so I might as well do it all with a single command, using a pipe:

`dir /b /s *.mp4 | sort /o list.txt`

Then instead of opening the sorted file in a text editor and doing two different find/replace operations, we can just stay on the command line and take care of it here:

`for /f %r in (list.txt) do echo file '%r' >> FFlist.txt`

Note that we changed the final output file name here to `FFlist.txt` for the FFmpeg format we’re going to use, but at this point we might as well just modify our command and do it all at once with the original file name:

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

That at least gets us to the point where we pass the work off to FFmpeg, but I haven’t yet taken the time to muck about with that in Windows. (My limited experience with it so far has been on Linux, and [in that instance I had to change the audio encoding to make it work](https://forums.wyze.com/t/how-to-save-footage-out-of-wyze-og-cam/293648/4).)

There are probably better and/or faster ways to do it (maybe PowerShell has some cool tool that makes it even easier; I haven’t ever taken the time to learn PowerShell), but I like trying to make friends with the regular ol’ DOS-like command line and use its built-in tools to make life easier. Of course, if this is something I intended to do on a regular basis, I’d just write a script or batch file to do everything in one go.

---

_[View the full topic](https://forums.wyze.com/t/how-to-merge-all-1min-files-into-one-video/261833)._
