Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
brew install ffmpeg
brew install coreutils
brew install jq


Joining the Videos While Preserving 

First create a text file (e.g. filesToMerge.txt) with all the chaptered video files that you want to merge into a single video e.g.

Code Block
file GH010097.MP4
file GH020097.MP4
file GH030097.MP4
file GH040097.MP4 


Next, check the streams in the video files.

Code Block
themeEmacs
ffprobe -show_format GH010097.MP4
Code Block
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 2704x1520 [SAR 1:1 DAR 169:95], 60002 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-08-09T17:39:29.000000Z
      handler_name    : GoPro AVC  
      vendor_id       : [0][0][0][0]
      encoder         : GoPro AVC encoder
      timecode        : 17:38:25:34
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2023-08-09T17:39:29.000000Z
      handler_name    : GoPro AAC  
      vendor_id       : [0][0][0][0]
      timecode        : 17:38:25:34
  Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2023-08-09T17:39:29.000000Z
      handler_name    : GoPro TCD  
      timecode        : 17:38:25:34
  Stream #0:3[0x4](eng): Data: bin_data (gpmd / 0x646D7067), 49 kb/s (default)
    Metadata:
      creation_time   : 2023-08-09T17:39:29.000000Z
      handler_name    : GoPro MET  
  Stream #0:4[0x5](eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
      creation_time   : 2023-08-09T17:39:29.000000Z
      handler_name    : GoPro SOS 


The above video has 4 streams. Lets try to join 


Code Block
themeEmacs
ffmpeg -f concat -safe 0 -i filesToMerge.txt -c copy -map 0:0 -map 0:1 -map 0:3 -c:v libx264 -pix_fmt yuv420p video-merged.mp4

-ignore_unknown



Revise Scripts

Using the scripts from https://www.bluebill.net/timestamps.html

...

ScriptDescription 

This script extracts the creation_time, removes the timezone and assigns the local timezone. It then converts this back to UTC and write it back to the video. This fixes issue with GoPro Videos.

USAGE: ./correct_time.sh video.mp4 --update 

Adds Timestamp in the top right hand corner of the video.

USAGE: ./timestamp.sh video.mp4

Sets the time to the local time specified and stores in the video as UTC.

USAGE: ./setTime.sh video.mp4 '2023-06-13T19:23:59' --update


References