2

Я пытаюсь добавить несколько аудио входов в видео файл, который не содержит аудио. Следующая команда добавляет «audio1.mp3» к видео, но не может добавить второй и третий.

ffmpeg -y -i video.mp4 -itsoffset 00:00:05 -i audio1.mp3 -itsoffset 00:00:10 -i audio2.mp3 -itsoffset 00:00:15 -i audio3.mp3 -map 0:0 -map 1:0 -map 2:0 -map 3:0 -c:v copy output.mp4

полный консольный вывод:

ffmpeg -y -i video.mp4 -itsoffset 00:00:05 -i audio1.mp3 -itsoffset 00:00:10 -i audio2.mp3 -itsoffset 00:00:15 -i audio3.mp3 -map 0:0 -map 1:0 -map 2:0 -map 3:0 -c:v copy output.mp4
ffmpeg version 3.2.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-nonfree --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc2c4801000] Could not find codec parameters for stream 1 (Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, 2 channels, s16p, 127 kb/s): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc2c4801000] Could not find codec parameters for stream 2 (Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, 2 channels, s16p, 192 kb/s): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.1 : stereo
Guessed Channel Layout for Input Stream #0.2 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.56.100
  Duration: 00:02:13.93, start: 0.000000, bitrate: 4090 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 4380 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, s16p, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, s16p, 192 kb/s
    Metadata:
      handler_name    : SoundHandler
Input #1, mp3, from 'audio1.mp3':
  Metadata:
    encoder         : Lavf57.14.100
  Duration: 00:02:13.93, start: 0.025057, bitrate: 128 kb/s
    Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : Lavc57.15
[mp3 @ 0x7fc2c3828a00] Estimating duration from bitrate, this may be inaccurate
Input #2, mp3, from 'audio2.mp3':
  Metadata:
    TSS             : GarageBand 10.1.6
  Duration: 00:01:50.03, start: 0.000000, bitrate: 192 kb/s
    Stream #2:0: Audio: mp3, 44100 Hz, stereo, s16p, 192 kb/s
[mp3 @ 0x7fc2c382a200] Estimating duration from bitrate, this may be inaccurate
Input #3, mp3, from 'audio3.mp3':
  Metadata:
    TSS             : GarageBand 10.1.6
  Duration: 00:01:57.47, start: 0.000000, bitrate: 192 kb/s
    Stream #3:0: Audio: mp3, 44100 Hz, stereo, s16p, 192 kb/s
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.56.100
    Stream #0:0(eng): Video: h264 (Main) ([33][0][0][0] / 0x0021), yuv420p(tv, bt709), 1920x1080, q=2-31, 4380 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc57.64.101 aac
    Stream #0:2: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc57.64.101 aac
    Stream #0:3: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc57.64.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (mp3 (native) -> aac (native))
  Stream #2:0 -> #0:2 (mp3 (native) -> aac (native))
  Stream #3:0 -> #0:3 (mp3 (native) -> aac (native))
Press [q] to stop, [?] for help
[mp3 @ 0x7fc2c3829c00] overread, skip -6 enddists: -4 -4.92 bitrate=10204.2kbits/s speed=15.9x    
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -3 -3
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -4 -4.76 bitrate=10082.1kbits/s speed=11.9x    
    Last message repeated 1 times
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -4 -4.17 bitrate=7235.9kbits/s speed=  10x    
[mp3 @ 0x7fc2c382b400] overread, skip -7 enddists: -6 -6
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -4 -4.35 bitrate=6058.6kbits/s speed=9.25x    
[mp3 @ 0x7fc2c382b400] overread, skip -7 enddists: -6 -6
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -4 -4
    Last message repeated 1 times
[mp3 @ 0x7fc2c3829c00] overread, skip -7 enddists: -6 -6.16 bitrate=6159.1kbits/s speed= 9.1x    
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -4 -4
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -2 -2.93 bitrate=5968.1kbits/s speed=8.89x    
    Last message repeated 1 times
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -2 -2
    Last message repeated 1 times
[mp3 @ 0x7fc2c3829c00] overread, skip -7 enddists: -6 -6.03 bitrate=5494.9kbits/s speed=8.65x    
    Last message repeated 1 times
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -2 -2.35 bitrate=5645.0kbits/s speed=8.33x    
    Last message repeated 1 times
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -2 -2.12 bitrate=5764.3kbits/s speed=8.29x    
    Last message repeated 1 times
[mp3 @ 0x7fc2c3829c00] overread, skip -6 enddists: -4 -4.43 bitrate=5193.9kbits/s speed= 8.1x    
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -3 -3
[mp3 @ 0x7fc2c382b400] overread, skip -4 enddists: -1 -1.68 bitrate=4808.6kbits/s speed=8.03x    
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -2 -2
[mp3 @ 0x7fc2c3829c00] overread, skip -7 enddists: -6 -6
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -4 -4
[mp3 @ 0x7fc2c3829c00] overread, skip -5 enddists: -4 -4.96 bitrate=4682.3kbits/s speed=8.05x    
[mp3 @ 0x7fc2c3829c00] overread, skip -7 enddists: -6 -6
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -4 -4.00 bitrate=4488.9kbits/s speed=8.11x    
[mp3 @ 0x7fc2c382b400] overread, skip -7 enddists: -6 -6
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -2 -2
    Last message repeated 1 times
[mp3 @ 0x7fc2c382b400] overread, skip -4 enddists: -1 -1.01 bitrate=4284.2kbits/s speed=8.24x    
[mp3 @ 0x7fc2c382b400] overread, skip -5 enddists: -2 -2
frame= 3480 fps=217 q=-1.0 Lsize=   67666kB time=00:02:18.90 bitrate=3990.5kbits/s speed=8.67x    
video:62092kB audio:5409kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.245015%
[aac @ 0x7fc2c3be0000] Qavg: 407.313
[aac @ 0x7fc2c4006a00] Qavg: 5943.593
[aac @ 0x7fc2c4009400] Qavg: 7361.354

Любая помощь?

1 ответ1

3

Все отображенные аудиопотоки, по-видимому, были включены.

Для вывода в один поток используйте фильтр amix .

ffmpeg -y -i video.mp4 -i audio1.mp3 -i audio2.mp3 -i audio3.mp3
          -filter_complex "[1]adelay=5000|5000[a];
                           [2]adelay=10000|10000[b];
                           [3]adelay=15000|15000[c]; 
                           [a][b][c]amix=3[a]"
          -map 0:v -map "[a]" -c:v copy output.mp4

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .