Ask a Question
GoPro Support Hub Ask a question. Share an answer. Find a solution. Stay stoked.
Announcements
Is your GoPro gear up to date? Check to see If it is on our Update page.
GoPro Apps for Desktop
Reply
Hiker
Posts: 104

Re: How do I simply join all the split up video clips.

[ New ]

Chaptering, not chattering. --bleep-- Apple phone.

Tourist
Posts: 5

Re: How do I simply join all the split up video clips.

[ New ]
Great point! Now if only someone in customer service can respond with some feedback on this insane "feature". Give us the option to fix this engineer screwup!
Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]
This is ridiculous with 4K 60 or 5K clips there is only about 5 minutes of recording before splitting occurs. If GoPro cannot provide a simple solution to rejoining the clip there should be memory included with the camera so the 4GB limit is avoided
Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

Completely agree. This thread needs more attention. People should start blasting this in forums and social media sites until GoPro actually realizes that it's a problem that needs to be fixed.

Tourist
Posts: 5

Re: How do I simply join all the split up video clips.

[ New ]

Frankly I doubt they give a #$%*. I'm just blown away how GoPro can pass this as "feature" when it's clearly a bad file system implementation within the camera's.  I love the GoPro hardware, but I may just need to look at Sony. What a joke!

Hiker
Posts: 104

Re: How do I simply join all the split up video clips.

[ New ]
I wish Sony had a decent action cam or any cam with comparable stabilization. They don’t or I world have bought it already.
Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

Totally agree GoPro should provide either a chapterless option or a small peice of software that joins (ideally without re-encoding).

 

My solution for quickly joining clips is to use Adobe Media Encoder, yes it re-encodes but that actually works for me since I need to turn around and upload these quickly.  Encoding and reducing size and uploading that file is quicker than waiting for all the clips to upload.

 

Here is more on how do combine files using Adobe Media Encoder https://helpx.adobe.com/in/media-encoder/user-guide.html/in/media-encoder/using/overview-media-encod...

Sightseer
Posts: 3

Re: How do I simply join all the split up video clips.

[ New ]
I bought the gopro 9 to find the same lame splitting every 9 minutes. I dont think i would have bought it if i knew about the 4gb splitting.
Sightseer
Posts: 3

Re: How do I simply join all the split up video clips.

[ New ]

I found a SOLUTION

PowerDirector 19 has an option where it simply merges videos without loosing or altering the original quality.

Its expensive to purchase... unless you know how to look for it... wink wink

 

https://www.youtube.com/watch?v=UhZwUJs9x_M

 

Videos are merged seamlessly 

 

Hope this helps

PowerDirector lets you realize your creative ideas, turning them into artworks you'll really want to share. Packed with editing features, and creative tools ...
Nomad
Posts: 310

Re: How do I simply join all the split up video clips.

[ New ]

i refuse to pay for software which is a "STANDARD" with every camera sold by a decent brand - gopro excluded from this list!

 

GoPro can shove it if they expect me to pay someone else to make their bunky cr@p work. right now i don't trust their hardware and still use my H7 as the 9 just thermally shuts down, popping sounds, slow mo lines in the screen and no remote. its a train wreak

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

Very well said!  Why is this so hard!

 

Tourist
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

Has GoPro responded to users request to have a firmware change to allow videos to be shot in a single file?

Tourist
Posts: 5

Re: How do I simply join all the split up video clips.

[ New ]
Our words mean zippo to GoPro. "It's a feature"

Like GM saying the ABS brakes failing is a feature to save gas since you can't drive the car.
Tourist
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

Joining clips should be an easy matter. I used Final Cut Studio for years and it was a very simple deal. I bought a Hero 5 several years ago but had various problems with it and I stopped using it. I broke it out again a few weeks ago.  Last week GoPro sent me a Hero 6 as a replacement. It turns on without my command, records bursts without my asking it and today I recorded what I thought was a 50 minute uninterrupted single clip. It turned out to be multiple 8:03 min clips so I wanted to stitch them together. I ended up here at this thread and can see GoPro is failing in it's customer service. I'll not get another GoPro again. The company may be going down the tubes, and, when that happens, they don't put money into new software development.

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

I just bought a discounted new gopro hero 6 black. Took my first few videos, and saw the chaptering. As a software dev, I want to say that this is NOT GoPro's fault. SD cards are FAT32, which means the max length of a file is a 32-bit number (roughtly 4GB). So they have no choice (yes, you can format the SD card into a different format, but SD cards are literally designed only to provide adequate write speeds with FAT32).

 

However, getting the chaptered video onto youtube is WAY more complex than it should be.

 

If I want to use my iPhone to stitch together the video, it's a 30 minute process to copy the *chapters*. Then I need to stitch them together, which not only requires double the space, but also takes who knows how long (I don't, because even after freeing enough space, my phone ran out of space and wouldn't do it again). GoPro - please provide a way with your app to suck over the FULL video, not the chapters -- the camera already can play them flawlessly.

 

This is literally a glorified concatenation. Put one file after the other, there is no need to reencode most of it. I'm not a video codec expert, but I do have a reasonable enough experience to know that this is possible (probably a bit of stitching on the boundaries).

 

I tried to use quicktime to concatenate the videos -- for a 25 minute video, it said it was going to take 28 HOURS to do it (and this might even be a low estimate, I let it run for about 2 hours, and then stopped). Again, this is a complete waste of time, if all of the videos are encoded identically, it should be mostly basic file concatenation.

 

ffmpeg was the solution that worked the best. 28 hours? Nope, I think it was less than 5 minutes. Pleasantly, using the Macos "trim" feature of finder allowed me to cut off the front and back junk reasonably fast (I think less than a minute). ffmpeg did list some channels that weren't figured out, and I'm not sure those went through. But video and sound is there. I have no idea what stickers are or how to include them, but I don't really care, just want to upload some videos to youtube without much editing (my hardware can't handle the editing). For those who tried mp4joiner, it didn't work for me as it doesn't seem to handle H.265.

 

Not only that, but I could run ffmpeg to copy the files directly from the card to my mac (so only storing once).

 

I'm thinking of making a simple front-end to ffmpeg JUST to stitch together the videos without much effort. I realize not everyone is command-line savvy, and this would be pretty simple to do. The naming scheme of the gopro is pretty easy to figure out, so it could be a tad bit smart, but I wasn't thinking of making it incredibly smart, just quick-n-dirty. Is there interest in this? I'd make it open source anyway, and probably hand it off, as I don't really have time to maintain yet another thing.

Tourist
Posts: 5

Re: How do I simply join all the split up video clips.

[ New ]

@stevens476 wrote:

I'm thinking of making a simple front-end to ffmpeg JUST to stitch together the videos without much effort. I realize not everyone is command-line savvy, and this would be pretty simple to do. The naming scheme of the gopro is pretty easy to figure out, so it could be a tad bit smart, but I wasn't thinking of making it incredibly smart, just quick-n-dirty. Is there interest in this? I'd make it open source anyway, and probably hand it off, as I don't really have time to maintain yet another thing.


Yes, @stevens476, it would be appreciated if you did share a UI wrapper around FFMPEG.

 

I've been using the command-line and had similar thoguhts, but I thought that maybe just the task of finding, downloading and installing FFMPEG might be too much for most people, and put it off thinking that GoPro must be working on something. But now, over a year later, I see there is no movement from GoPro...

Hiker
Posts: 46

Re: How do I simply join all the split up video clips.

[ New ]

Amongst the limitless list of human shortcomings are hubris, lack of imagination and incompetence.

exFAT has been around a long time and is the 32bit file size limitation solution.


The claim stated on Wiki is that manufacturers wouldn't licence and use exFAT for fear of being sued by the litigious monopoly Microsoft exFAT - Wikipedia, though clearly big players did and on some platforms licences were being offerred at a trivial price. This situation appears to have been rectified 2019, but I am predicting that GoPro will implement it some time in 2029

 

Some other threads deal with this as well

I regret wasting $$$ GP8 Black and the App is even... - GoPro Support Hub

Re: Things that are broken, unusable or dysfunctio... - GoPro Support Hub


The trivial solution of concatenating chapters as an option during upload seems to have been too obvious and/or too hard for GoPro. The entire iPhone centric process is in itself gearde towards creation of simplistic 15 sec exploding cat videos, rather than any sort of serious use of the camera.

I sold mine on eBay and do not regret doing so. I won't be purchasing another any time soon, because GoPro do not seem very concerned about the users who use these things in a more serious manner with x265.

I come back here occasionally to see whether GoPro has done anything intelligent yet. 

Hiker
Posts: 8

Re: How do I simply join all the split up video clips.

[ New ]

I use VideoProc to stitch chapters together.  It works well, and is fast (if you have a hardware GPU).

BUT, and I think this is true of all the stitching (merging) solutions described, it does not preserve the telemetry data.  So the merged video will have no GPS info when loaded into Dashware or a similar application. 

 

I am astonished at the poor software support that GoPro provides.

 

 

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

@lonkelm. The only way for a single, long video to be uploaded to cloud as-is is if the upload is done via auto upload, that is with the camera as a hub.
****can you explain this further?  i hate this feature as well and would like to load the one long clip to the cloud.  please explain step by step how to do this.  thanks!

 

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

So, first use of my first GoPro since forever and wanting to recorde a bike ride for a virtual course creation. Only to find that I have a bunch of files and no easy way to join them in the GoPro world. And then I come across this thread and find it's been like this forever.

WTF!

Fortunately I do have QuickTime on my Mac which allows files to be connected by simply draging and dropping them. However, I understand this will lose the GPS data which I need to create the course.

 

Not a happy Teddy Bear!

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

I'm trying to do the same; I just want videos of about 30 mins to two hour to be in a single file; I don't need to edit anything, I just want what I record to be in one file so I can upload it but nothing has ever worked for me, I can't even log into here most of the time and and the apps rarely worked properly.

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

Does not work with 360 video

Tourist
Posts: 2

Re: How do I simply join all the split up video clips.

[ New ]

The FAT32/exFAT file system that GoPro uses prevents GoPro from storing a single file larger than 4GB, that's why GoPro splits a long video. As you have stated that you want to join all the segments together without recompression or losing any quality, and if possible you can edit your videos, you can try some third-party video mergers.

As a matter of fact, GoPro Quik desktop app is a discontinued project, that's why you can't join your clips with it. Adobe Premiere Pro is claimed as the most suitable video merger and editor, however, it is too professional for newbies. So, some other third-party video joiner like WinX HD Video Converter Deluxe may be a good choice to merge videos as well as edit videos like trimming and cutting.

Tourist
Posts: 6

Re: How do I simply join all the split up video clips.

[ New ]

exFAT supports files natively larger than 4gb. It's the entire point of it. It's an updated and streamlined version of fat32 which is several decades old.

 

I made a post about a script I cobbled together that will run ffmpeg for you and join the video and audio streams together (if you want the other streams it may work but I'm not interested in them so I don't know).

 

So far it works on a 1hr and 50min video I made.

 

I won't post the script here as it might clutter up this post. I posted it a few days ago. It's totally automatic and is mostly foolproof. It also will do every video in a directory it's run in one after the other so if you have 50 videos to encode it'll do them one at a time for you (I did 53 in a directory with out issues).

Hiker
Posts: 67

Re: How do I simply join all the split up video clips.

[ New ]

So GoPro's are stuck in the year 1996...

Tourist
Posts: 7

Re: How do I simply join all the split up video clips.

[ New ]

I agree, this is truly such a ridiculously missing feature. Amazing how GoPro is at version 9 and this is nowhere to be found. Wow. Just wow. All people want when working with their gopro sources is to have their MP4s and WAVs as single files. And the reasoning behind it giving write errors are understandable, but this is not an issue when they've moved onto harddisk/SSD for desktop processing and editing.

Not to mention the useless header overhead that each file has to generate. It would be much better to have the gopro write raw video-files and then have some companion tool for PC/Mac that joins the raw files into one. I mean, the GoPro is no longer a consumer-grade video tool.

Tourist
Posts: 6

Re: How do I simply join all the split up video clips.

[ New ]

Current versions of FFMPEG will join the split files together with out a problem. The only possible issues are to do with the other streams (the gps stuff for example). If you just want to join MP4 video and the audio streams then you just need to find a post I made about this. It's the only thread I made.

Tourist
Posts: 7

Re: How do I simply join all the split up video clips.

[ New ]

Yes, I tried that ffmpeg solution. The file it produces is not working.

Probably a codec issue, but here's the thing; The 4GB files work in the video editor, the large joined output file does not.

I have the GoPro 9, it produces GX, not GH files.

 

Someone needs to step up and put a decent ffmpeg script/package on github for this.

Tourist
Posts: 6

Re: How do I simply join all the split up video clips.

[ New ]

Out of curiosity where did you get the FFMPEG version? Was it from the ffmpeg webpage?

 

I have ffmpeg version 2021-06-02-git-071930de72-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers

 

If you tried a different verions please let me know. I don't use GX files. I have a hero 7. I don't know if that uses them. I'll check and try and make a longer recording and see if it will join the files.

 

Tourist
Posts: 7

Re: How do I simply join all the split up video clips.

[ New ]

That's not the issue;

https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg

 

You can't concat H265 MP4 files the way your script does.

Tourist
Posts: 2

Re: How do I simply join all the split up video clips.

[ New ]

To my future self,

 

I first posted in this thread back in Hero 8. Every year a new crop of gopro users come here, shocked that their videos are split and cannot be merged without bloated software. Every year gopro ignores their users and instead spend their R&D money on **bleep**ty software that they will kill off after a few cycles. I expect gopro cloud services to suffer the same fate, so please come back to confirm.

 

P.S. Don't you find it weird that none of the youtube reviewers mention this glaring issue in their reviews? 

 

P.P.S Someone should just reply with a link to Insta360 One R and mark this thread as solved.

 

 

Tourist
Posts: 6

Re: How do I simply join all the split up video clips.

[ New ]

I'm not sure what commands your running but I just did join 3 hevc files together with my gopro 7. I just shot 3 short files and then joined them.

 

for %a in (gx*.*) do echo file '%a' >> filelist.txt

 

Made the file list.

 

ffmpeg -ignore_unknown -f concat -i filelist.txt -map 0 -c copy GXtest.mp4

 

just joined the files together. The resulting file plays in VLC and MPC BE-1.5.5 X64 with out any issues. I'm throwing away the other unknown streams. That might be why your conversions are failing. Also I'm using a new ffmpeg. That stuff your reading on the stack over flow forum is 9 months old.

 

Output from the combined file:

 

General
Complete name : K:\Video\GXtest.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/mp41)
File size : 214 MiB
Duration : 29 s 696 ms
Overall bit rate : 60.4 Mb/s
Writing application : Lavf59.2.101

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main@L5.1@Main
Codec ID : hvc1
Codec ID/Info : High Efficiency Video Coding
Duration : 29 s 684 ms
Bit rate : 60.2 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 50.000 FPS
Minimum frame rate : 27.778 FPS
Maximum frame rate : 50.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Bits/(Pixel*Frame) : 0.145
Stream size : 213 MiB (100%)
Title : GoPro H.265
Language : English
Color range : Full
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Codec configuration box : hvcC

Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 29 s 696 ms
Bit rate mode : Constant
Bit rate : 192 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 684 KiB (0%)
Title : GoPro AAC
Language : English
Default : Yes
Alternate group : 1

Other #1
ID : 4
Type : Time code
Format : QuickTime TC
Duration : 29 s 684 ms
Frame rate : 50.000 FPS
Time code of first frame : 22:15:15:16
Time code, striped : Yes
Title : GoPro H.265
Language : English
Default : No

Other #2
Type : meta
Duration : 29 s 696 ms
Bit rate mode : Variable
Default : No

 

Tourist
Posts: 7

Re: How do I simply join all the split up video clips.

[ New ]

MP4Joiner is the only software that succeeded in joining the GX*.mp4 files from my Hero 9;

https://www.videohelp.com/software/MP4Joiner

Took a while to have it load the 20 files I had entered (it's about 2 hours of material), and I had to make sure the Temp folder was a really huge one, but then it succeeded in losslessly joining them!

Tourist
Posts: 7

Re: How do I simply join all the split up video clips.

[ New ]
Apparently the videohelp link is down, this is where to get it: https://www.mp4joiner.org/en/
Tourist
Posts: 6

Re: How do I simply join all the split up video clips.

[ New ]

why? That video help program is over a year old. It's a much better idea to get the newest FFMPEG from the github.

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

I am  musician and own 3 Gro Pro cameras(2 GoPro Max cameras and a Hero 8 ), to shoot my band. the splits happen ni the middle of songs , I lose words and songs are all messed up, it takes hours of editing and shooting with mulitple cameras to fix.  This is a terrible issue that is easily solved and GoPro could do it in a day. A simple  firmeware update , for all your cameras ,that allows users to choose how long the files record before splitting, with option 'Do Not Split" , and for GoPro, a disclaimer / warning that says "Higher split times and not splitting could result in corrupt files and / or loss of data!!! GoPro reccomends 4 Gig and is not responsible for any data loss or corruption." Problem Solved..  Then those who want to risk it can and they dont have to worry about experemental beta testing from GoPro Lab..

Hiker
Posts: 8

Re: How do I simply join all the split up video clips.

[ New ]

royalstar21373, it is an unfortunate fact that GoPro no longer provides desktop software to merge video chapters into a single file.  I use VideoProc (https://www.videoproc.com/) on a Windows 10 computer to do this.  It merges the 4GB GoPro "chapter" videos seamlessly - there are no gaps or discontinuities in the audio or video in the merged .mp4.  It also provides lots of encoding options.  Unfortunately, the telemetry data (e.g. GPS) is lost in the merged video (which may not matter to you).  Again, GoPro doesn't provide a tool for extracting telemetry from the Hero8 files, but Telemetry Extractor (https://goprotelemetryextractor.com/free/) does a great job.  There's a free web-based version, and a somewhat pricey Premium version that greately simplifies batch processing and merging of chapter data.

 

Hope this helps.

Tourist
Posts: 4

Re: How do I simply join all the split up video clips.

[ New ]

I just bought a GoPro Hero 9 Black, and I'm pissed, too. In all this time you couldn't get off your pimply asses, put down the game controller, and make a #^%*()^@! automatic process to do this FOR US ???!!
Fix the problem, period. No wonder your stocks are waaaaay down and you have massive fiancial losses right now. You don't give a crap about your customer's requests.
 I have a 6 year old FujiFilm action camera that I'll be going back to.
Anybody wanna buy a brand new GoPro 9 ?

Tourist
Posts: 5

Re: How do I simply join all the split up video clips.

[ New ]
These lame bozo engineers can't figure out simple file system management and pass it off as a feature. Dumb dumbs..
Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

I just want to say I have the same problem. Thanks Sean for explaining it so well, thanks other people in the thread for external solutions (I'll try them) but I'm dissapointed with GoPro for not taking care of this themselves: Good hardware, bad software.

Tourist
Posts: 4

Re: How do I simply join all the split up video clips.

[ New ]

I used the  Ice Cream app Ice Cream Media Converter for free after buying a subscription to Freemake Video Converter, only to have it crash everytime I tried to join several clips together. The Freemake Converter has an actual 'JOIN' function that makes a small transition blur, but I found that the Ice Cream app does it just as well without the blurred transition and it never once crashed.
https://icecreamapps.com/

Sightseer
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]
Bump, just got the hero 9black. Still having the same problem, bought this to make 20 minute videos and can't seem to find an easy or free way to splice them together.. not interested in using my old slow phone to view and edit on a tiny screen when I have a pc and a big monitor with a mouse and keyboard that I use to upload to YouTube.. also unimpressed with battery life. Used one weekend, lost two files, battery died mid day on the first day, can't splice the videos I did actually get. Can't post anything because I've got nothing. Hero 2 worked better, easier to use, no video corruption, no video cutting, smaller, just as much battery life, tried to upgrade for better video quality. Got nothing
Tourist
Posts: 5

Re: How do I simply join all the split up video clips.

[ New ]
How long does the battery last?

I’ve wanted 1.5 to 2 hour battery life, like some of the old GoPros had. Or at least a way to have it preserve power when on but not shooting. I have two cameras mounted on plane wings. There’s no way to externally power them. The recent cameras eat up power even when not recording. At best I get about 50 minutes of power out of them.
Tourist
Posts: 4

Re: How do I simply join all the split up video clips.

[ New ]

I bought a battery cover with a hole for the plug, here... https://gopro.com/en/us/shop/mounts-accessories/usb-pass-through-door/ADCOD-001.html

I remove the internal GoPro battery so it won't interfere with the external 30,000 mAh power bank I plug into the new battery door.
USB power cords are just three wires; black, red, and signal, so just cut up several 9-12 foot USB cords and solder them together, then run the length of USB along your wing to plug into the GoPro at one end, and any USB plug inside the cockpit at the other end. 

You could also use 1,000 mph tape to tape a power bank to each of your wings that go to the cameras.

Tourist
Posts: 4

Re: How do I simply join all the split up video clips.

[ New ]

You can use any 5v 2A power supply from anywhere on your plane, like the running lights on the tips of the wings.
Mount two of these step-down transformers...
https://www.amazon.com/gp/product/B01KV71MVM/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

...to your wings, or inside the wings where the running lights go, then attach two of these to the 12v output wire ends...

https://www.amazon.com/Charger-Waterproof-Cigarette-Voltmeter-Motorcycle/dp/B087FKHL5N?ref_=ast_slp_...

Then just plug in a USB power cord that goes to each GoPro.



Tourist
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

God bless you..

Thank you very very much!

the only solution on the web at this ugly defect!

thank you again;7

 

Tourist
Posts: 1

Re: How do I simply join all the split up video clips.

[ New ]

I actually wrote a PowerShell function so I can do this easily, it also uses ffmpeg although I used some different options with mine. I loaded it into my profile, so all I ever really have to do is open PowerShell and run:

 

    Merge-GoProVideos -Path 'F:\GoPro\2021-09-11\HERO8 BLACK 1'

 

Or whatever the path to the directory where my new videos are. Here is the script for the PowerShell function: 

 

<#
.Synopsis
   Merges videos from GoPro into a single video file (does not delete source files)
.DESCRIPTION
   Merges videos from GoPro into a single video file (does not delete source files)
.EXAMPLE
   Merge-GoProVideos -Path 'F:\GoPro\2021-09-11\HERO8 BLACK 1'
CommandType     Name                                               Version    Source                                                         
-----------     ----                                               -------    ------                                                         
Application     ffmpeg.exe                                         0.0.0.0    C:\Program Files\ffmpeg\bin\ffmpeg.exe                         


The Following files exist: 

F:\GoPro\2021-09-11\HERO8 BLACK 1\GX010452_FULL.MP4


Due to this, the following files will not be merged: 

F:\GoPro\2021-09-11\HERO8 BLACK 1\GX010452.MP4
F:\GoPro\2021-09-11\HERO8 BLACK 1\GX020452.MP4


No Video Files have been created


.EXAMPLE
   Merge-GoProVideos -Path 'F:\GoPro\2021-09-11\HERO8 BLACK 1' -BinaryPath 'C:\Program Files\ffmpeg\bin\ffmpeg.exe'

CommandType     Name                                               Version    Source                                                         
-----------     ----                                               -------    ------                                                         
Application     ffmpeg.exe                                         0.0.0.0    C:\Program Files\ffmpeg\bin\ffmpeg.exe                         


The Following files exist: 

F:\GoPro\2021-09-11\HERO8 BLACK 1\GX010452_FULL.MP4


Due to this, the following files will not be merged: 

F:\GoPro\2021-09-11\HERO8 BLACK 1\GX010452.MP4
F:\GoPro\2021-09-11\HERO8 BLACK 1\GX020452.MP4


No Video Files have been created


.EXAMPLE
   Merge-GoProVideos -Path 'F:\GoPro\2021-09-11\HERO8 BLACK 1' -BinaryPath 'C:\Program Files\ffmpeg\bin\ffmpeg.exe' -AppendedFileNameText 'BANANA'

CommandType     Name                                               Version    Source                                                         
-----------     ----                                               -------    ------                                                         
Application     ffmpeg.exe                                         0.0.0.0    C:\Program Files\ffmpeg\bin\ffmpeg.exe                         
ffmpeg.exe : ffmpeg version git-2020-03-23-ba698a2 Copyright (c) 2000-2020 the FFmpeg developers
At C:\Users\Montificus\OneDrive\Documents\Work\Scripts\PowerShell\Scripts\GoPro\Merge-GoProVideos.ps1:113 char:17
+ ...             & $BinaryPath -f concat -safe 0 -i $strInFilesListFileNam ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (ffmpeg version ...mpeg developers:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass 
--enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora 
--enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg 
--enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex 
--enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc 
--enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 42.101 / 56. 42.101
  libavcodec     58. 76.100 / 58. 76.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[concat @ 000002463c40b800] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[concat @ 000002463c40b800] Could not find codec parameters for stream 4 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, concat, from 'F:\GoPro\2021-09-11\HERO8 BLACK 1\GX010452_BANANA.MP4.txt':
  Duration: N/A, start: 0.000000, bitrate: 45188 kb/s
    Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 44953 kb/s, 59.94 fps, 
59.94 tbr, 60k tbn, 59.94 tbc
    Metadata:
      creation_time   : 2021-09-13T07:03:29.000000Z
      handler_name    : GoPro H.265
      encoder         : GoPro H.265 encoder
      timecode        : 07:03:04:18
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s
    Metadata:
      creation_time   : 2021-09-13T07:03:29.000000Z
      handler_name    : GoPro AAC  
      timecode        : 07:03:04:18
    Stream #0:2: Unknown: none
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 44 kb/s
    Metadata:
      creation_time   : 2021-09-13T07:03:29.000000Z
      handler_name    : GoPro MET  
    Stream #0:4: Unknown: none
Output #0, mp4, to 'F:\GoPro\2021-09-11\HERO8 BLACK 1\GX010452_BANANA.MP4':
  Metadata:
    encoder         : Lavf58.42.100
    Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], q=2-31, 44953 kb/s, 0.02 
fps, 59.94 tbr, 60k tbn, 60k tbc
    Metadata:
      creation_time   : 2021-09-13T07:03:29.000000Z
      handler_name    : GoPro H.265
      encoder         : GoPro H.265 encoder
      timecode        : 07:03:04:18
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s
    Metadata:
      creation_time   : 2021-09-13T07:03:29.000000Z
      handler_name    : GoPro AAC  
      timecode        : 07:03:04:18
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  472 fps=0.0 q=-1.0 size=   43264kB time=00:00:07.85 bitrate=45103.7kbits/s speed=15.7x    
frame= 7522 fps=7515 q=-1.0 size=  691456kB time=00:02:05.47 bitrate=45143.6kbits/s speed= 125x    
frame=15061 fps=10034 q=-1.0 size= 1384704kB time=00:04:11.26 bitrate=45145.7kbits/s speed= 167x    
frame=22387 fps=11188 q=-1.0 size= 2058240kB time=00:06:13.48 bitrate=45145.6kbits/s speed= 187x    
frame=28942 fps=11568 q=-1.0 size= 2660864kB time=00:08:02.83 bitrate=45145.7kbits/s speed= 193x    
frame=31383 fps=10446 q=-1.0 size= 2885376kB time=00:08:43.55 bitrate=45147.0kbits/s speed= 174x    
frame=33866 fps=9659 q=-1.0 size= 3113472kB time=00:09:24.98 bitrate=45144.1kbits/s speed= 161x    
frame=36302 fps=9060 q=-1.0 size= 3337472kB time=00:10:05.62 bitrate=45144.6kbits/s speed= 151x    
frame=38775 fps=8603 q=-1.0 size= 3564800kB time=00:10:46.87 bitrate=45144.2kbits/s speed= 144x    
frame=41248 fps=8235 q=-1.0 size= 3792128kB time=00:11:28.13 bitrate=45143.8kbits/s speed= 137x    
frame=43722 fps=7936 q=-1.0 size= 4019712kB time=00:12:09.41 bitrate=45144.8kbits/s speed= 132x    
frame=46189 fps=7685 q=-1.0 size= 4246528kB time=00:12:50.57 bitrate=45144.8kbits/s speed= 128x    
frame=48646 fps=7471 q=-1.0 size= 4472320kB time=00:13:31.56 bitrate=45143.8kbits/s speed= 125x    
frame=51107 fps=7289 q=-1.0 size= 4698624kB time=00:14:12.62 bitrate=45144.3kbits/s speed= 122x    
frame=53562 fps=7129 q=-1.0 size= 4924416kB time=00:14:53.58 bitrate=45145.0kbits/s speed= 119x    
frame=56050 fps=6992 q=-1.0 size= 5153024kB time=00:15:35.09 bitrate=45143.8kbits/s speed= 117x    
frame=58474 fps=6866 q=-1.0 size= 5376000kB time=00:16:15.53 bitrate=45144.8kbits/s speed= 115x    
frame=61014 fps=6765 q=-1.0 size= 5609472kB time=00:16:57.90 bitrate=45144.4kbits/s speed= 113x    
frame=63482 fps=6668 q=-1.0 size= 5836544kB time=00:17:39.08 bitrate=45145.7kbits/s speed= 111x    
frame=65978 fps=6583 q=-1.0 size= 6065920kB time=00:18:20.72 bitrate=45144.9kbits/s speed= 110x    
frame=68452 fps=6505 q=-1.0 size= 6293248kB time=00:19:01.99 bitrate=45144.0kbits/s speed= 109x    
frame=70836 fps=6422 q=-1.0 size= 6512640kB time=00:19:41.77 bitrate=45145.4kbits/s speed= 107x    
frame=72680 fps=6302 q=-1.0 size= 6681856kB time=00:20:12.53 bitrate=45143.3kbits/s speed= 105x    
frame=74513 fps=6191 q=-1.0 size= 6850560kB time=00:20:43.11 bitrate=45144.5kbits/s speed= 103x    
frame=76308 fps=6086 q=-1.0 size= 7015424kB time=00:21:13.06 bitrate=45143.4kbits/s speed= 102x    
frame=78122 fps=5991 q=-1.0 size= 7182336kB time=00:21:43.32 bitrate=45144.3kbits/s speed=99.9x    
frame=79914 fps=5901 q=-1.0 size= 7346944kB time=00:22:13.22 bitrate=45143.4kbits/s speed=98.5x    
frame=81748 fps=5822 q=-1.0 size= 7515648kB time=00:22:43.81 bitrate=45144.0kbits/s speed=97.1x    
frame=83576 fps=5747 q=-1.0 size= 7683584kB time=00:23:14.31 bitrate=45143.2kbits/s speed=95.9x    
frame=85706 fps=5697 q=-1.0 size= 7879424kB time=00:23:49.85 bitrate=45143.1kbits/s speed=  95x    
frame=87502 fps=5629 q=-1.0 size= 8044544kB time=00:24:19.82 bitrate=45143.1kbits/s speed=93.9x    
frame=89542 fps=5580 q=-1.0 size= 8232192kB time=00:24:53.85 bitrate=45143.7kbits/s speed=93.1x    
frame=91215 fps=5495 q=-1.0 size= 8385792kB time=00:25:21.76 bitrate=45142.5kbits/s speed=91.7x    
frame=91275 fps=5337 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=  89x    
frame=91275 fps=5184 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=86.5x    
frame=91275 fps=5039 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=84.1x    
frame=91275 fps=4902 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=81.8x    
frame=91275 fps=4774 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=79.6x    
frame=91275 fps=4651 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=77.6x    
frame=91275 fps=4535 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=75.7x    
frame=91275 fps=4424 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=73.8x    
frame=91275 fps=4319 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=72.1x    
frame=91275 fps=4219 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=70.4x    
frame=91275 fps=4124 q=-1.0 size= 8391680kB time=00:25:22.76 bitrate=45144.5kbits/s speed=68.8x    
frame=91872 fps=4059 q=-1.0 size= 8446464kB time=00:25:32.72 bitrate=45144.0kbits/s speed=67.7x    
frame=94354 fps=4079 q=-1.0 size= 8674560kB time=00:26:14.13 bitrate=45143.5kbits/s speed=  68x    
frame=95537 fps=4042 q=-1.0 size= 8783104kB time=00:26:33.87 bitrate=45142.4kbits/s speed=67.4x    
frame=97199 fps=4027 q=-1.0 size= 8936448kB time=00:27:01.60 bitrate=45145.1kbits/s speed=67.2x    
frame=97470 fps=4028 q=-1.0 Lsize= 8963698kB time=00:27:06.12 bitrate=45156.9kbits/s speed=67.2x    
video:8923733kB audio:37590kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.026510%

The following video file(s) have been created: 

F:\GoPro\2021-09-11\HERO8 BLACK 1\GX010452_BANANA.MP4

.INPUTS
   System.String
    File Path
   System.String
    Binary path for ffmpeg.exe
   System.String
    Text to append to the file name for the nerged video
.OUTPUTS
   Console.out
.NOTES
   General notes
.COMPONENT
   
.ROLE
   
.FUNCTIONALITY
   GoPro Video file concatenation
#>
function Merge-GoProVideos
{
    Param
    (
        # Path to the directory containing the video files to be merge
        [Parameter(Mandatory=$true)]
        [ValidateNotNull()]
        [ValidateNotNullOrEmpty()]
        [string]$Path,

        # Path to ffmpeg.exe binary file (Ex: 'C:\Program Files\ffmpeg\bin\ffmpeg.exe')
        [Parameter(Mandatory=$false)]
        [string]$BinaryPath = "ffmpeg.exe",

        # Appended text to Concatenated File (Ex: FULL appended to GX010452.MP4 would be GX010452_FULL.MP4
        [Parameter(Mandatory=$false)]
        [string]$AppendedFileNameText = "FULL"
    )

    Begin {
        # Path to directory containing video files
        $strDir = $Path
        
        # Initialize variable variable with the binary path
        $strBinaryPath = $BinaryPath
                
        # Initializes variable with the string that will be appended to the end of the concatenated file's file name
        $strAppendedFileNameText = $AppendedFileNameText


        # Test for ffmpeg.exe and exit function if missing
        try {
            Get-Command $strBinaryPath -ErrorAction Stop
        }
        catch [System.Management.Automation.CommandNotFoundException] {
            throw "ffmpeg.exe was not found and is required for this function. Please install ffmpeg to proceed or specify " `
                + "the path to ffmpeg using the BinaryPath parameter. Exiting"
        }
        
        $strBinaryPath = (Get-Command $strBinaryPath).Source

        $arrFiles = Get-ChildItem $strDir\* -Include "*.MP4"

        if ($arrFiles.Name -like "*_$strAppendedFileNameText*") {
            $arrConcatenatedFiles = $arrFiles | Where-Object {$_.Name -like "*_$strAppendedFileNameText*"}

            $arrExcludeGroups = ($arrConcatenatedFiles.Name.TrimEnd('MP4').TrimEnd('.').Substring(5,3) | Group-Object).Name

        }

        $arrGroups = $arrFiles.Name.TrimEnd('MP4').TrimEnd('.').Substring(5,3) | Group-Object
        
        if ($arrExcludeGroups -ne $null) {
            Write-Host ""
            Write-Host ""
            Write-Host "The Following files exist: "
            Write-Host ""
            $arrFiles.FullName -like "*_$strAppendedFileNameText*"
            Write-Host ""
            Write-Host ""
            Write-Host "Due to this, the following files will not be merged: "
            Write-Host ""
            foreach ($strExcludeGroup in $arrExcludeGroups) {
                ($arrFiles | Where-Object {
                    $_.Name -like "*$strExcludeGroup*" -and $_.Name -notlike "*_$strAppendedFileNameText*"
                }).FullName
            }
            Write-Host ""
        }
    }
    Process {
        foreach ($objGroup in $arrGroups) {
            if ($objGroup.Count -gt 1 -and $arrExcludeGroups -notcontains $objGroup.Name) {
                $arrFiles = Get-ChildItem $strDir\* -Include "*$($objGroup.Name)*" | Sort Name
        
                $strOutputFileName = "$($arrFiles[0].FullName.TrimEnd('MP4').TrimEnd('.'))" + "_$strAppendedFileNameText" + '.MP4'
                $strInFilesListFileName = $strOutputFileName + ".txt"

                $strInFiles = ''

                foreach ($strFile in $arrFiles) {
                    $strInFiles += "file `'$($strFile.FullName)`'`n"
                }
                $strInFiles = $strInFiles.TrimEnd("`n") | Out-File $strInFilesListFileName -Encoding ascii

                & $BinaryPath -f concat -safe 0 -i $strInFilesListFileName -c copy -bsf:a aac_adtstoasc $strOutputFileName
        
                Remove-Item $strInFilesListFileName
                
            }
        }
    }
    End {
        $arrNewConcatenatedFiles = Get-ChildItem $strDir\* -Include "*.MP4" | Where-Object {$_.Name -like "*_$strAppendedFileNameText*" -and $_.Name -notcontains $arrConcatenatedFiles.Name}

        if ($arrNewConcatenatedFiles -ne $null) {
            Write-Host ""
            Write-Host "The following video file(s) have been created: "
            Write-Host ""
            $arrNewConcatenatedFiles.FullName
            Write-Host ""
        }
        else {
            Write-Host ""
            Write-Host "No Video Files have been created"
            Write-Host ""
        }
    }
}