caffco / get-video-duration

Get the duration of a video file
MIT License
138 stars 17 forks source link

/app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams #197

Closed nikakhachi closed 10 months ago

nikakhachi commented 2 years ago

"shortMessage": "Command failed with exit code 1: /app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams

This is the error message I get on AWS ECS when I try to get the duration of the video from the URL. locally, it works fine, I only encounter this issue on AWS.

This is the one of the video url-s on which it gives me an error (I don't think URL has anything to do with this error, since locally it works fine) : https://redirector.googlevideo.com/videoplayback?expire=1658275149&ei=7fDWYunHFI2D6dsP9--SeA&ip=168.119.239.75&id=o-AFrlD5L-GOVTro5bPts6zoH6YUzO5ZDbxjN3hy3GgODC&itag=18&source=youtube&requiressl=yes&mh=CV&mm=31%2C26&mn=sn-4g5e6nsd%2Csn-h0jelnes&ms=au%2Conr&mv=m&mvi=5&pl=25&initcwndbps=350000&vprv=1&mime=video%2Fmp4&gir=yes&clen=4442673&ratebypass=yes&dur=60.032&lmt=1658161543781145&mt=1658252478&fvip=2&fexp=24001373%2C24007246&c=ANDROID&txp=6310224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgCxtgMjIOHf-JCbLTr0XIddPeU2Iv994RkGu6L_gwpG8CIQCWeC33rs0lqpiPyVqBMMIF2YrAiH5R14LrFnla-0hWBA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAKnSbLoD5_DmzAoRzu9YCcSCm971ZgpwGP4deV3Y_PIvAiBrlOGi1IzlDKhghXadp7Ub506lFcWjzxa2XvdGvJgn2g%3D%3D&utmg=ytap1_rQjSvbzXBeA

Do you have any ideas why this happens ? Thanks !

Sumolari commented 2 years ago

Do you have a longer error message than that? Are you running the same Docker image locally?

nikakhachi commented 2 years ago

@Sumolari The docker image also shows this error locally. But when I run it without docker it works fine. Here's is complete log :

"shortMessage": "Command failed with exit code 1: /app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://redirector.googlevideo.com/videoplayback?expire=1658275149&ei=7fDWYunHFI2D6dsP9--SeA&ip=168.119.239.75&id=o-AFrlD5L-GOVTro5bPts6zoH6YUzO5ZDbxjN3hy3GgODC&itag=18&source=youtube&requiressl=yes&mh=CV&mm=31%2C26&mn=sn-4g5e6nsd%2Csn-h0jelnes&ms=au%2Conr&mv=m&mvi=5&pl=25&initcwndbps=350000&vprv=1&mime=video%2Fmp4&gir=yes&clen=4442673&ratebypass=yes&dur=60.032&lmt=1658161543781145&mt=1658252478&fvip=2&fexp=24001373%2C24007246&c=ANDROID&txp=6310224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgCxtgMjIOHf-JCbLTr0XIddPeU2Iv994RkGu6L_gwpG8CIQCWeC33rs0lqpiPyVqBMMIF2YrAiH5R14LrFnla-0hWBA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAKnSbLoD5_DmzAoRzu9YCcSCm971ZgpwGP4deV3Y_PIvAiBrlOGi1IzlDKhghXadp7Ub506lFcWjzxa2XvdGvJgn2g%3D%3D&utmg=ytap1_rQjSvbzXBeA", "command": "/app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://redirector.googlevideo.com/videoplayback?expire=1658275149&ei=7fDWYunHFI2D6dsP9--SeA&ip=168.119.239.75&id=o-AFrlD5L-GOVTro5bPts6zoH6YUzO5ZDbxjN3hy3GgODC&itag=18&source=youtube&requiressl=yes&mh=CV&mm=31%2C26&mn=sn-4g5e6nsd%2Csn-h0jelnes&ms=au%2Conr&mv=m&mvi=5&pl=25&initcwndbps=350000&vprv=1&mime=video%2Fmp4&gir=yes&clen=4442673&ratebypass=yes&dur=60.032&lmt=1658161543781145&mt=1658252478&fvip=2&fexp=24001373%2C24007246&c=ANDROID&txp=6310224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgCxtgMjIOHf-JCbLTr0XIddPeU2Iv994RkGu6L_gwpG8CIQCWeC33rs0lqpiPyVqBMMIF2YrAiH5R14LrFnla-0hWBA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAKnSbLoD5_DmzAoRzu9YCcSCm971ZgpwGP4deV3Y_PIvAiBrlOGi1IzlDKhghXadp7Ub506lFcWjzxa2XvdGvJgn2g%3D%3D&utmg=ytap1_rQjSvbzXBeA", "escapedCommand": "\"/app/node_modules/@ffprobe-installer/linux-x64/ffprobe\" -v error -show_format -show_streams \"https://redirector.googlevideo.com/videoplayback?expire=1658275149&ei=7fDWYunHFI2D6dsP9--SeA&ip=168.119.239.75&id=o-AFrlD5L-GOVTro5bPts6zoH6YUzO5ZDbxjN3hy3GgODC&itag=18&source=youtube&requiressl=yes&mh=CV&mm=31%2C26&mn=sn-4g5e6nsd%2Csn-h0jelnes&ms=au%2Conr&mv=m&mvi=5&pl=25&initcwndbps=350000&vprv=1&mime=video%2Fmp4&gir=yes&clen=4442673&ratebypass=yes&dur=60.032&lmt=1658161543781145&mt=1658252478&fvip=2&fexp=24001373%2C24007246&c=ANDROID&txp=6310224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgCxtgMjIOHf-JCbLTr0XIddPeU2Iv994RkGu6L_gwpG8CIQCWeC33rs0lqpiPyVqBMMIF2YrAiH5R14LrFnla-0hWBA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAKnSbLoD5_DmzAoRzu9YCcSCm971ZgpwGP4deV3Y_PIvAiBrlOGi1IzlDKhghXadp7Ub506lFcWjzxa2XvdGvJgn2g%3D%3D&utmg=ytap1_rQjSvbzXBeA\"", "exitCode": 1, "stdout": "", "stderr": "[tcp @ 0x59bed40] Failed to resolve hostname redirector.googlevideo.com: System error\nhttps://redirector.googlevideo.com/videoplayback?expire=1658275149&ei=7fDWYunHFI2D6dsP9--SeA&ip=168.119.239.75&id=o-AFrlD5L-GOVTro5bPts6zoH6YUzO5ZDbxjN3hy3GgODC&itag=18&source=youtube&requiressl=yes&mh=CV&mm=31%2C26&mn=sn-4g5e6nsd%2Csn-h0jelnes&ms=au%2Conr&mv=m&mvi=5&pl=25&initcwndbps=350000&vprv=1&mime=video%2Fmp4&gir=yes&clen=4442673&ratebypass=yes&dur=60.032&lmt=1658161543781145&mt=1658252478&fvip=2&fexp=24001373%2C24007246&c=ANDROID&txp=6310224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgCxtgMjIOHf-JCbLTr0XIddPeU2Iv994RkGu6L_gwpG8CIQCWeC33rs0lqpiPyVqBMMIF2YrAiH5R14LrFnla-0hWBA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAKnSbLoD5_DmzAoRzu9YCcSCm971ZgpwGP4deV3Y_PIvAiBrlOGi1IzlDKhghXadp7Ub506lFcWjzxa2XvdGvJgn2g%3D%3D&utmg=ytap1_rQjSvbzXBeA: Input/output error", "failed": true, "timedOut": false, "isCanceled": false, "killed": false

nikakhachi commented 2 years ago

My Docker looks like this :

FROM mhart/alpine-node:16 RUN mkdir /app WORKDIR /app COPY package*.json /app/ COPY prisma ./prisma/ RUN npm ci RUN npx prisma generate COPY . . RUN npm run build COPY . /app/ EXPOSE 5000 CMD ["node", "./build/server.js"]

Sumolari commented 2 years ago

It looks like the error is related to hostname resolution:

Failed to resolve hostname redirector.googlevideo.com

When I try to check that URL out I get back an HTTP 403 error. My guess is that your container is facing the same issue.

The Docker image looks ok. It should work fine with other videos.

Have you tried with other URLs?

nikakhachi commented 2 years ago

I get same Failed to resolve hostname errors on other URLs also.

Take this, for example : https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4

When I run it locally without a docker, it has no problem, no errors. But fails in docker.

Error: Command failed with exit code 1: /app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4

[tcp @ 0x73ef200] Failed to resolve hostname storage.googleapis.com: System error

https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4: Input/output error at makeError (/app/node_modules/execa/lib/error.js:60:11) at handlePromise (/app/node_modules/execa/index.js:118:26) at processTicksAndRejections (node:internal/process/task_queues:96:5)

{ shortMessage: 'Command failed with exit code 1: /app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4', command: '/app/node_modules/@ffprobe-installer/linux-x64/ffprobe -v error -show_format -show_streams https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4', escapedCommand: '"/app/node_modules/@ffprobe-installer/linux-x64/ffprobe" -v error -show_format -show_streams "https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4"', exitCode: 1, signal: undefined, signalDescription: undefined, stdout: '', stderr: '[tcp @ 0x73ef200] Failed to resolve hostname storage.googleapis.com: System error\n' + 'https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4: Input/output error', failed: true, timedOut: false, isCanceled: false, killed: false }

Sumolari commented 2 years ago

The Failed to resolve hostname doesn't seem to be related with the library.

Are you sure the container is able to access that URL? You can try downloading them to the local filesystem using wget or cURL and checking the md5sum of the file. It should match the md5sum you would get in your machine.

tonganh commented 1 year ago

Have any solution for that, I'm facing this problem and still don't know how to solve that :|

philippmunzert commented 1 year ago

Had this problem too and was related to ffprobe. Had to insert the path to the function call and this problem was fixed to maybe this helps someone:

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

Got this running within my docker container.