这是一个类似于这个。我尝试了以下 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%
(bitrate=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
该-map
选项(链接至 ffmpeg 文档:5.11 高级选项) 从输入文件中选择一个流。首先,您必须指定输入文件编号,其次指定流编号。
如果-map
没有指定,ffmpeg 会选择最佳流,通常都能正确完成。但从 ffmpeg 的角度来看,视频流比音频流具有更高的优先级,因此它从您的 MP3 文件中选择了图像艺术(标记为视频)。
要从第二个文件中首先选择音频流,请尝试
-i file_0 -i file_1 -map 0:0 -map 1:0
然后是其他选项。这也适用于没有图片的 MP3 文件(第二流)。