我尝试使用从 中ffmpeg
获取输入mp3
音频文件(包含音频源和视频源)stdin
,进行修改,然后将其发送到mp3
。stdout
但是,在从 保存流后检查音频时stdout
,文件流缺少视频源,尽管输出表明它是发送到ffmpeg
的一部分。output
stdout
例如,这是我正在运行的命令,其中删除了修改(我正在使用node fluent ffmpeg
但这是转换后的命令)
ffmpeg -i pipe:0 -f mp3 -map 0 pipe:1
我添加了-map 0
以确保所有内容Sources
都传递到输出。
运行后,我收到以下输出:
ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --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-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mp3, from 'pipe:0':
Metadata:
#REMOVED METADATA TO SHORTEN
Duration: N/A, start: 0.000000, bitrate: 320 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
Stream #0:1: Video: png, rgb24(pc), 1500x1500 [SAR 11811:11811 DAR 1:1], 90k tbr, 90k tbn, 90k tbc (attached pic)
Metadata:
title : cover
comment : Cover (front)
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (mp3float) -> mp3 (libmp3lame))
Stream #0:1 -> #0:1 (png (native) -> png (native))
[mp3 @ 0xaaaae0fbb180] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2
Output #0, mp3, to 'pipe:1':
Metadata:
# REMOVED METADATA TO SHORTEN
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp
Metadata:
encoder : Lavc58.91.100 libmp3lame
Stream #0:1: Video: png, rgb24(progressive), 1500x1500 [SAR 11811:11811 DAR 1:1], q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tbc (attached pic)
Metadata:
title : cover
comment : Cover (front)
encoder : Lavc58.91.100 png
frame= 1 fps=0.0 q=0.0 size= 1kB time=00:00:31.32 bitrate= 0.1kbits/s speed=62.6x
frame= 1 fps=1.0 q=0.0 size= 1kB time=00:01:08.31 bitrate= 0.1kbits/s speed=68.3x
frame= 1 fps=0.7 q=0.0 size= 1kB time=00:01:46.21 bitrate= 0.0kbits/s speed=70.8x
frame= 1 fps=0.5 q=0.0 size= 1kB time=00:02:24.19 bitrate= 0.0kbits/s speed=72.1x
frame= 1 fps=0.4 q=0.0 size= 1kB time=00:03:04.11 bitrate= 0.0kbits/s speed=73.6x
frame= 1 fps=0.3 q=-0.0 Lsize= 5618kB time=00:03:35.09 bitrate= 213.9kbits/s speed=72.8x
video:2256kB audio:3361kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.009597%
到目前为止一切看起来都很好!如您所见,输出正确将Stream #0:0 (audio)
和映射Stream #0:1 (album art)
到Output #0
。这是我的stdout
,对吧?
所以我的输出流pipe:1
应该包含音频和视频流,对吗?但是,当我将该流传输到输出文件并运行时ffprobe
,我看到以下内容:
ffprobe version 5.0.1 Copyright (c) 2007-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
[mp3 @ 0x11d604890] Format mp3 detected only with low score of 1, misdetection possible!
[mp3float @ 0x11d604c50] Header missing
Last message repeated 286 times
[mp3 @ 0x11d604890] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/Users/jordan/Downloads/ODESZA-Wide.mp3':
Duration: 00:04:32.88, start: 0.000000, bitrate: 320 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
输出表明检测分数很低mp3
,缺少标题,并且Stream #0:1 (the album art)
完全缺失,尽管它是应该发送到的Input #0
一部分。Output #0
stdout
我是否对管道流的工作方式存在根本性的误解?当通过管道传输到输出文件时,它只能写入单个流,还是Stream #0:0
应该写入整个流,Stream #0:0 AND Stream #0:1
因为这是mp3
文件的组成部分?
如果我运行相同的命令,但直接写入文件而不是stdout
,如下所示:
ffmpeg -i pipe:0 -f mp3 -map 0 out.mp3
它包含两个流,所以显然这与管道流的工作方式有关,对吗?
谢谢你!