I have recently acquired a GoPro Hero 7 Black. After the first more-than-a-few-seconds recording session, I found out that it splits the recording into multiple .MP4 files, each ~4 GB in size. After some quick research on the net I found out that this is called “chaptering”, and that it cannot be turned off. There were one-liners on how to merge these files with ffmpeg on Linux, for example in this article. I found those very helpful, but there was still too much manual work / typing involved for something that I would be doing pretty much every time I return home with a set of new recordings on the MicroSD card.
That’s why I sat down and wrote a little script, which automates the process a little better. No need to type out the file names of the video parts, plus the one of the resulting merged video file. Just tell the script the directory where it should store the resulting merged file(s), and it will process all videos on the MicroSD card automatically. If you want to skip some older recordings that you have not yet deleted from the MicroSD card, you can optionally give a date/time, and then the script will skip any files older than that.
So if you also want to work with GoPro-recorded videos on Linux, you might find this script useful. I’ve put it up on GitLab, feel free to modify it any way you want.
By the way, it might also work on Mac OS X. If anyone tries it out, please let me know 🙂
Update (2020-10-03): Thanks to Ralf, who tested the script on Mac OS X and found various issues! I took for granted that the basic utilities work the same as on Linux, but learned that they don’t. I’ve done some fixes now, and now it also works properly on Mac OS X 🙂 He also made me aware that my assumptions about the GoPro filename schema were wrong / incomplete. Now it should also work with H.264 recordings and even with recordings from older GoPro models that create “GOPR*.MP4” files. Hopefully I got the regexp right, didn’t do much testing, yet.
If you find any bugs, please also let me know, or even better, directly fix them and open a Merge Request on GitLab 😀
So here is the GitLab link: merge_gopro_mp4s.sh on GitLab
To simply use it, follow these instructions:
- Download the file
- Save it under /usr/local/bin or some other directory where you usually put scripts
- Make it executable (chmod 755 merge_gopro_mp4s.sh)
- Run it without parameter (or with -h, it does the same) and read the help text
Thank you. This worked perfectly for me 🙂
Thanks a lot for the feedback 😊 I guess you are the first user (other than me and Rhoenschrat, who helped me test) 😁
Please let me know if you find any issues, or have other improvement ideas.
I came across your post whilst searching around trying to avoid the exact same manual ffmpeg workflow. Worked great straight out of the box, I’ll be keeping your script handy in future!
Thanks a lot for the feedback 😊 Always nice to know someone is actually using it 🙂
That’s awesome, much faster and easier than merging them with any video editor.
Thanks a lot for that.
Thanks a lot 🙂 Let me know if you find any issues with it. I still use it regularly.
Actually, I just noticed, I now use a slightly different version which creates .MOV instead of .MP4. It’s also in the git repository.