Error: ffmpeg exited with code 1

Error: ffmpeg exited with code 1 at ChildProcess.<anonymous> (/app/node_modules/.pnpm/[email protected]/node_modules/fluent-ffmpeg/lib/processor.js:182:22) at ChildProcess.emit (node:events:517:28) at ChildProcess.emit (node:domain:489:12) at ChildProcess._handle.onexit (node:internal/child_process:292:12) Node.js v18.18.2 I'm currently trying to write an image to a volume using FFMPEG FFMPEG is installed using the railway.json
"nixpacksPlan": {
"phases": {
"setup": {
"aptPkgs": ["...", "ffmpeg"]
}
},
"providers": ["node"]
}
"nixpacksPlan": {
"phases": {
"setup": {
"aptPkgs": ["...", "ffmpeg"]
}
},
"providers": ["node"]
}
I'm able to write other files to the volume path but ffmpeg fails without any error. Am I not able to write jpgs to disk?
2 Replies
Percy
Percy11mo ago
Project ID: 3f47026d-e5d4-4f7d-8505-9c3c3185adf2
zachHallway
zachHallwayOP11mo ago
3f47026d-e5d4-4f7d-8505-9c3c3185adf2 Verified that the paths do exist for FFMPEG FFmpeg path: /bin/ffmpeg FFmpeg probe: /bin/ffprobe using execSync("which ffmpeg", { encoding: "utf-8" }).trim();
export function videoToFrames(
inputFilePath: string,
outputFilePath: string,
options: GetFrameOptions,
): Promise<void> {
const { fps = 1, resolution = "512x512" } = options;

return new Promise((resolve, reject) => {
ffmpeg(inputFilePath)
.outputOptions(`-r ${fps}`)
.outputOptions(`-s ${resolution}`)
// .outputOptions("-c:v libwebp") // Specify the WebP codec
.on("end", () => {
resolve();
})
.on("error", (err) => {
reject(err);
})
.output(`${outputFilePath}/frame_%d.jpeg`) // Specify the output file
.run();
});
}
export function videoToFrames(
inputFilePath: string,
outputFilePath: string,
options: GetFrameOptions,
): Promise<void> {
const { fps = 1, resolution = "512x512" } = options;

return new Promise((resolve, reject) => {
ffmpeg(inputFilePath)
.outputOptions(`-r ${fps}`)
.outputOptions(`-s ${resolution}`)
// .outputOptions("-c:v libwebp") // Specify the WebP codec
.on("end", () => {
resolve();
})
.on("error", (err) => {
reject(err);
})
.output(`${outputFilePath}/frame_%d.jpeg`) // Specify the output file
.run();
});
}
Problematic function is here, no crash when there is no output command. Works fine locally in development mode. output file path is path.join(env.RAILWAY_VOLUME_MOUNT_PATH, DATE_SLUG, VIDEO_FILE_NAME) Dang its fixed when adding a nixpacks.toml Thought that the railway.json with the apt-get would work, since it was installing in the docker image.
[phases.setup]
nixPkgs = ['...', 'ffmpeg']
[phases.setup]
nixPkgs = ['...', 'ffmpeg']
Add this tofix
Want results from more Discord servers?
Add your server