OpenNewsLabs / autoEdit_2

Fast text based video editing, node Electron Os X desktop app, with Backbone front end.
https://opennewslabs.github.io/autoEdit_2/
MIT License
418 stars 56 forks source link

Word to time correspondence in Transcription to Adobe CEP Panel #66

Closed pietrop closed 5 years ago

pietrop commented 5 years ago

Describe the bug

Word to time correspondence in Transcription to Adobe CEP Panel seems to be off.

To Reproduce Steps to reproduce the behavior:

  1. Go to autoEdit2 Adobe CEP Panel
  2. Click on a transcription
  3. Click on a word,
  4. Some words, some times, don't move the playhead in the source monitor at the right point.

Expected behavior

Expect that when click on a word, it loads clip in source monitor, and move playhead to corresponding timecode.

Screenshots If applicable, add screenshots or screenrecording/gif to help explain your problem.

Desktop (please complete the following information):

Additional context

examining the transcription json to see what words are not "working", found that this works:

{
    "id": 4,
    "startTime": 61.1,
    "endTime": 61.766666666666666,
    "text": "interview."
},

But this doesn't

{
    "id": 5,
    "startTime": 61.766666666666666,
    "endTime": 61.833333333333336,
    "text": "I"
},

Adobe CEP jsx takes, seconds with frames, so perhaps need to convert the autoEdit json word timecode that is just in seconds to that format or round up the milliseconds.

see function in documentationsecondsToFrames

function secondsToFrames(time){
    var buffer = 3 // amount of frames to jump before the start of the word to make it a little less abrupt
    let fps = 25;
    var base = Math.floor(time)
    var fraction = time - base
    var frames = Math.floor(fps * fraction) - buffer
    if (frames < 1){
        frames = fps + frames 
        base -= 1; 
    }
    return String(base) + '.' + String(frames)
}
pietrop commented 5 years ago

Made these changes in CEP Jsx file. Tested, seems to work, will release in next iteration of the panel.