GoPro timecode/timestamp access?

3d87c4 wrote on 4/25/2024, 6:09 PM

I picked up a couple of Gopro H12 blacks to try 3D with and would like to use the timestamp/timecode information for lining up the left and right clips. This information is included as a 3rd metadata track in the video file and, after reading a few threads it appears Vegas can't access it.

I've traditionally used transients on the audio tracks to do this but wonder if there's another way, using FFMPEG, scripting, or some other external program (I notice Pluraleyes is no longer available.)

Any suggestions?

I found this input on the internet, but all I get is a box with the text "hms}" in it:

ffmpeg -i inpiut -vf "drawtext=text='timecode: %{pts:hms}': x=500: y=500: fontsize=100:fontcolor=yellow@0.9: box=1: boxcolor=black@0.6" -c:a copy output.mp4

 

Here's the mediainfo for one of my files:

General
Complete name                            : XXXXXXXXXX\GX010006.MP4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 1
Codec ID                                 : mp41 (mp41)
File size                                : 80.8 MiB
Duration                                 : 11 s 228 ms
Overall bit rate                         : 60.4 Mb/s
Frame rate                               : 59.940 FPS
Encoded date                             : 2024-04-23 22:02:10 UTC
Tagged date                              : 2024-04-23 22:02:10 UTC

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L6@Main
Codec ID                                 : hvc1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 11 s 228 ms
Bit rate                                 : 60.1 Mb/s
Width                                    : 5 312 pixels
Height                                   : 2 988 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 59.940 (60000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.063
Stream size                              : 80.5 MiB (100%)
Title                                    : GoPro H.265
Language                                 : English
Encoded date                             : 2024-04-23 22:02:10 UTC
Tagged date                              : 2024-04-23 22:02:10 UTC
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                                 : 11 s 200 ms
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Nominal bit rate                         : 48.0 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                              : 259 KiB (0%)
Title                                    : GoPro AAC
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : 2024-04-23 22:02:10 UTC
Tagged date                              : 2024-04-23 22:02:10 UTC

Other #1
ID                                       : 3
Type                                     : Time code
Format                                   : QuickTime TC
Duration                                 : 11 s 228 ms
Bit rate mode                            : Constant
Frame rate                               : 59.940 (60000/1001) FPS
Time code of first frame                 : 16:01:12:53
Time code of last frame                  : 16:01:24:05
Time code, stripped                      : Yes
Title                                    : GoPro TCD
Language                                 : English
Encoded date                             : 2024-04-23 22:02:10 UTC
Tagged date                              : 2024-04-23 22:02:10 UTC

Other #2
ID                                       : 4
Type                                     : meta
Format                                   : gpmd
Codec ID                                 : gpmd
Duration                                 : 11 s 227 ms
Bit rate mode                            : Variable
Title                                    : GoPro MET
Language                                 : English
Encoded date                             : 2024-04-23 22:02:10 UTC
Tagged date                              : 2024-04-23 22:02:10 UTC
Duration_LastFrame                       : -785


 

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

Comments

NoKi wrote on 4/26/2024, 10:36 AM

Can you provide a file to test? Maybe this script already works for you out of the box. You have to select the video in the Project Media list and run the script.

FFPROBE has to be under this path: "C:\Program Files\ffmpeg\bin\ffprobe.exe"

using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using ScriptPortal.Vegas;
using System.Diagnostics;
using System.Windows.Forms;



public class EntryPoint
{
    public static Vegas myVegas;
    
    public void FromVegas(Vegas vegas)
    {
        myVegas = vegas;
        Media[] selectedMedia = myVegas.Project.MediaPool.GetSelectedMedia();
    
        foreach (Media media in selectedMedia)
        {
            if (media.HasVideo())
            {        
                FileInfo file = new FileInfo(media.FilePath);                                        
                string mediaFilePath = Convert.ToString(file);
                mediaFilePath = mediaFilePath.ToLowerInvariant();
                
                if (mediaFilePath.EndsWith(".mov"))
                {
                    string panaTimecode = GetTimeReference(mediaFilePath);                
                    // MessageBox.Show(panaTimecode);
                    
                    if (panaTimecode != "")
                    {
                        // Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.Time);    
                        Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.TimeAndFrames);
                        // Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.SmpteEBU);                        
                        media.UseCustomTimecode = true;
                        media.RulerFormat = RulerFormat.TimeAndFrames;
                        
                        media.TimecodeIn = newTimeIn;    
                        media.Comment = "Project fps Timecode from File";
                    }
                }                
            }    
        }        
        myVegas.Project.MediaPool.OpenAllMedia();
    }    
    static string GetTimeReference(string mediaFilePathTmp)
        {
            string ffprobeParameter = " -v error -select_streams v:0 -show_entries stream_tags=timecode -of default=nk=1:nw=1 -i " + "\"" + @mediaFilePathTmp + "\"";
            //MessageBox.Show(ffprobeParameter);
            Process processffprobe = new Process();
            processffprobe.StartInfo.FileName = @"C:\Program Files\ffmpeg\bin\ffprobe.exe";
            processffprobe.StartInfo.Arguments = ffprobeParameter;
            processffprobe.StartInfo.CreateNoWindow = true;
            processffprobe.StartInfo.UseShellExecute = false;
            processffprobe.StartInfo.RedirectStandardOutput = true;
            processffprobe.Start();

            string timeRefSampleRateTmp = processffprobe.StandardOutput.ReadToEnd();          

            return timeRefSampleRateTmp;
        }

}

Nils

3d87c4 wrote on 4/26/2024, 12:01 PM

@NoKi: Thank you. Here are Google Drive links to the left and right video clips I have been tinkering with. Their timecodes were synchronized using the QR code technique but the cameras were started a bit over a second apart. I was simply holding the cameras side-by-side in my hand so their 3D alignment varies (why I refer to "fake 3D" while speaking to my model (cat).

Left: https://drive.google.com/file/d/1EsyR1MdVmp2ymLryhLeIp3Ma_PJWeOaO/view?usp=drive_link
Right: https://drive.google.com/file/d/1EUbLOnxf4CPmSjPCtj6u0tYiS39miBS7/view?usp=drive_link

Do you need a Vegas file as well?

The postman delivered a 3D slide-bar moments ago so I will be able to shoot stable 3D clips later today.

I'm a novice at scripting...is your script usable as written above? What shall I call it when I install it?

I have a plethora of FFMPEG installations on my computer, but none at the path you mention. I will edit the FFPROBE path in your script and give it a try once I have some stable 3D clips.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

NoKi wrote on 4/26/2024, 1:41 PM

@3d87c4

I only had to remove the file extension check (.mov only) in the script above. It works now with your GoPro files (see script below).

Though, please use a recent version of ffmpeg/ffprobe as there was in bug preventing it from reading timecode correctly in some cases.

Nils

 

using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using ScriptPortal.Vegas;
using System.Diagnostics;
using System.Windows.Forms;



public class EntryPoint
{
    public static Vegas myVegas;
    
    public void FromVegas(Vegas vegas)
    {
        myVegas = vegas;
        Media[] selectedMedia = myVegas.Project.MediaPool.GetSelectedMedia();
    
        foreach (Media media in selectedMedia)
        {
            if (media.HasVideo())
            {        
                FileInfo file = new FileInfo(media.FilePath);                                        
                string mediaFilePath = Convert.ToString(file);
                mediaFilePath = mediaFilePath.ToLowerInvariant();
                
                //if (mediaFilePath.EndsWith(".mov"))
                {
                    string panaTimecode = GetTimeReference(mediaFilePath);                
                    MessageBox.Show(panaTimecode);
                    
                    if (panaTimecode != "")
                    {
                        // Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.Time);    
                        Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.TimeAndFrames);
                        // Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.SmpteEBU);                        
                        media.UseCustomTimecode = true;
                        media.RulerFormat = RulerFormat.TimeAndFrames;
                        //media.RulerFormat = RulerFormat.TimeAndFrames;
                        //media.RulerFormat = RulerFormat.SmpteEBU;
                        media.TimecodeIn = newTimeIn;    
                        media.Comment = "Project fps Timecode from File";
                    }
                }                
            }    
        }        
        myVegas.Project.MediaPool.OpenAllMedia();
    }    
    static string GetTimeReference(string mediaFilePathTmp)
        {
            string ffprobeParameter = " -v error -select_streams v:0 -show_entries stream_tags=timecode -of default=nk=1:nw=1 -i " + "\"" + @mediaFilePathTmp + "\"";
            //MessageBox.Show(ffprobeParameter);
            Process processffprobe = new Process();
            processffprobe.StartInfo.FileName = @"C:\Program Files\ffmpeg\bin\ffprobe.exe";
            processffprobe.StartInfo.Arguments = ffprobeParameter;
            processffprobe.StartInfo.CreateNoWindow = true;
            processffprobe.StartInfo.UseShellExecute = false;
            processffprobe.StartInfo.RedirectStandardOutput = true;
            processffprobe.Start();

            string timeRefSampleRateTmp = processffprobe.StandardOutput.ReadToEnd();          

            return timeRefSampleRateTmp;
        }

}

 

NoKi wrote on 4/26/2024, 1:54 PM

To use the script:

Copy the script text to a text file, name it whatever you like, but it needs to have the extension ".cs".
Create a folder named "Vegas Script Menu" in your Windows "Documents" folder and copy your script into this folder.

After starting Vegas you will find the script unter Tools -> Scripting -> 'Filename'.

Nils

3d87c4 wrote on 4/26/2024, 6:53 PM

@NoKi

I'm not sure what I'm supposed to see...I tried it in V20 and V21 selecting the video and audio tracks on the timeline then running the script and nothing happened at all. I'd hoped it would actually move the media on the timeline to line them up.

Assuming I was misunderstanding, in V21, I selected the media in the project media tab and two boxes were displayed on the screen with time's in them. Are these the timecodes for the beginning of each clip? If so, what are the units...in particular for the last (right most) field? I assume it is up to me to move the files by an amount representing the difference between those times.

 

Last changed by 3d87c4 on 4/26/2024, 6:54 PM, changed a total of 1 times.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

3d87c4 wrote on 4/26/2024, 7:22 PM

@NoKi  Ok...looking at your script I see there should have been another message created by ffprobe. I tried several versions of ffprobe before it occurred to me to select the media in the project media tab so am thinking the version of ffprobe is too old. I'll try some other ones to see if that fixes it.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

Robert Johnston wrote on 4/26/2024, 10:21 PM

After you line up the clips using timecode, you need to be sure the video frames from the left and right are actually in sync. In fact, syncing the video frames is more important than syncing the audio or timecode when it comes to 3D from two separate cameras. The best sync I got was using a remote control that sent a signal at the same time to each camera. Even then, one camera may not start at exactly the same time as the other and I would have to manually offset L/R one or two frames one way or the other. Since there wasn't any timecode generated, I can't say whether or not that matching timecodes guarantees the corresponding video frames were captured at the exact same time. 3D has to be perfectly synced based on the video frames. Timecode or audio will get you close.

Intel Core i7 10700K CPU @ 3.80GHz (to 4.65GHz), NVIDIA GeForce RTX 2060 SUPER 8GBytes. Memory 32 GBytes DDR4. Also Intel UHD Graphics 630. Mainboard: Dell Inc. PCI-Express 3.0 (8.0 GT/s) Comet Lake. Bench CPU Multi Thread: 5500.5 per CPU-Z.

Vegas Pro 21.0 (Build 108) with Mocha Vegas

Windows 11 not pro

3d87c4 wrote on 4/26/2024, 11:06 PM

@Robert Johnston: Thank you, syncing the video frames is my goal & I suspect the similarity of the terminology may be adding to the confusion.

Another source of confusion is my starting this thread while there is a very similar active thread, that references an even older thread.

See:
https://www.vegascreativesoftware.info/us/forum/timecode-how-to-sync-audio-only-tracks-how-to-limit-total-tracks--145377/

and
https://www.vegascreativesoftware.info/us/forum/timecode-sync-attempt-error-message--145178/

@NoKi

I finally read the recent the timecode-how-to- thread and realized I needed the second script mentioned in the timecode-sync-attempt- thread.

I installed that script, followed your instructions in the timecode-how-to thread and am now able to shift the clips.
Unfortunately, this raises two issues:

First, I must have shot my clips around noon, because the time code of the first clip is 12:10:33.46 & that's where the clips were shifted to. I thought they had disappeared, but found them eventually. It would be useful if the user could specify where to shift the clips to.

Second, as @Robert Johnston mentions the script uses the timecode, not the timestamp metadata in the 3rd track of the source files so the clips aren't really frame synced. This I can tell from the audio tracks because, in the clips I used today, I tapped on the slidebar holding the cameras 4 times with a coin---my traditional way of time aligning cameras---at the beginning of the clip.

I will upload today's clips and share their drive links in a separate comment.

It is confusing to me why the timecode isn't sufficient as I did QR code sync the cameras prior to shooting the clips. Perhaps I didn't do that right, or am misunderstanding what the QR code sync actually does? I've only owned these cameras for a few days.

Last changed by 3d87c4 on 4/26/2024, 11:09 PM, changed a total of 1 times.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

3d87c4 wrote on 4/26/2024, 11:19 PM

Here the files I used today. They were mounted side-by-side on a slidebar. I QR code synched them and tapped on the slidebar 4 times with a coin to create spikes in the audio track for synchronization.

Left: https://drive.google.com/file/d/1lyhD6knZurVC6FSJDCSDYqz3K1KjpwG1/view?usp=drive_link

Right: https://drive.google.com/file/d/1vxTDroXMNs4JxXj0dF7PwsRj2ZcG1ypO/view?usp=drive_link

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

NoKi wrote on 4/27/2024, 2:28 AM

@3d87c4

Funny thing: I always only can download the left video (same for the files in your other post), you need to grant me permission for the right one.

Yes, like you noticed, the script above is only for reading the timecode from the file and add it to the media properties.

For positioning the events you can either use the Vegas internal function (Multicamera menu) or the script from the other thread.

For just getting a relative positioning, to avoid shifting the events many hours on the timeline, I made this script. I haven't used it for a while, but it should work.

using System;
using ScriptPortal.Vegas;

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Timecode minPosition = Timecode.FromString("23:59:59,00");
        foreach (Track theTrack in vegas.Project.Tracks)
        {
            foreach (TrackEvent ev in theTrack.Events)
            {
                if (minPosition > ev.ActiveTake.Media.TimecodeIn)
                {
                    minPosition = ev.ActiveTake.Media.TimecodeIn;
                }
                
            }
        }
        // vegas.Project.Ruler.StartTime = minPosition;
        foreach (Track theTrack in vegas.Project.Tracks)
        {
            foreach (TrackEvent ev in theTrack.Events)
            {
                // if (!ev.Selected) continue;

                Timecode position = ev.ActiveTake.Media.TimecodeIn + ev.ActiveTake.Offset - minPosition;
                ev.Start = position;

                if (ev.Group != null)
                {
                    foreach (TrackEvent groupevent in ev.Group)
                    {
                    groupevent.Start = position;
                    }
                }
            }
        }
    }
}

 

NoKi wrote on 4/27/2024, 2:38 AM

Second, as @Robert Johnston mentions the script uses the timecode, not the timestamp metadata in the 3rd track of the source files so the clips aren't really frame synced. This I can tell from the audio tracks because, in the clips I used today, I tapped on the slidebar holding the cameras 4 times with a coin---my traditional way of time aligning cameras---at the beginning of the clip.

I will upload today's clips and share their drive links in a separate comment.

It is confusing to me why the timecode isn't sufficient as I did QR code sync the cameras prior to shooting the clips. Perhaps I didn't do that right, or am misunderstanding what the QR code sync actually does? I've only owned these cameras for a few days.

Timecode should give a more precise timing information (frame or better) than the file timestamp (1 second). So, if the files timecodes do match the events positions and the media are still not in perfect sync, then the timecodes of the cameras might not be properly synchronized.

Nils

3d87c4 wrote on 4/27/2024, 12:41 PM

Yes, my manual synchronization using the spikes in the audio suggests that even with the QR code synchronization the Gopro H12's aren't perfectly synchronized---there is still a +/- half frame error. I have read similar conclusions on line.

I was hoping that being able to access and use the information in the 3rd metadata track in the MP4 files would remove all doubt. (I'm still not sure I'm doing the QR code sync correctly.)

BTW: I have updated the share settings on both the videos I shared in my last post.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

NoKi wrote on 4/27/2024, 1:10 PM

I was hoping that being able to access and use the information in the 3rd metadata track in the MP4 files would remove all doubt. (I'm still not sure I'm doing the QR code sync correctly.

It's actually this 3rd track ffprobe is reading to get the timecode of the first frame. Though, the frame numbers might differ as ffprobe or ffmpeg references to the actual video frame rate (> 30 fps possible), whereas other tools use the SMPTE standard (max 30 fps). So, a factor of 2 is possible, but it's the same realtime value.

Nils

3d87c4 wrote on 4/27/2024, 2:12 PM

Interesting, where in the script is this specified? The only explicit reference to a track I see is toward the end & v:0 is the first video track:

      string ffprobeParameter = " -v error -select_streams v:0 -show_entries stream_tags=timecode -of default=nk=1:nw=1 -i " + "\"" + @mediaFilePathTmp + "\"";
      

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

3d87c4 wrote on 4/27/2024, 2:33 PM

@NoKi: oops, just noticed your 12:28 am post...

Thank you for the script. I have double checked the share settings for all of the clips.

 

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

NoKi wrote on 4/27/2024, 2:58 PM

Interesting, where in the script is this specified? The only explicit reference to a track I see is toward the end & v:0 is the first video track:

      string ffprobeParameter = " -v error -select_streams v:0 -show_entries stream_tags=timecode -of default=nk=1:nw=1 -i " + "\"" + @mediaFilePathTmp + "\"";
      

@3d87c4

See https://ffmpeg.org/ffprobe.html#Timecode. For mov and also mp4 containers the time code is taken from the Quicktime tmcd atom, if this QT tmcd track is embedded in the file. See also this https://developer.apple.com/library/archive/documentation/QuickTime/Reference/QTRef_AtomsResources/QTRef_AtomsResources.pdf

But whatever the source for the first frame time code is, the value should be the exact same, nevertheless.

Nils

3d87c4 wrote on 4/27/2024, 3:22 PM

@NoKi: Thank you, I'll have a look at those references.

I just tried the shift script you shared last night and it works nicely, though there is still a sync error between the left and right videos.

At this point I think I have these things to pursue:

Be sure I'm doing the QR code sync correctly,

Get a GoPro remote to be sure this isn't due to manually pressing the shutter buttons (it will simplify things anyway),

Continue reading to see if there's something else to be tried.

Otherwise, my audio sync by tapping the slide bar seems to be a practical method at 60fps.

 

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

3d87c4 wrote on 4/28/2024, 12:09 PM

@NoKi:

Just heard from a friend and he is using more-or-less the same procedure.

Their ffprobe input for getting the individual clips start time codes is identical to yours.

To start filming they are using a voice command and the time codes from ffprobe only have a 1 frame error!

I have a gopro remote arriving Monday and will experiment further then.

Last changed by 3d87c4 on 4/28/2024, 12:10 PM, changed a total of 1 times.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

3d87c4 wrote on 4/29/2024, 7:28 PM

I was totally wrong about my GoPro remote delivery---it wasn't even shipped 'til today---so I experimented using voice commands.

After QR code sync I started recording ("GoPro start Recording") and tapped on the slide bar 5 times with a coin. I then counted out loud for 12 seconds, tapped the slide bar a few more times and stopped the recording.

Here are the resulting clips:

Left: https://drive.google.com/file/d/1mNlDsl6T2wPd3YFVDWeqyXUtmk_Jxd_D/view?usp=sharing

Right: https://drive.google.com/file/d/1uZ_z4W1IGtXAw1fFaX5THciFmcU8wKt_/view?usp=sharing

I loaded each clip into project media, selected both, and ran the first script.

I then dragged them to the timeline and was surprised to see they were already perfectly aligned!

Here's a screen shot of the timeline with the marker located randomly between the 4'th and 5'th tap transients and another zoomed in and the marker placed at the nearest frame edge:



Running the second, shift, script actually introduced a 4 frame offset!?!?

I've only tried this once...

Here's the final result after pairing as a steroscopic 3D subclip and Stereoscopic 3D Adjust fx:

https://drive.google.com/file/d/1QiOKrHlWNr37C-MrtPapOJv3jzmEGJif/view?usp=sharing


 

 

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

NoKi wrote on 4/30/2024, 10:04 AM

@3d87c4

You are right, I see the exact same behavior. The time code of the ...013.mp4 is four frames late to the ...025.mp4 file, so the script reproduces this offset when positioning the events on the timeline.
Somehow the QR code sync doesn't seem to work properly.

My DJI Osmo Action can jam sync time code over cable. Isn't that possible with the GoPros too?

Nils

3d87c4 wrote on 4/30/2024, 11:17 AM

@NoKi:

The GoPro Hero3+ cameras were the last with true synchronization via a cable. The H4's had a connector on the back that could be hacked (jammed?) for synchronization. The rear connector was removed after that. Here's a video I found that discusses synchronization for GoPros up to H10 (or 11, I forget) and likely applies to the H12's as well:



I don't know how consistent this 4 frame offset is. Would it be possible to hack the offset into your shift script if it is repeatable?

My friend is using ffprobe to get the starting timecode and found a consistent 1 frame offset for 30 fps clips.

I'm not sure how this will play out with more than 2 cameras. My coin-tap trick only works if the cameras are mounted on the same jig. I tried using a video of a metronome that beeped and flashed a light to sync two cameras but didn't find it practical. To my surprise the video got a huge number of youtube views by folks interested in blowing up speakers by overloading them.
 

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

NoKi wrote on 4/30/2024, 1:07 PM


I don't know how consistent this 4 frame offset is. Would it be possible to hack the offset into your shift script if it is repeatable?

@3d87c4

Yes, a time code compensation should be easy to add to the script, if the the delay turns out to be consistent.

Nils

3d87c4 wrote on 4/30/2024, 1:34 PM

@NoKi: Thank you.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

NoKi wrote on 5/1/2024, 9:37 AM

@3d87c4

Here is a script to play with. In line 20 you can define an offset (also negative) in frames (project fps). This number of frames is added to the Quicktime TC value from ffprobe of the selected media. The offset is also written to the medias comment, not to forget that there was a change made to the original time code.

I think, the best workflow is to save different variants of the script with whatever offsets you need.

Nils

using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using ScriptPortal.Vegas;
using System.Diagnostics;
using System.Windows.Forms;



public class EntryPoint
{
    public static Vegas myVegas;
    
    public void FromVegas(Vegas vegas)
    {
        myVegas = vegas;
                
        // set your offset in frames (project fps used) below, negative values possible
        string offsetInFrames ="00";
        
        Timecode offset = Timecode.FromString(offsetInFrames, RulerFormat.TimeAndFrames);
        Media[] selectedMedia = myVegas.Project.MediaPool.GetSelectedMedia();
            
        foreach (Media media in selectedMedia)
        {
            if (media.HasVideo())
            {        
                FileInfo file = new FileInfo(media.FilePath);                                        
                string mediaFilePath = Convert.ToString(file);
                mediaFilePath = mediaFilePath.ToLowerInvariant();
                
                //if (mediaFilePath.EndsWith(".mov"))
                {
                    string panaTimecode = GetTimeReference(mediaFilePath);                
                    //MessageBox.Show(panaTimecode);
                    
                    if (panaTimecode != "")
                    {
                        // Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.Time);    
                        Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.TimeAndFrames);
                        // Timecode newTimeIn = Timecode.FromString(panaTimecode, RulerFormat.SmpteEBU);                        
                        media.UseCustomTimecode = true;
                        media.RulerFormat = RulerFormat.TimeAndFrames;
                        //media.RulerFormat = RulerFormat.TimeAndFrames;
                        //media.RulerFormat = RulerFormat.SmpteEBU;
                        media.TimecodeIn = newTimeIn + offset;    
                        string commentOffset = "File TC & " + offsetInFrames + " frames offset";
                        media.Comment = commentOffset;
                    }
                }                
            }    
        }        
        myVegas.Project.MediaPool.OpenAllMedia();
    }    
    static string GetTimeReference(string mediaFilePathTmp)
        {
            string ffprobeParameter = " -v error -select_streams v:0 -show_entries stream_tags=timecode -of default=nk=1:nw=1 -i " + "\"" + @mediaFilePathTmp + "\"";
            //MessageBox.Show(ffprobeParameter);
            Process processffprobe = new Process();
            processffprobe.StartInfo.FileName = @"C:\Program Files\ffmpeg\bin\ffprobe.exe";
            processffprobe.StartInfo.Arguments = ffprobeParameter;
            processffprobe.StartInfo.CreateNoWindow = true;
            processffprobe.StartInfo.UseShellExecute = false;
            processffprobe.StartInfo.RedirectStandardOutput = true;
            processffprobe.Start();

            string timeRefSampleRateTmp = processffprobe.StandardOutput.ReadToEnd();          

            return timeRefSampleRateTmp;
        }

}