fluent-ffmpeg / node-fluent-ffmpeg

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

Gif creation still fails with -lavfi #595

Closed johndanek closed 8 years ago

johndanek commented 8 years ago

Unfortunately, the suggestion given in https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/588 did not fix the issue. It now produces a different, more vague error. (I commented on that issue, but since it was closed, I'm guessing no one got notifications about it)

The FFMPEG command being outputted is:

ffmpeg -i ./tmp0/input/trimmedFile.mp4 -i ./tmp0/input/palette.png -y -lavfi "fps=10 [x]; [x][1:v] paletteuse" ./tmp0/output/test.gif

And the error given is: Error: ffmpeg exited with code 1: Error initializing complex filters.

My code for creating the command is:

ffmpeg()
    .addInput(that.tmpDirNameInput+"/trimmedFile.mp4")
    .addInput(paletteFileName)
    .addOutputOption('-lavfi', '"fps='+that.instructions.params.fps+' [x]; [x][1:v] paletteuse"')
    .on('start', function(ffmpegCommand){
        console.log(new Date().toISOString()+" "+"Beginning gif creation:\n\t"+ffmpegCommand)
    })
    .on('end', function() {
        console.log(new Date().toISOString()+" "+"GIF created: "+that.instructions.params.filename+" complete! Check "+that.tmpDirNameOutput)
        resolve()
    })
    .on('error', function(error) {
        console.log(new Date().toISOString()+" "+"Error: "+error)
        reject(error)
    })
    .output(that.tmpDirNameOutput+"/"+that.instructions.params.filename)
    .run()
johndanek commented 8 years ago

I've tried a few variations, but have yet to find a solution to be able to use -lavfi to create a gif with a palette using fluent-ffmpeg. I can provide more information if necessary.

njoyard commented 8 years ago

Can you paste the full stderr output please ?

(btw don't hesitate to reopen issues when the problem is not solved)

johndanek commented 8 years ago

Here is the stderr output:

ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libx265 --disable-lzma --enable-nonfree --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './tmp1/input/trimmedFile.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.41.100
  Duration: 00:00:03.02, start: 0.000000, bitrate: 510 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 367 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 133 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, png_pipe, from './tmp1/input/palette.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
[AVFilterGraph @ 0x7fe05a521c20] No such filter: '"fps'
Error initializing complex filters.
Invalid argument

events.js:160
      throw er; // Unhandled 'error' event
johndanek commented 8 years ago

Upon reading the error, I realize that I needed to remove the inner double quotes around the filter. It now works. Thanks for your patience!

njoyard commented 8 years ago

Thanks for your patience, I'm not the one that waited 15 days to have their problem solved ;)