Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are URL inputs supported? #178

Open
connorbo97 opened this issue Apr 8, 2022 · 1 comment
Open

Are URL inputs supported? #178

connorbo97 opened this issue Apr 8, 2022 · 1 comment

Comments

@connorbo97
Copy link

In the CLI, ffmpeg can accept a URL as the input file

ffmpeg -i http://archive.org/download/athooPhahghookoaNg4o/A%20Life%20Among%20the%20Clouds%3A%20A%20NATURE%20Short%20Film-QI25c80h0WI-nomusic.mpeg4 -ss 8 -t 1 -vf fps=1 %d.jpg

However, when I try these arguments in ffmpeg.js, it doesn't recognize the protocol. Are URL inputs not supported? Am I inputting the arguments wrong?

const ffmpeg = require('ffmpeg.js');

ffmpeg({
  arguments: [
    '-i',
    'http://archive.org/download/athooPhahghookoaNg4o/A%20Life%20Among%20the%20Clouds%3A%20A%20NATURE%20Short%20Film-QI25c80h0WI-nomusic.mpeg4',
    '-ss',
    '8',
    '-t',
    '1',
    '-vf',
    'fps=1',
    '%d.jpg',
  ],
  print: function (data) {
    stdout += data + '\n';
  },
  printErr: function (data) {
    stderr += data + '\n';
  },
  onExit: function (code) {
    console.log('Process exited with code ' + code);
    console.log(stdout);
    console.log(stderr);
  },
});


The output is

Process exited with code 1

ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers

  built with emcc (Emscripten gcc/clang-like replacement) 1.39.11

  configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --disable-bzlib --disable-iconv --disable-libxcb --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --enable-zlib --enable-encoder=libvpx_vp8 --enable-encoder=libopus --enable-muxer=webm --enable-muxer=ogg --enable-muxer=null --enable-libopus --enable-libvpx --extra-cflags='-s USE_ZLIB=1 -I../libvpx/dist/include' --extra-ldflags=-L../libvpx/dist/lib

  libavutil      56. 31.100 / 56. 31.100

  libavcodec     58. 54.100 / 58. 54.100

  libavformat    58. 29.100 / 58. 29.100

  libavfilter     7. 57.100 /  7. 57.100

  libswscale      5.  5.100 /  5.  5.100

  libswresample   3.  5.100 /  3.  5.100

http://archive.org/download/athooPhahghookoaNg4o/A%20Life%20Among%20the%20Clouds%3A%20A%20NATURE%20Short%20Film-QI25c80h0WI-nomusic.mpeg4: Protocol not found

Did you mean file:http://archive.org/download/athooPhahghookoaNg4o/A%20Life%20Among%20the%20Clouds%3A%20A%20NATURE%20Short%20Film-QI25c80h0WI-nomusic.mpeg4?

Run with node v16.14.2

@Foosballfan
Copy link

Hey, you need to convert the video into an array buffer before passing to ffmpeg.js, e.g.:

      const vid = await fetch(url);
      const buffer = await vid.arrayBuffer();

      ffmpeg({
        MEMFS: [{ name: 'test.mp4', data: buffer }],
        arguments: [
          '-i',
          'test.mp4',
          ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants