简体   繁体   English

ffmpeg尝试创建mpeg视频时出错

[英]ffmpeg error trying to create mpeg video

I am having trouble creating mpeg files, I have 2 bitmaps (2592*2160 32bit). 我在创建mpeg文件时遇到问题,我有2位图(2592 * 2160 32位)。 I am trying to combine them into an mpeg file but I cant get it to work, the command I have tried is: 我试图将它们组合成一个mpeg文件,但我不能让它工作,我尝试的命令是:

ffmpeg -i %d.bmp -b:v 99.99M -r 1 -s 2592x2160 vid.mpg

the output is 输出是

ffmpeg -i %d.bmp -b:v 99.99M -r 1 -s 2592x2160  vid.mpg
ffmpeg version N-41416-g718607b Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun  8 2012 12:46:19 with gcc 4.6.3
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass
 --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --ena  libavutil      51. 56.100 / 51. 56.100
  libavcodec     54. 25.100 / 54. 25.100
  libavformat    54.  6.101 / 54.  6.101
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 78.101 /  2. 78.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[image2 @ 01e6be40] Stream #0: not enough frames to estimate rate; consider incr
easing probesize
Input #0, image2, from '%d.bmp':
  Duration: 00:00:00.08, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: bmp, pal8, 2592x2160, 25 tbr, 25 tbn, 25 tbc
File 'vid.mpg' already exists. Overwrite ? [y/N] y
w:2592 h:2160 pixfmt:pal8 tb:1/25 sar:0/1 sws_param:flags=2
[ffmpeg_buffersink @ 02bb3ce0] No opaque field provided
[scale @ 02bb3f20] w:2592 h:2160 fmt:pal8 sar:0/1 -> w:2592 h:2160 fmt:yuv420p s
ar:0/1 flags:0x4
[mpeg1video @ 02b864a0] bitrate tolerance too small for bitrate
Output #0, mpeg, to 'vid.mpg':
    Stream #0:0: Video: mpeg1video, yuv420p, 2592x2160, q=2-31, 99990 kb/s, 90k
tbn, 5 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (bmp -> mpeg1video)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters
such as bit_rate, rate, width or height

If I leave out the -r parameter (ffmpeg -i %d.bmp -b:v 99.99M -s 2592x2160 vid.mpg) the output changes to: 如果我省略-r参数(ffmpeg -i%d.bmp -b:v 99.99M -s 2592x2160 vid.mpg),输出将变为:

[mpeg @ 02f80120] buffer underflow i=0 bufi=749380 size=950639
[mpeg @ 02f80120] buffer underflow i=0 bufi=751421 size=950639
[mpeg @ 02f80120] packet too large, ignoring buffer limits to mux it
[mpeg @ 02f80120] buffer underflow i=0 bufi=751421 size=950639
[mpeg @ 02f80120] buffer underflow i=0 bufi=753462 size=950639
[mpeg @ 02f80120] packet too large, ignoring buffer limits to mux it
[mpeg @ 02f80120] buffer underflow i=0 bufi=753462 size=950639
[mpeg @ 02f80120] buffer underflow i=0 bufi=755503 size=950639
...

what am I doing wrong? 我究竟做错了什么?

You're getting the first error because I don't think ffmpeg reads the "M" character for millions, so it's reading your parameter as 99.99 kb/s, which is not nearly high enough to handle what you want to do, hence the "bitrate tolerance too small for bitrate" warning. 你得到第一个错误,因为我认为ffmpeg不会读取数百万的“M”字符,因此它将你的参数读取为99.99 kb / s,这不足以处理你想要做的事情,因此“比特率容差太小,不适合比特率”警告。 Try specifying your bitrate in ###k using something large enough and it should go forward. 尝试使用足够大的东西在### k中指定你的比特率,它应该继续。 As for the second part, the reason it partially works when you leave out the -r parameter is because the mpeg container doesn't support many different frame rates. 至于第二部分,当你省略-r参数时它部分工作的原因是因为mpeg容器不支持许多不同的帧速率。 So, if you want a video that forces a frame rate to be 1 frame per second, you'll need to use a different container. 因此,如果您想要一个强制帧速率为每秒1帧的视频,您将需要使用不同的容器。 Also, with the current placement of the -r parameter, all you're saying is that the output video will play at one frame per second, not that each bitmap will represent one frame in the video. 此外,使用-r参数的当前位置,您所说的只是输出视频将以每秒一帧的速度播放,而不是每个位图将代表视频中的一帧。 To do the latter, you need to specify the input frame rate before you specify the input. 要执行后者,您需要在指定输入之前指定输入帧速率。

For example, to make a two second avi video (one bitmap per second in this case) with the bitrate you specified, you'd want to do something like: 例如,要使用您指定的比特率制作两秒avi视频(在这种情况下每秒一个位图),您需要执行以下操作:

ffmpeg -r 1 -i %d.bmp -b:v 990k -s 2592x2160 vid.avi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM