gpt4 book ai didi

ubuntu - 我想在 ubuntu 上合并 mp3 文件

转载 作者:行者123 更新时间:2023-12-04 18:36:18 49 4
gpt4 key购买 nike

我想使用以下命令将 mp3 文件合并到一个文件中:

ffmpeg -i "concat:file_1.mp3|file_2.mp3|file_3.mp3|file_4.mp3" -c copy test.mp3
但我得到这个错误:
[mp3 @ 0x5629416b4880] Invalid audio stream. Exactly one MP3 audio stream is required.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times
我尝试使用 cat 和 mp3wrap 但它只复制第一个文件
我想提一下,mp3 文件是使用 pyaudio 录制的文件
编辑:
我使用了这个命令:
ffmpeg -y -i "concat:file_1.mp3|file_2.mp3|file_3.mp3|file_4.mp3" test.mp3
它似乎正在工作,但它只复制第一个文件而不合并
文件。
命令:
ffmpeg -y -i "concat:39492fr_man_1.mp3|39492fr_man_2.mp3|39492fr_man_3.mp3|39492fr_man_4.mp3" 39492_fr_man.mp3
输出:
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --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-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-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from 'concat:39492fr_man_1.mp3|39492fr_man_2.mp3|39492fr_man_3.mp3|39492fr_man_4.mp3':
Duration: 00:04:40.06, bitrate: 2460 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to '39492_fr_man.mp3':
Metadata:
TSSE : Lavf58.29.100
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p
Metadata:
encoder : Lavc58.54.100 libmp3lame
size= 2188kB time=00:04:40.05 bitrate= 64.0kbits/s speed= 134x
video:0kB audio:2188kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.010131%
命令: ffmpeg -i 39492fr_man_1.mp3 -i 39492fr_man_2.mp3 -i 39492fr_man_3.mp3 -i 39492fr_man_4.mp3 输出:
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from '39492fr_man_1.mp3':
Duration: 00:04:40.06, bitrate: 705 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, wav, from '39492fr_man_2.mp3':
Duration: 00:04:40.54, bitrate: 705 kb/s
Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Guessed Channel Layout for Input Stream #2.0 : mono
Input #2, wav, from '39492fr_man_3.mp3':
Duration: 00:04:39.50, bitrate: 705 kb/s
Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Guessed Channel Layout for Input Stream #3.0 : mono
Input #3, wav, from '39492fr_man_4.mp3':
Duration: 00:02:16.42, bitrate: 705 kb/s
Stream #3:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
At least one output file must be specified

最佳答案

您的输入实际上不是 MP3。这些实际上是名为 MP3 的 WAV 文件。所以你不能使用-c copy .您不能将 pcm_s16le ("WAV") 复制到 MP3 中,所以这就是您得到 Invalid audio stream 的原因。错误。
concat 协议(protocol)几乎没用。使用 concat demuxerconcat filter .在这种情况下使用哪一个并不重要,因此请使用对您更方便的那个。
连接分路器

  • 制作 input.txt包含:
    file '39492fr_man_1.mp3'
    file '39492fr_man_2.mp3'
    file '39492fr_man_3.mp3'
    file '39492fr_man_4.mp3'
  • 连接:
    ffmpeg -f concat -i input.txt output.mp3

  • 连接过滤器
    ffmpeg -i 39492fr_man_1.mp3 -i 39492fr_man_2.mp3 -i 39492fr_man_3.mp3 -i 39492fr_man_4.mp3 -filter_comples "[0:a][1:a][2:a][3:a]concat=n=4:a=1:v=0" output.mp3

    关于ubuntu - 我想在 ubuntu 上合并 mp3 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66783126/

    49 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com