fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.82k stars 874 forks source link

ffprobe returning with exit code 1, pipe:0: I/O error with gif input stream #1000

Open summera opened 4 years ago

summera commented 4 years ago

Version information

Latest on master

Code to reproduce

This fails:

const ffmpeg = require("fluent-ffmpeg");
const fs = require("fs");
let file = fs.createReadStream("/usr/app/giphy.gif");

ffmpeg.ffprobe(file, ["-v", "debug", ], (err, data)=> {
  console.log("err:", err);
  console.log("data:", data);
});

This works:

const ffmpeg = require("fluent-ffmpeg");

ffmpeg.ffprobe("/usr/app/giphy.gif", ["-v", "debug", ], (err, data)=> {
  console.log("err:", err);
  console.log("data:", data);
});

Expected results

Outputs metadata from ffprobe.

Observed results

Note that, as mentioned above, using a path to a file rather than a stream works fine. Using a stream with MP4 files works fine. The issue is popping up with a GIF stream. I've tried using a GIF stream with fs and one from AWS S3, and both fail in the same way.

err: Error: ffprobe exited with code 1 ffprobe version 4.2.2 Copyright (c) 2007-2019 the FFmpeg developers built with gcc 9.2.0 (Alpine 9.2.0) configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 [NULL @ 0x561a8350b140] Opening 'pipe:0' for reading [pipe @ 0x561a8350b980] Setting default whitelist 'crypto' [gif @ 0x561a8350b140] Format gif probed with size=2048 and score=100 [AVIOContext @ 0x561a83513b80] Statistics: 264749 bytes read, 0 seeks pipe:0: I/O error

at ChildProcess.<anonymous> (/usr/app/node_modules/fluent-ffmpeg/lib/ffprobe.js:233:22)
at ChildProcess.emit (events.js:311:20)
at ChildProcess.EventEmitter.emit (domain.js:482:12)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

data: undefined

Checklist

Thanks for the help!

federicocarboni commented 3 years ago

@summera Related to #1013. to use a streaming GIF file you have to set the format to gif_pipe (using -f gif_pipe), this is not mentioned on the FFmpeg Docs but it should be.