fluent-ffmpeg / node-fluent-ffmpeg

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

conver flv to mp4 error Invalid argument #1236

Closed zhouzhili closed 7 months ago

zhouzhili commented 7 months ago

Version information

Code to reproduce

const ffmpeg = require('fluent-ffmpeg')

const savePath = ' C:/Users/zhili/Desktop/test/1.mp4'

const videoSrc = 'http://localhost:90/data/video/1.flv'

const command = ffmpeg()
  .input(videoSrc)
  .addOutputOptions('-movflags +frag_keyframe+separate_moof+omit_tfhd_offset+empty_moov')
  .format('mp4')
  .save(savePath)
  .on('end', function () {
    console.log('end')
  })
  .on('start', (cmdline) => console.log(cmdline))
  .on('error', function (err, stdout, stderr) {
    console.log('Cannot process video: ' + err.message)
    console.log(stdout)
    console.log(stderr)
  })

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

Expected results

convert flv to mp4

Observed results

ffmpeg -i http://localhost:90/data/video/1.flv -y -movflags +frag_keyframe+separate_moof+omit_tfhd_offset+empty_moov -f mp4 C:/Users/zhili/Desktop/test/1.mp4 Cannot process video: ffmpeg exited with code 1:

ffmpeg version N-109600-gb37795688a-20230114 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230114 libavutil 57. 44.100 / 57. 44.100 libavcodec 59. 56.100 / 59. 56.100 libavformat 59. 35.100 / 59. 35.100 libavdevice 59. 8.101 / 59. 8.101 libavfilter 8. 53.100 / 8. 53.100 libswscale 6. 8.112 / 6. 8.112 libswresample 4. 9.100 / 4. 9.100 libpostproc 56. 7.100 / 56. 7.100 Input #0, flv, from 'http://localhost:90/data/video/1.flv': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.35.100 Duration: 00:02:02.96, start: 0.000000, bitrate: 1914 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s Stream #0:1: Video: flv1, yuv420p, 1280x720, 200 kb/s, 30 fps, 30 tbr, 1k tbn C:/Users/zhili/Desktop/test/1.mp4: Invalid argument

in cmd

ffmpeg -i http://localhost:90/data/video/1.flv -y -movflags +frag_keyframe+separate_moof+omit_tfhd_offset+empty_moov -f mp4 C:/Users/zhili/Desktop/test/1.mp4 ffmpeg version N-109600-gb37795688a-20230114 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230114 libavutil 57. 44.100 / 57. 44.100 libavcodec 59. 56.100 / 59. 56.100 libavformat 59. 35.100 / 59. 35.100 libavdevice 59. 8.101 / 59. 8.101 libavfilter 8. 53.100 / 8. 53.100 libswscale 6. 8.112 / 6. 8.112 libswresample 4. 9.100 / 4. 9.100 libpostproc 56. 7.100 / 56. 7.100 Input #0, flv, from 'http://localhost:90/data/video/1.flv': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.35.100 Duration: 00:02:02.96, start: 0.000000, bitrate: 1914 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s Stream #0:1: Video: flv1, yuv420p, 1280x720, 200 kb/s, 30 fps, 30 tbr, 1k tbn Stream mapping: Stream #0:1 -> #0:0 (flv1 (flv) -> h264 (libx264)) Stream #0:0 -> #0:1 (mp3 (mp3float) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 000002440c435540] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 000002440c435540] profile High, level 3.1, 4:2:0, 8-bit [libx264 @ 000002440c435540] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=22 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'C:/Users/zhili/Desktop/test/1.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf59.35.100 Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(progressive), 1280x720, q=2-31, 30 fps, 15360 tbn Metadata: encoder : Lavc59.56.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc59.56.100 aac frame= 3689 fps=155 q=-1.0 Lsize= 42971kB time=00:02:02.92 bitrate=2863.7kbits/s dup=1 drop=0 speed=5.17x video:40966kB audio:1930kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.176639% [libx264 @ 000002440c435540] frame I:17 Avg QP:20.18 size: 51463 [libx264 @ 000002440c435540] frame P:3429 Avg QP:24.28 size: 11537 [libx264 @ 000002440c435540] frame B:243 Avg QP:28.99 size: 6225 [libx264 @ 000002440c435540] consecutive B-frames: 87.0% 12.7% 0.2% 0.1% [libx264 @ 000002440c435540] mb I I16..4: 31.0% 61.2% 7.8% [libx264 @ 000002440c435540] mb P I16..4: 4.0% 9.3% 0.8% P16..4: 34.6% 4.6% 3.0% 0.0% 0.0% skip:43.6% [libx264 @ 000002440c435540] mb B I16..4: 1.5% 4.2% 0.1% B16..8: 44.7% 3.8% 0.9% direct: 1.0% skip:43.9% L0:87.4% L1: 7.9% BI: 4.7% [libx264 @ 000002440c435540] 8x8 transform intra:65.6% inter:82.1% [libx264 @ 000002440c435540] coded y,uvDC,uvAC intra: 54.6% 58.6% 6.3% inter: 9.1% 4.2% 0.4% [libx264 @ 000002440c435540] i16 v,h,dc,p: 28% 47% 25% 0% [libx264 @ 000002440c435540] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 29% 41% 3% 1% 1% 1% 1% 7% [libx264 @ 000002440c435540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 39% 11% 2% 2% 2% 3% 2% 3% [libx264 @ 000002440c435540] i8c dc,h,v,p: 37% 39% 22% 2% [libx264 @ 000002440c435540] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 000002440c435540] ref P L0: 82.6% 4.6% 8.9% 4.0% [libx264 @ 000002440c435540] ref B L0: 82.4% 17.4% 0.2% [libx264 @ 000002440c435540] ref B L1: 100.0% 0.0% [libx264 @ 000002440c435540] kb/s:2729.07 [aac @ 000002440c431cc0] Qavg: 572.599

Checklist

njoyard commented 7 months ago

There's an additional space at the beginning of your output path