fluent-ffmpeg / node-fluent-ffmpeg

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

Why is this streaming not working with either webm or mp4 output? #916

Open cinjon opened 5 years ago

cinjon commented 5 years ago

This is being run on Google Storage Functions and the input is a streaming video file and the output is to a different bucket in either mp4 or webm format. Ideally, I'd do the former but as far as I can tell, I have to use streaming pipes with google storage and that's not allowed with mp4. If there is a way around this, that would be great.

The package info is: "dependencies": { "@ffmpeg-installer/ffmpeg": "1.0.18", "@google-cloud/storage": "^2.1.0", "fluent-ffmpeg": "2.1.2" }

More specifically the ffmpeg build and os is:

ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --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-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg libavutil 56. 24.101 / 56. 24.101 libavcodec 58. 42.100 / 58. 42.100 libavformat 58. 24.100 / 58. 24.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 46.101 / 7. 46.101 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100

Code to reproduce

On a few files (which all work locally without streaming for mp4 output), I tried for webm format:

ffmpeg -f mp4 -i pipe:0 -acodec libvorbis -vcodec libvpx -b:v 1000k -filter:v scale=w=1280:h=trunc(ow/a/2)*2 -f webm -crf 10 pipe:1" 

For mp4 output, I tried:

ffmpeg -f mp4 -i pipe:0 -filter:v scale=w=1280:h=trunc(ow/a/2)*2 -f mp4 -movflags frag_keyframe+empty_moov pipe:1" 

as discussed at https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/346#issuecomment-67299526.

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

Expected results

I expected this to produce a valid output on the input.

Observed results

I get an error that says:

stream 0, offset 0x24: partial file pipe:0: Invalid data found when processing input Cannot determine format of input stream 0:0 after EOF Error marking filters as finished Conversion failed!

Checklist

ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --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-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg libavutil 56. 24.101 / 56. 24.101 libavcodec 58. 42.100 / 58. 42.100 libavformat 58. 24.100 / 58. 24.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 46.101 / 7. 46.101 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x514ed00] stream 0, offset 0x24: partial file [mov,mp4,m4a,3gp,3g2,mj2 @ 0x514ed00] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080, 2256 kb/s): unspecified pixel format Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt creation_time : 2018-10-28T06:40:04.000000Z encoder : Lavf58.20.100 Duration: 00:00:57.56, start: 0.040000, bitrate: N/A Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 1920x1080, 2256 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 90k tbn, 180k tbc (default) Metadata: creation_time : 2018-10-28T06:40:04.000000Z handler_name : VideoHandler Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> vp8 (libvpx)) [mov,mp4,m4a,3gp,3g2,mj2 @ 0x514ed00] stream 0, offset 0x24: partial file pipe:0: Invalid data found when processing input Cannot determine format of input stream 0:0 after EOF Error marking filters as finished Conversion failed!

federicocarboni commented 4 years ago

@cinjon Duplicate of #932, the MOV/MP4 parser requires both inputs and outputs to be seekable, you can't use a streaming MP4 file as of now.