get-video-duration
get-video-duration copied to clipboard
Not working on Linux?
Hey guys!
Im using your package to get video duration after uploading on S3 Bucket. On my local computer, it
s 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 can
t understand what`s problem
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?
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' }"
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
).
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.
Does [email protected]
with a user-provided path to ffprobe
solve this issue?
Does
[email protected]
with a user-provided path toffprobe
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
}
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 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.
Got it working with also the custom path to ffprobe in my docker container.
const duration = await getVideoDurationInSeconds(
config.introOutro.sourceUrl, '/usr/bin/ffprobe'
);
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 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
How should users who deploy to Vercel solve this?