输入文件列表以与 Node.js 模块 fluent-ffmpeg 串联
Inputing a List of Files for Concatenation with Node.js Module fluent-ffmpeg
版本信息
- fluent-ffmpeg 版本:2.1.2
- ffmpeg 版本:3.4.2
- OS: Windows 10
重现代码
ffmpeg('C:/path/to/list.txt').mergeToFile('C:/path/to/out.mp4', 'C:/path/to/temp');
list.txt:
file 'C:/path/to/chunk01.ts'
file 'C:/path/to/chunk02.ts'
file 'C:/path/to/chunk03.ts'
file 'C:/path/to/chunk04.ts'
注意:绝对路径和相对路径我都试过了,结果一样。
预期结果
C:/path/to/out.mp4
处的视频文件与 list.txt 中的 4 个文件相匹配,首尾相连。
观测结果
C:/path/to/out.mp4
处的空文件,持续时间为 0,大小仅为 15kB。没有抛出任何错误。
这是我要复制的命令(它按预期工作,相对路径在 list.txt 中):
C:/path/to> ffmpeg -f concat -i list.txt -c copy out.ts
标准输出和标准错误
标准输出为空。 stderr 复制如下(修改文件名以匹配上面的文件名):
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, tty, from 'C:/path/to/list.txt':
Duration: 00:00:00.08, bitrate: 42 kb/s
Stream #0:0: Video: ansi, pal8, 640x400, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 (ansi) -> concat
concat -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 000001e385b45040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001e385b45040] profile High 4:4:4 Predictive, level 3.0, 4:4:4 8-bit
[libx264 @ 000001e385b45040] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 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:/path/to/out.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 640x400, q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 2 fps=0.0 q=-1.0 Lsize= 15kB time=00:00:00.04 bitrate=3099.0kbits/s speed=1.55x
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.619430%
[libx264 @ 000001e385b45040] frame I:1 Avg QP:12.71 size: 8083
[libx264 @ 000001e385b45040] frame P:1 Avg QP:29.71 size: 5928
[libx264 @ 000001e385b45040] mb I I16..4: 87.9% 0.0% 12.1%
[libx264 @ 000001e385b45040] mb P I16..4: 9.3% 0.0% 0.0% P16..4: 0.4% 0.0% 0.0% 0.0% 0.0% skip:90.3%
[libx264 @ 000001e385b45040] coded y,u,v intra: 17.9% 0.0% 0.0% inter: 0.1% 0.0% 0.0%
[libx264 @ 000001e385b45040] i16 v,h,dc,p: 88% 8% 4% 0%
[libx264 @ 000001e385b45040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 31% 19% 3% 2% 3% 7% 4% 3%
[libx264 @ 000001e385b45040] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001e385b45040] kb/s:1401.10
将 ffconcat version 1.0
添加到文本文件的开头,即
ffconcat version 1.0
file 'C:/path/to/chunk01.ts'
file 'C:/path/to/chunk02.ts'
...
或者,这是使用现有文本文件修改后的 cmd,但我对 fluent-ffmpeg 不是很熟悉。
ffmpeg('C:/path/to/list.txt').inputFormat('concat').mergeToFile('C:/path/to/out.mp4', 'C:/path/to/temp');
版本信息
- fluent-ffmpeg 版本:2.1.2
- ffmpeg 版本:3.4.2
- OS: Windows 10
重现代码
ffmpeg('C:/path/to/list.txt').mergeToFile('C:/path/to/out.mp4', 'C:/path/to/temp');
list.txt:
file 'C:/path/to/chunk01.ts'
file 'C:/path/to/chunk02.ts'
file 'C:/path/to/chunk03.ts'
file 'C:/path/to/chunk04.ts'
注意:绝对路径和相对路径我都试过了,结果一样。
预期结果
C:/path/to/out.mp4
处的视频文件与 list.txt 中的 4 个文件相匹配,首尾相连。
观测结果
C:/path/to/out.mp4
处的空文件,持续时间为 0,大小仅为 15kB。没有抛出任何错误。
这是我要复制的命令(它按预期工作,相对路径在 list.txt 中):
C:/path/to> ffmpeg -f concat -i list.txt -c copy out.ts
标准输出和标准错误
标准输出为空。 stderr 复制如下(修改文件名以匹配上面的文件名):
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, tty, from 'C:/path/to/list.txt':
Duration: 00:00:00.08, bitrate: 42 kb/s
Stream #0:0: Video: ansi, pal8, 640x400, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 (ansi) -> concat
concat -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 000001e385b45040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001e385b45040] profile High 4:4:4 Predictive, level 3.0, 4:4:4 8-bit
[libx264 @ 000001e385b45040] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 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:/path/to/out.mp4':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 640x400, q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 2 fps=0.0 q=-1.0 Lsize= 15kB time=00:00:00.04 bitrate=3099.0kbits/s speed=1.55x
video:14kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.619430%
[libx264 @ 000001e385b45040] frame I:1 Avg QP:12.71 size: 8083
[libx264 @ 000001e385b45040] frame P:1 Avg QP:29.71 size: 5928
[libx264 @ 000001e385b45040] mb I I16..4: 87.9% 0.0% 12.1%
[libx264 @ 000001e385b45040] mb P I16..4: 9.3% 0.0% 0.0% P16..4: 0.4% 0.0% 0.0% 0.0% 0.0% skip:90.3%
[libx264 @ 000001e385b45040] coded y,u,v intra: 17.9% 0.0% 0.0% inter: 0.1% 0.0% 0.0%
[libx264 @ 000001e385b45040] i16 v,h,dc,p: 88% 8% 4% 0%
[libx264 @ 000001e385b45040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 31% 19% 3% 2% 3% 7% 4% 3%
[libx264 @ 000001e385b45040] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001e385b45040] kb/s:1401.10
将 ffconcat version 1.0
添加到文本文件的开头,即
ffconcat version 1.0
file 'C:/path/to/chunk01.ts'
file 'C:/path/to/chunk02.ts'
...
或者,这是使用现有文本文件修改后的 cmd,但我对 fluent-ffmpeg 不是很熟悉。
ffmpeg('C:/path/to/list.txt').inputFormat('concat').mergeToFile('C:/path/to/out.mp4', 'C:/path/to/temp');