digital-paper-edit-electron icon indicating copy to clipboard operation
digital-paper-edit-electron copied to clipboard

Batch transcription failing randomly on mac

Open motioncircus opened this issue 3 years ago • 5 comments

Describe the bug I'm having random failed transcriptions on a mac even after upgrading AssemblyAi to pro account and adding funds

To Reproduce Steps to reproduce the behavior:

  1. Go to add BATCH TRANSCRIPTS
  2. Click on several source files - I've been trying ten at a time with minor success but now getting more and more fails
  3. Watch the circle of process continue for hours

Expected behavior All batch transcripts to be queued and processed successfully

Desktop (please complete the following information):

  • OS: iOS - on a 2019 macbook pro with 32 GIGs RAM
  • Browser Safari
  • Version [e.g. 22]

Additional context Initially I had some success with batch transcribe - compared to on my PC where the many ffmpg processes ground things to a halt. However now I have nearly a hundred transcripts and my transcripts JSON file in the db folder is over 30 MEG I'm wondering if the problem lies in the update of the JSON file. Maybe the files are failing to access the db in an orderly fashion?

I'm now back to adding transcriptions one at a time and, after 5 files, I've had no failures.

motioncircus avatar May 26 '21 05:05 motioncircus

Hi @motioncircus It sounds like yes it could be a race condition in writing to the file.

The batch feature is still pretty experimental, and I am considering removing it in future releases until I can find a way to re-architect it, and roll it out with proper support. At the moment there's a few things I am unclear on how to do there. Such as maybe create a queue for the transcriptions to avoid having all these processes run at the same time etc.. Or how to properly handle that possible race condition etc..

Thanks for the insight, and baring with it

pietrop avatar May 26 '21 14:05 pietrop

Thanks Pietro,

I wish I could help but I'm only conversant with Python. It would seem like a simple for loop with a wait-until-previous-item is finished type of thing. What language would it need to be implemented in?

I'm still unclear on the elements of your system. N

Nigel Haslam *| Director *

Motion Circus Pty Ltd. Byron Bay t*: + 61 2 8007 7338 **|m: * + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Thu, May 27, 2021 at 12:02 AM Pietro @.***> wrote:

Hi @motioncircus https://github.com/motioncircus It sounds like yes it could be a race condition in writing to the file.

The batch feature is still pretty experimental, and I am considering removing it in future releases until I can find a way to re-architect it, and roll it out with proper support. At the moment there's a few things I am unclear on how to do there. Such as maybe create a queue for the transcriptions to avoid having all these processes run at the same time etc.. Or how to properly handle that possible race condition etc..

Thanks for the insight, and baring with it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pietrop/digital-paper-edit-electron/issues/77#issuecomment-848795640, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCDOEZ4NP2K64UGEV4YS7DTPT5OLANCNFSM45Q4ME7Q .

motioncircus avatar May 26 '21 21:05 motioncircus

I gave it a go in this branch testing-batch-fix a while back but not much luck.

In theory yes, wait-until-previous-item is the way to go. In practice, I think the problem with javascript/node is that because it's single threaded with the event loop etc... it's asynchronous by default. And not sure using something like async await will bee sufficient to stack them operation one after the other synchronously. If that makes sense? Like I think even if you use async await, it will still spawn multiple ffmpeg processes in parallel.

But yeah still trying to figure this out, so any thoughts ideas, etc.. very much welcome


re system level overview

  • you submit an audio or video file
  • the app save an entry to the local "database" using diskdb
    • diskdb is basically just a collection of json files on the local disk
  • then it triggers ffmpeg conversion to audio and video
  • ffprobe is used to read metadata from the video, and read any timecode offset that might be present, eg from camcorder footage, like free run, rec run, time of the day etc.. (This is also how you can import a really large file directly from a camcorder card, or external hard drive)
  • the audio version is then sent to the Speech To Text service of choice
  • the video is only for local preview
  • when the transcript is ready, it is parsed into "DPE format" and saved to the transcript entry in diskdb
  • and the transcript then becomes available in the UI
  • etc..

Just for reference at even higher level overview of the architecture here, note that this is from autoEdit v2 but there's elements of that at a high level that still apply to v3 to a certain extent.

but let me know if you got any questions on how the app/system works.

pietrop avatar May 28 '21 03:05 pietrop

Hi Pietro,

I'm not game to roll up my sleeves on this I'm afraid but I have done some googling and asked a couple of people who were sharing node based video batch JS scripts on GitHub.

I also stumbled on this promising looking thing

https://zweck.io/video-encoding-using-ffmpeg-node-js-with-an-active-queue/

I wish I could do more.

Meanwhile I've processed over 300 videos with AutoEdit 3 and am still going. It's going to be a long edit!

Happy weekend matey N

Nigel Haslam *| Director *

Motion Circus Pty Ltd. Byron Bay t*: + 61 2 8007 7338 **|m: * + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, May 28, 2021 at 1:28 PM Pietro @.***> wrote:

I gave it a go in this branch testing-batch-fix https://github.com/pietrop/digital-paper-edit-electron/tree/testing-batch-fix a while back but not much luck.

In theory yes, wait-until-previous-item is the way to go. In practice, I think the problem with javascript/node is that because it's single threaded with the event loop etc... it's asynchronous by default. And not sure using something like async await will bee sufficient to stack them operation one after the other synchronously. If that makes sense? Like I think even if you use async await, it will still spawn multiple ffmpeg processes in parallel.

But yeah still trying to figure this out, so any thoughts ideas, etc.. very much welcome

re system level overview

  • you submit an audio or video file
  • the app save an entry to the local "database" using diskdb https://www.npmjs.com/package/diskdb
    • diskdb is basically just a collection of json files on the local disk
  • then it triggers ffmpeg https://en.wikipedia.org/wiki/FFmpeg conversion to audio and video
  • ffprobe https://ffmpeg.org/ffprobe.html is used to read metadata from the video, and read any timecode offset that might be present, eg from camcorder footage, like free run, rec run, time of the day etc.. (This is also how you can import a really large file directly from a camcorder card, or external hard drive)
  • the audio version is then sent to the Speech To Text service of choice
  • the video is only for local preview
  • when the transcript is ready, it is parsed into "DPE format" and saved to the transcript entry in diskdb
  • and the transcript then becomes available in the UI
  • etc..

Just for reference at even higher level overview of the architecture here https://textav.gitbook.io/textav-event-2018/projects/autoedit-panel-for-adobe-cep-pietro, note that this is from autoEdit v2 but there's elements of that at a high level that still apply to v3 to a certain extent.

but let me know if you got any questions on how the app/system works.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pietrop/digital-paper-edit-electron/issues/77#issuecomment-850084369, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCDOEYLZ5JXPLUAOID47KTTP4ET5ANCNFSM45Q4ME7Q .

motioncircus avatar May 29 '21 05:05 motioncircus

Hey Pietro,

I've had some promising success in sharing the AutoEdit project across machines.

In one test I on the MAC platform I simply created a matching USER account

  • copied the digital-paper-edit-electron folder from the ingestion MAC and it worked straight out of the box

In another, I searched and replaced the file various paths in the transcription.json file and got the MAC ingested project to work on my PC. Phew, that was tricky!

However I've run into some serious slowdown now that I've got hundreds of clips ingested into one project and some early experiments suggest that I will have less of a slowdown if I spread the video clips across several projects.

I've figured out how to do this, by creating new projects in AutoEdit3 and then copying and replacing project ID's in the *transcripts.json *which is now almost 40 MEG in size.

I've been struggling to do my various find and replace operations in Notepad++ which shows the json as a whole fat block of text, which is very hard to deal with. I did try a few online JSON to CSV converters, which make the data more friendly looking and editable but I haven't managed to get a working JSON file back yet

I write in the hope that you may know of a non online json/spreadsheet tool that will help in the editing of the transcription.json file? (preferably a PC application because I don't have a mouse for the MAC and the trackpad is a nightmare)

Cheers

Nigel Haslam *| Director *

Motion Circus Pty Ltd. Byron Bay t*: + 61 2 8007 7338 **|m: * + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Sat, May 29, 2021 at 3:58 PM Nigel Haslam @.***> wrote:

Hi Pietro,

I'm not game to roll up my sleeves on this I'm afraid but I have done some googling and asked a couple of people who were sharing node based video batch JS scripts on GitHub.

I also stumbled on this promising looking thing

https://zweck.io/video-encoding-using-ffmpeg-node-js-with-an-active-queue/

I wish I could do more.

Meanwhile I've processed over 300 videos with AutoEdit 3 and am still going. It's going to be a long edit!

Happy weekend matey N

Nigel Haslam *| Director *

Motion Circus Pty Ltd. Byron Bay t*: + 61 2 8007 7338 **|m: * + 61 403 020 126 w: www.motioncircus.com http://www.motioncircus.com/ link to website http://motioncircus.com

On Fri, May 28, 2021 at 1:28 PM Pietro @.***> wrote:

I gave it a go in this branch testing-batch-fix https://github.com/pietrop/digital-paper-edit-electron/tree/testing-batch-fix a while back but not much luck.

In theory yes, wait-until-previous-item is the way to go. In practice, I think the problem with javascript/node is that because it's single threaded with the event loop etc... it's asynchronous by default. And not sure using something like async await will bee sufficient to stack them operation one after the other synchronously. If that makes sense? Like I think even if you use async await, it will still spawn multiple ffmpeg processes in parallel.

But yeah still trying to figure this out, so any thoughts ideas, etc.. very much welcome

re system level overview

  • you submit an audio or video file
  • the app save an entry to the local "database" using diskdb https://www.npmjs.com/package/diskdb
    • diskdb is basically just a collection of json files on the local disk
  • then it triggers ffmpeg https://en.wikipedia.org/wiki/FFmpeg conversion to audio and video
  • ffprobe https://ffmpeg.org/ffprobe.html is used to read metadata from the video, and read any timecode offset that might be present, eg from camcorder footage, like free run, rec run, time of the day etc.. (This is also how you can import a really large file directly from a camcorder card, or external hard drive)
  • the audio version is then sent to the Speech To Text service of choice
  • the video is only for local preview
  • when the transcript is ready, it is parsed into "DPE format" and saved to the transcript entry in diskdb
  • and the transcript then becomes available in the UI
  • etc..

Just for reference at even higher level overview of the architecture here https://textav.gitbook.io/textav-event-2018/projects/autoedit-panel-for-adobe-cep-pietro, note that this is from autoEdit v2 but there's elements of that at a high level that still apply to v3 to a certain extent.

but let me know if you got any questions on how the app/system works.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pietrop/digital-paper-edit-electron/issues/77#issuecomment-850084369, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCDOEYLZ5JXPLUAOID47KTTP4ET5ANCNFSM45Q4ME7Q .

motioncircus avatar May 30 '21 08:05 motioncircus