ffprobe
ffprobe copied to clipboard
Not loading within docker
It works locally just fine. MacOS M1 Max.
On Prod/Docker release "streams" is undefined.
I have the following dependencies
"@types/ffprobe": "^1.1.3",
"@types/ffprobe-static": "^2.0.1",
"ffprobe": "^1.1.2",
"ffprobe-static": "^3.1.0"
Importing
import * as ffprobeStatic from 'ffprobe-static';
import * as ffprobe from 'ffprobe';
The following code.
// !!!! the issue here, fileProbe | streams is undefined !!!
const fileProbe = await ffprobe.default(fileLink, { path: ffprobeStatic.path });
fileProbe.streams.forEach((s) => {
The following docker file
FROM ubuntu:22.10
# Update
RUN apt-get -y update
RUN apt install -y wget
# Install node 16
ENV NODE_VERSION=16.15.1
RUN apt install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
# Create app directory
RUN mkdir -p /app
WORKDIR /app
# PNG ,JPG ,Tiff & WebP support
# Consider adding more support with testing https://gist.github.com/hurricup/e14ae5bc47705fca6b1680e7a1fb6580
RUN apt install -y libjpeg-dev
RUN apt install -y libpng-dev
RUN apt install -y libtiff-dev
RUN apt install -y libwebp-dev
RUN apt install -y libheif-dev
WORKDIR /app
# Install ruby for ImageMagick
RUN apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
RUN apt-get -y install wget && apt-get install -y ruby-full && ruby -v
# Install ImageMagick
RUN apt-get install imagemagick -y
# For various apis
RUN apt-get install python3-pip -y
# Cache npm and install
WORKDIR /tmp
ADD package.json /tmp/
RUN npm config set registry https://registry.npmjs.org/
RUN npm install
RUN cp -a /tmp/node_modules /app/
# Run the geo-lite premimum update
RUN node ./node_modules/geoip-lite/scripts/updatedb.js license_key=1234AABB
# Move app and build app
WORKDIR /app
COPY . /app
RUN npm run build
# Remove the source so no one can steal it.
RUN rm -r -d src
COPY ./certs/ /app/dist/certs/
# Start the app.
EXPOSE 8080
EXPOSE 5000
CMD ["npm", "run", "start"]

Logs from server
I've provided a simple setup to emulate this. Still doesn't work.
index.js
const ffprobe = require('ffprobe');
const ffprobeStatic = require('ffprobe-static');
const init = async () => {
console.log('Running')
try {
const info = await ffprobe("https://storage.googleapis.com/vegiano-dev/dummy-videos/prcessing_video_1.mp4", { path: ffprobeStatic.path })
console.log(info);
} catch (e) {
console.error(e)
}
}
init();
Dockerfile
FROM ubuntu:22.10
# Update
RUN apt-get -y update
RUN apt install -y wget
RUN apt-get install -y --no-install-recommends ffmpeg
# Install node 16
ENV NODE_VERSION=16.15.1
RUN apt install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version
# Create app directory
RUN mkdir -p /app
WORKDIR /app
# Move app and build app
WORKDIR /app
COPY . /app
# Start the app.
EXPOSE 8080
EXPOSE 5000
CMD ["node", "index.js"]