fluent-ffmpeg / node-fluent-ffmpeg

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

Invalid data found when processing input only when running with fluent-ffmpeg #683

Open Tzelon opened 7 years ago

Tzelon commented 7 years ago

Version information

I'm trying to run the same command with ffmpeg from the command line and from Node with fluent-ffmpeg. when run on the command line everything working as expected but with fluent-ffmpeg I'm getting an error

Error: Cannot process video: ffmpeg exited with code 1: http://videomaker.demo.com/218616/p/demovideostream.m3u8 : Invalid data found when processing input

The command: ffmpeg -headers 'Cookie: _Auth=PHBrYW4+CiAgPGlzc3VlZEF0PjIwMTctMDMtMjQgMTY6MDI6MDkuNSBVVEM8L2lzc3VlZEF0PgogIDx0dGxNcz4yMTYwMzAwMDwvdHRsTXM+CiAgPGNoYW5uZWw+ZXNwbjE8L2NoYW5uZWw+CiAgPGFpcmluZ0lkPNpZ25lZD5mYWxzZTwvaXNTaWduZWQ+CjwvcGthbj4=' -analyzeduration 5000 -probesize 20000 -i http://videomaker.demo.com/218616/p/demovideostream.m3u8 -y -acodec copy -vcodec copy -c copy -bsf:a aac_adtstoasc ./outputfile.flv

fluent command

let command = ffmpeg(m3u8)
                        .inputOptions(` -headers 'Cookie: ${cookie}'`)
                        .inputOptions(` -analyzeduration 5000`)
                        .inputOptions(` -probesize 20000`)
                        .videoCodec('copy')
                        .audioCodec('copy')
                        .on('start', function(commandLine) {
                            console.log('Spawned Ffmpeg with command: ' + commandLine);
                        })
                        .on('codecData', function(data) {
                            console.log('Input is ' + data.audio + ' audio ' +
                                'with ' + data.video + ' video');
                        })
                        .on('error', function(err, stdout, stderr) {
                            console.log('Cannot process video: ' + err.message);
                        })
                        .on('end', function(stdout, stderr) {
                            console.log('Transcoding s  ucceeded !');
                        }).save('./outputfile.flv')
                        .outputOptions([
                            '-c copy',
                            '-bsf:a aac_adtstoasc'
                        ]);

output error: [https @ 0x19f7100] No trailing CRLF found in HTTP header. [https @ 0x19f7100] HTTP error 400 Bad Request Unable to open key file https://videomaker.demo.com/auth/m3u8/v1/generateKey?kid=/demo1-demokey.key [http @ 0x19efc60] No trailing CRLF found in HTTP header. [http @ 0x19f70c0] No trailing CRLF found in HTTP header. [http @ 0x19efc60] No trailing CRLF found in HTTP header. [http @ 0x19efc80] No trailing CRLF found in HTTP header. [http @ 0x19f6320] No trailing CRLF found in HTTP header. [http @ 0x19f6100] No trailing CRLF found in HTTP header. [http @ 0x19da1e0] No trailing CRLF found in HTTP header. Last message repeated 1 times [hls,applehttp @ 0x19ce740] Error when loading first segment 'https://videomaker.demo.com/hls/Seg_1/segment_1_1.ts' http://videomaker.demo.com/218616/p/demovideostream.m3u8: Invalid data found when processing input

What could be the problem?

Thanks

mondain commented 7 years ago

It could be that the demuxer for mpeg-ts is not included in your ffmpeg build.

likaihua commented 6 years ago

I have the same problem.

sasjafor commented 5 years ago

I have also run into this issue, using the normal Ubuntu 18.04 ffmpeg package and it works when using the command line and doesn't with fluent-ffmpeg.

On the command line I ran ffmpeg -i in.wav out.wav

And in node I wrote

let cmd = await ffmpeg(path)
 .toFormat('wav')
 .on('error', function(err, stdout, stderr) {
    console.log("ffmpeg stdout:\n" + stdout);
    console.log("ffmpeg stderr:\n" + stderr);
 })
 .save('/config/audio/temp/' + name + '.wav');

And the output is:

ffmpeg stdout:

ffmpeg stderr:
ffmpeg version 4.0.2-2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8 (Ubuntu 8.2.0-7ubuntu1)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
/config/audio/temp/in.wav: Invalid data found when processing input
ghost commented 4 years ago

I have the same problem. Code: var FFMPEGCommand = ffmpeg({}) .input(inputFileStream) .noVideo() .format("mp3") .output(outputFileStream) .on("error", function(err, stdout, stderr) { console.log(err.message, err, stderr); }) .run();