简体   繁体   中英

Fluent-FFmpeg Error: ffprobe exited with code 1

I'm using a Lambda function to split a given file into pieces, and often I receive an error during the file processing:

{
    "errorType": "Error",
    "errorMessage": "ffprobe exited with code 1\nffprobe version 4.2.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2019 the FFmpeg developers\n  built with gcc 8 (Debian 8.3.0-6)\n  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg\n  libavutil      56. 31.100 / 56. 31.100\n  libavcodec     58. 54.100 / 58. 54.100\n  libavformat    58. 29.100 / 58. 29.100\n  libavdevice    58.  8.100 / 58.  8.100\n  libavfilter     7. 57.100 /  7. 57.100\n  libswscale      5.  5.100 /  5.  5.100\n  libswresample   3.  5.100 /  3.  5.100\n  libpostproc    55.  5.100 / 55.  5.100\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6f35c40] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!\n[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6f35c40] moov atom not found\n/tmp/file.mp4: Invalid data found when processing input\n",
    "stack": [
        "Error: ffprobe exited with code 1",
        "ffprobe version 4.2.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2019 the FFmpeg developers",
        "  built with gcc 8 (Debian 8.3.0-6)",
        "  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg",
        "  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",
        "  libswscale      5.  5.100 /  5.  5.100",
        "  libswresample   3.  5.100 /  3.  5.100",
        "  libpostproc    55.  5.100 / 55.  5.100",
        "[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6f35c40] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!",
        "[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6f35c40] moov atom not found",
        "/tmp/file.mp4: Invalid data found when processing input",
        "",
        "    at ChildProcess.<anonymous> (/var/task/node_modules/fluent-ffmpeg/lib/ffprobe.js:233:22)",
        "    at ChildProcess.emit (events.js:198:13)",
        "    at ChildProcess.EventEmitter.emit (domain.js:448:20)",
        "    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)"
    ]
}

I see the error message, and what it is telling me, but what I cannot understand is that this very file works sometimes. Before the process starts I download the file from S3 into my Lambda container, maybe this is my problem, but still, this works sometimes.

After a long investigation, turns out that my problem was indeed how my source files were being downloaded from S3, so after fixing that, no more errors were thrown!

For later reference, here is what has changed in my process, hope it helps somebody in the future.

This was how it was downloading the file:

    return new Promise((resolve: Function, reject: Function): void => {
      const s3Stream: stream.Readable = this.client.getObject(params).createReadStream()
      const fileStream: stream.Writable = fs.createWriteStream(filePath)
      s3Stream.on('error', () => {
        fileStream.destroy()
        reject()
      })
      fileStream.on('error', () => {
        s3Stream.destroy()
        reject()
      })
      s3Stream.pipe(fileStream)
        .on('close', resolve())
      })
    }

And now after the changes:

    return new Promise((resolve: Function, reject: Function): void => {
      const fileStream: stream.Writable = fs.createWriteStream(filePath)
      this.client.getObject(params)
        .on('error', (err: NodeJS.ErrnoException) => {
          fileStream.destroy()
          reject(err)
        })
        .on('httpData', (chunk: unknown) => {
          fileStream.write(chunk);
        })
        .on('httpDone', () => {
          fileStream.end();
          resolve()
        })
        .send();
      })
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM