fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when input data is stream, input/output error shows up

Hyeoghwan opened this issue · comments

Version information

  • fluent-ffmpeg version: version N-109856-gf8d6d0fbf1-tessus
  • ffprobe version: 2.1.2
  • OS: Big Sur Mac

Code to reproduce

I attached the test.gif file on https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/assets/122068264/e1f3aa31-5386-4dab-a409-9a224e0610fe

const ffprobeInstaller = require('@ffprobe-installer/ffprobe');
const ffmpeg = require('fluent-ffmpeg');
const { Readable } = require('stream');
const fs = require('fs');


(async () => {

    const buffer = fs.readFileSync('test.gif');
    let readableStream = new Readable();
    readableStream._read = () => { };
    readableStream.push(buffer);
    readableStream.push(null);

    // console.log(ffprobe.path, ffprobe.version);
    ffmpeg.setFfprobePath(ffprobeInstaller.path);
    let metadata = await get_video_meta_data(readableStream);

    async function get_video_meta_data(stream) {
        return new Promise((resolve, reject) => {
            new ffmpeg()
                .input(stream)
                .ffprobe((err, data) => {
                    // console.log(err);
                });
            resolve();
        });
    }
})();

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

data should include duration but empty.

Observed results

data is empty and err happens.
Here is error data:


  libavutil      58.  1.100 / 58.  1.100
  libavcodec     60.  2.100 / 60.  2.100
  libavformat    60.  2.100 / 60.  2.100
  libavdevice    60.  0.100 / 60.  0.100
  libavfilter     9.  1.100 /  9.  1.100
  libswscale      7.  0.100 /  7.  0.100
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    57.  0.100 / 57.  0.100
pipe:0: Input/output error

I only need the metadta for the input gif file. specifically, duration field.