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

Script to Import HiLights into Premiere Pro

[ New ]

Full disclosure - I'm barely passable at javascript and have very little experience with Adobe scripting.  This seems to be working for me, but use at your own risk.  If anyone thinks of a way this could be done better, I'd love suggestions.


I take a lot of long videos (full softball games), and it's a pain to dig through so much footage to look for a certain play or at bat.  HiLights are great, but the only way I can see them is to export video through the app - which takes a ton longer than just copying files over from the SD card.  This script will loop through the clips added to your active sequence and import any GoPro HiLights it finds as Markers.


You'll need to:

  • Have Premiere Pro running with an active sequence with GoPro videos that contain HiLights.
  • Install Adobe ExtendScript Toolkit CC.  This normally isn't visible by default in the apps you can download using Creative Cloud.  In Creative Cloud, click on your profile icon, then Preferences, the Apps.  Enable Show Older Apps.  ExtendScript should now show up as an app you can download and install.
  • In ExtendScript, select Adobe Premiere Pro 2021 (the only one I've tested with) in the upper, left-hand drop down.

Run this script:



var project = app.project;
var sequence = project.activeSequence;
var tracks = sequence.videoTracks;

for(var i = 0; i < tracks.numTracks;i++){
    var track = tracks[i]
    var clips = track.clips;    
    //Loop through clips
    for (var ii = 0; ii < clips.numItems;ii++){
        var clip = clips[ii]
        var path = clip.projectItem.getMediaPath()
        //Print clip name
        //Check to see if file exists
        var media = new File(path);
        if (!media.exists){
            $.write(' (MISSING FILE)');
        //Print clip details
        $.writeln('   Start:\t\t',clip.start.seconds);
        $.writeln('   End:\t\t',clip.end.seconds);
        $.writeln('   Dur:\t\t',clip.duration.seconds);
        $.writeln('   In:\t\t',clip.inPoint.seconds);
        $.writeln('   Out:\t\t',clip.outPoint.seconds);
        $.writeln('   Speed:\t\t',clip.getSpeed());
        //If file doesn't exist, don't check for HiLights
        if (!media.exists){
        //Check for HiLights
        var hls = getHiLights(path);
        if (hls.length > 0) {
            $.writeln('   ',hls.length,' HiLights found:')
            for (var iii = 0;iii<hls.length;iii++){
                $.write('      Location:\t' + hls[iii]);
                //Set start in seconds
                var start = hls[iii]/1000;
                //Offset by clip in point
                start -= clip.inPoint.seconds;
                //Adjust for speed
                start = start/clip.getSpeed();
                //Offset by clip start position
                start += clip.start.seconds;
                //add marker
                addMarker(sequence,start,'GoPro HiLight','');
                $.writeln(' - ADDED')
        } else {
            $.writeln('   No HiLights found.')

function getHiLights(path){
    var buf = 200000
    var pat = 'HLMT?$'
    var file = new File(path);;
    file.encoding = "binary";      
    var hls = [];
    var data =;
    var loc = data.indexOf(pat);
    //If marker not found in start of file, try end
    if (loc == -1){
        if (,2)){;
            data =;
            loc = data.indexOf(pat);
    if (loc != -1){
        //Trim data to just what's needed
        data = data.substring(loc);
        //Get number of HiLights
        var numHLs = data.charCodeAt(7);
        //Loop through HiLights getting positions in milliseconds
        for (var i = 0; i < numHLs;i++){            
            var offset = i * 36
            var ms = 0
            ms += data.charCodeAt(8+offset)*Math.pow(256,3);            
            ms += data.charCodeAt(8+offset+1)*Math.pow(256,2);
            ms += data.charCodeAt(8+offset+2)*256;
            ms += data.charCodeAt(8+offset+3);
    return hls;

function addMarker(seq,loc,name,comm){
    //Duration not needed as HiLights don't have durations

Hope this helps someone!

Posts: 7,744

Re: Script to Import HiLights into Premiere Pro

[ New ]

This is pretty awesome and an excellent idea, I cannot wait to try this out.  I'm guessing a lot of people will really appreciate the work and effort you put into this.  Well done and thank you for sharing!