Kris Niles : ok trying now … !
Kris Niles : Ok! I think we are getting somewhere… it seems to be working - but I just now got this error from ffmpeg, after replaying:
'/tmp/clip-default_tc.mp3' already exists. Overwrite ? [y/N]
I assumed that on each run the /tmp/ files were not carried over… is that not the case?
Kris Niles : Well either way, I added a -y
to ffmpeg, which automatically overwrites any files … and so far so good!
Ok, so here’s what I’ve got below. I’m still getting the active_handle
error, but it’s working… not sure how to resolve that, or if I need to.
Giao Phan : Ah, good catch, no /tmp is not cleared out between runs. We tend to use the tmp
module when we create stuff: tmp - npm
Kris Niles : ahhh - ok. That’s good for me to know. Do I eventually need to clear that out, if I’m running a lot of files through there?
Giao Phan : Yeah, that’s good practice. As to the active_handle warning, I think it might be because you are returning clip
which keeps the childprocess in scope.
Giao Phan : But if the ffmpeg is finished, you should be fine.
Kris Niles : yes - so far I’ve had 10 successful runs, and zero errors
Kris Niles : So I think we are good to go for now - until the next obstacle.
Kris Niles : oh - but last question - do I need to keep the timeout on the exec call?
Kris Niles : ```
const clip = await exec(`${ffmpegPath} -y -i ${filePath} -ss ${startTime} -map 0:a -acodec copy -t ${duration} /tmp/clip-${fileName}, {timeout: 5000});
Kris Niles : I think Dylan was just asking me to set that up for debugging… but it seems like it’s not needed?
Kris Niles : Either way - thank you Giao! You rock!
Giao Phan : Yeah, now that we figured out the root cause, I think you should be okay without the timeout.