3

Это вопрос, похожий на этот. Я попробовал следующую команду ffmpeg:

ffmpeg -i "video.mpg" -i "audio.mp3" -t 00:01:35.13 -vcodec copy -acodec copy result.with.sound.mpg

И у меня есть какой-то выходной файл, который ничего не может воспроизвести.

При выполнении команды я получаю множество сообщений о переполнении буфера и о следующем:

frame=    1 fps=0.2 q=-1.0 Lsize=    4672kB time=00:00:00.00 bitrate=3479365818.2kbits/s
video:909kB audio:3716kB subtitle:0 global headers:0kB muxing overhead 1.021293%

(битрейт = 3479365818.2, вероятно, является причиной, по которой видео не воспроизводится).

И video.mpg и audio.mp3 могут воспроизводиться в плеере без каких-либо проблем.

Что не так и как я могу это исправить?

ОБНОВИТЬ

Вот полный неразрезанный вывод консоли:

ffmpeg version N-42347-g299387e Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul  8 2012 15:48:29 with gcc 4.7.1
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-
mrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libt
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 64.100 / 51. 64.100
  libavcodec     54. 33.100 / 54. 33.100
  libavformat    54. 15.102 / 54. 15.102
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  1.100 /  3.  1.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, avi, from 'video.mpg':
  Metadata:
    encoder         : MEncoder Sherpya-SVN-r34401-4.6.2
  Duration: 00:01:35.04, start: 0.000000, bitrate: 272 kb/s
    Stream #0:0: Video: mpeg1video ([1][0][0][16] / 0x10000001), yuv420p, 425x330 [SAR 1:1 DAR 85:66], 104857 kb/s, 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0000000002065840] max_analyze_duration 5000000 reached at 5016000
Input #1, mp3, from 'audio.mp3':
  Metadata:
    TIT1            : XRCD048
    title           : Super Human (No Vox) (build at 0:52)
    album           : Bare Bones
    genre           : Soundtrack
    artist          : X-Ray Dog
    track           : 24/50
    date            : 2010
  Duration: 00:01:35.13, start: 0.000000, bitrate: 399 kb/s
    Stream #1:0: Audio: mp3, 48000 Hz, stereo, s16, 320 kb/s
    Stream #1:1: Video: png, rgba, 643x643, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Other
[mpeg @ 00000000020ac020] VBV buffer size not set, muxing may fail
Output #0, mpeg, to 'result.with.sound.mpg':
  Metadata:
    encoder         : Lavf54.15.102
    Stream #0:0: Video: png, rgba, 643x643, q=2-31, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Other
    Stream #0:1: Audio: mp3, 48000 Hz, stereo, 320 kb/s
Stream mapping:
  Stream #1:1 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
buffer underflow i=0 bufi=234681 size=930322ime=00:00:00.00 bitrate=   0.0kbits/s
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=234681 size=930322
    Last message repeated 1 times
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=234681 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=236722 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=236722 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=238763 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=238763 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=240804 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=240804 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=242845 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=242845 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=244886 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=244886 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=246927 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=246927 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=248968 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=248968 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=251009 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=251009 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=253050 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=253050 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=255091 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=255091 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=257132 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=257132 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=259173 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=259173 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=261214 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=261214 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=263255 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=263255 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=265296 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=265296 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=267337 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=267337 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=269378 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=269378 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=271419 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=271419 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=273460 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=273460 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=275501 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=275501 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=277542 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=277542 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=279583 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=279583 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=281624 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=281624 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=283665 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=283665 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=285706 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=285706 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=287747 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=287747 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=289788 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=289788 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=291829 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=291829 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=293870 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=293870 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=295911 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=295911 size=930322
    .......
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=912293 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=912293 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=914334 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=914334 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=916375 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=916375 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=918416 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=918416 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=920457 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=920457 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=922498 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=922498 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=924539 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=924539 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=926580 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=926580 size=930322
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=928621 size=930322
[mpeg @ 00000000020ac020] packet too large, ignoring buffer limits to mux it
[mpeg @ 00000000020ac020] buffer underflow i=0 bufi=928621 size=930322
frame=    1 fps=0.2 q=-1.0 Lsize=    4672kB time=00:00:00.00 bitrate=3479365818.2kbits/s
video:909kB audio:3716kB subtitle:0 global headers:0kB muxing overhead 1.021293%

1 ответ1

7

Опция -map (ссылка на ffmpeg docs: 5.11 Advanced options) выбирает поток из входного файла. Сначала вы должны указать номер входного файла, затем номер потока.

Если -map не указан, ffmpeg выбирает лучшие потоки и обычно делает это правильно. Но с точки зрения ffmpeg, видеопоток имеет более высокий приоритет, чем звук, поэтому он выбрал изображение (отмеченное как видео) из вашего файла MP3.

Чтобы выбрать аудиопоток первым из второго файла, попробуйте

-i file_0 -i file_1 -map 0:0 -map 1:0

а потом ваши другие варианты. Это также будет работать для файлов MP3 без изображения (второй поток).

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