SD Card Files - B&W Night Vision all 45 Seconds instead of 1 Minute

I needed to pull a day of footage off of an SD Card and ran into an interesting “error” or glitch. All of the files that are shot using black and white night vision (not color) are showing a duration of 45 seconds instead of 1 minute. The time stamp shows that all of the video is there, however it appears to be almost sped up and the Audio doesn’t quite sync up. I tested the files on both MacOS and Windows 11 machines using built in programs and VLC and the results were the same.

I think that I may have found the issue, however I need help fixing it. I know standard or color night vision modes the camera records at 20fps and when in black and white night vision it records at 15fps. When you look at either file type on the SD Card it shows that they are both encoded at 20fps. This causes a problem with the b&w night vision files because it’s playing at the same speed, but with 25% less frames (hence :45 as opposed to 1:00).

I tried to fix these files using an ffmpeg batch repair, however it says that is nothing to repair. I have tried to reencode them down to 15fps, however that doesn’t work and just ads 15 seconds of black screen at the end. The only way I have found to fix it is using Apple’s Compressor software to set the frame rate and duration, however you have to strip audio first and this also takes a 7ish MB file and makes it 60ish MB which is no good. Anyone else run into this issue? Any easy fixes?

Although I believe that this is a much larger issue and needs to be fixed on the Wyze / Camera side, I put together something using ffmpeg that works for todays task. I made a little script that will demux the audio and video files, leaves the video file untouched, converts the audio to AAC (necessity), then puts the file back together and all durations are correct. Here is the code incase anyone else needs it:

for i in *.mp4;
  do name=`echo "$i" | cut -d'.' -f1`
  echo "$name"
  ffmpeg -i "$i" -an -vcodec copy -bsf:v h264_mp4toannexb "${name}_video.h264"
  ffmpeg -i "$i" -vn -acodec aac "${name}_audio.aac"
  ffmpeg -i "${name}_video.h264" -i "${name}_audio.aac" -c:v copy -c:a copy "${name}_final.mp4"
  rm "${name}_video.h264"
  rm "${name}_audio.aac"

The audio is converted to AAC, and not a direct passthrough, because for some odd reason ffmpeg believes that codec for pcm_alaw can’t be in an mp4 (even though it is in the Wyze created file.