get-video-duration icon indicating copy to clipboard operation
get-video-duration copied to clipboard

Not working on Linux?

Open kavto18 opened this issue 3 years ago • 7 comments

Hey guys! Im using your package to get video duration after uploading on S3 Bucket. On my local computer, its working perfectly, but after releasing to Linux server, the whole app is crashing and Im getting error "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined". If I comment import "//import {getVideoDurationInSeconds} from 'get-video-duration';" app is working again. Just cant understand what`s problem

kavto18 avatar Dec 16 '21 12:12 kavto18

Could you provide more information about the error? If the issue is in the import statement then it might be an issue related to the Node.js version you are using in the Linux server vs your local machine. Which version of Node.js are you using to run the script?

Sumolari avatar Dec 16 '21 14:12 Sumolari

Thanks for your response. My local node version is v16.13.1 Linux node version v14.18.0

It builds successfully, but after starting, this error occurs and application doesn`t start

This is the whole error "TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at new NodeError (internal/errors.js:322:7) at validateString (internal/validators.js:124:11) at Object.dirname (path.js:1248:5) at Object.89416 (/opt/empower/admin.js:193322:22) at webpack_require (/opt/empower/admin.js:260551:42) at Object.92089 (/opt/empower/admin.js:60589:34) at webpack_require (/opt/empower/admin.js:260551:42) at Object.65552 (/opt/empower/admin.js:231570:44) at webpack_require (/opt/empower/admin.js:260551:42) at Object.92883 (/opt/empower/admin.js:227825:45) at webpack_require (/opt/empower/admin.js:260551:42) at Object.70374 (/opt/empower/admin.js:227390:41) at webpack_require (/opt/empower/admin.js:260551:42) at Object.20123 (/opt/empower/admin.js:227750:44) at webpack_require (/opt/empower/admin.js:260551:42) at Object.17493 (/opt/empower/admin.js:225206:40) { code: 'ERR_INVALID_ARG_TYPE' }"

kavto18 avatar Dec 16 '21 15:12 kavto18

Can you correlate the stack trace with the original source code? Looks like webpack is merging everything into a single file and it hides the specific file that is passing undefined instead of a path.

It might be related to having ffprobe installed or even not having node-ffprobe-installer installed (it's suspicious that it's a webpack_require call the one that is failing instead of a call to getVideoDurationInSeconds).

Sumolari avatar Dec 16 '21 16:12 Sumolari

Hi guys, I was having a similar problem with node-ffprobe, my application was running on a Docker node:10-alpine image, I just changed to node:10-slim and solved my problem.

filipe-campos avatar Feb 07 '22 18:02 filipe-campos

Does [email protected] with a user-provided path to ffprobe solve this issue?

Sumolari avatar Apr 02 '22 07:04 Sumolari

Does [email protected] with a user-provided path to ffprobe solve this issue?

How and where do you specify a user provided path? This package also doesn't work on my Linux machine although I get a different error:

[06.07.2022 17:21.04.072] [ERROR] Error: Command was killed with SIGSEGV (Segmentation fault): /home/ubuntu/data.test.com/media-server/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://destination.s3.us-east-1.amazonaws.com/videos/2792bfaecd23bb57a4aadbaa77d2d011.mp4
    at makeError (/home/ubuntu/data.test.com/media-server/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/home/ubuntu/data.test.com/media-server/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  shortMessage: 'Command was killed with SIGSEGV (Segmentation fault): /home/ubuntu/54.219.223.11/media-server/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://destination.s3.us-east-1.amazonaws.com/videos/2792bfaecd23bb57a4aadbaa77d2d011.mp4',
  command: '/home/ubuntu/data.test.com/media-server/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://destination.s3.us-east-1.amazonaws.com/videos/2792bfaecd23bb57a4aadbaa77d2d011.mp4',
  escapedCommand: '"/home/ubuntu/data.test.com/media-server/node_modules/@ffprobe-installer/linux-x64/ffprobe" -v error -show_format -show_streams "https://destination.s3.us-east-1.amazonaws.com/videos/2792bfaecd23bb57a4aadbaa77d2d011.mp4"',
  exitCode: undefined,
  signal: 'SIGSEGV',
  signalDescription: 'Segmentation fault',
  stdout: '',
  stderr: '',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

jahaskell53 avatar Jul 06 '22 17:07 jahaskell53

Nevermind, I see that you just add it as an argument to getVideoDurationInSeconds It worked for me when I added a custom file path.

jahaskell53 avatar Jul 06 '22 20:07 jahaskell53

@jahaskell53 how did you solve this issue. I am stuck on this. On ubuntu server I am getting segmentation fault. On mac it was running smoothly. Screenshot 2022-11-01 at 5 39 52 PM

tanujs22 avatar Nov 01 '22 12:11 tanujs22

Got it working with also the custom path to ffprobe in my docker container.

 const duration = await getVideoDurationInSeconds(
        config.introOutro.sourceUrl, '/usr/bin/ffprobe'
      );

philippmunzert avatar Apr 13 '23 16:04 philippmunzert

I am getting this error when the app is deployed on Heroku

 error===> Error: Command was killed with SIGSEGV (Segmentation fault): /app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams http://res.cloudinary.com/defenderkhan/video/upload/v1690269115/audio/v81yg1sg1ewkaslewy23.mp3

On local its giving me length In seconds fine

ZeeshanAhmadKhalil avatar Jul 25 '23 07:07 ZeeshanAhmadKhalil

@ZeeshanAhmadKhalil Have you tried running ffprobe directly in Heroku? Looks like an installation issue of ffprobe binaries. You might need to add some [additional buildpack](https://stackoverflow.com/a/52142087 to get ffprobe running there

Sumolari avatar Jul 29 '23 08:07 Sumolari

How should users who deploy to Vercel solve this?

atumas-bananamilk avatar Oct 30 '23 02:10 atumas-bananamilk