Buffer underflow warnings when generating video?

185 views
Skip to first unread message

Vid Vartak

unread,
Nov 1, 2021, 8:21:06 AM11/1/21
to javacv
Hello,

So now I am able to generate a video (.mpg) from a number of images (.png), but I am getting the following warnings (the video does get generated):

[mpeg @ 000001eee89cd340] VBV buffer size not set, using default size of 230KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'C:\Users\vvartak\IdeaProjects\dmsl-studio\test.mpg':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: mpeg1video, yuv420p, 504x504, q=2-31, 400 kb/s, 30 fps, 90k tbn, 30 tbc
[mpeg @ 000001eee89cd340] buffer underflow st=0 bufi=10326 size=12878
[mpeg @ 000001eee89cd340] buffer underflow st=0 bufi=12367 size=12878
[mpeg @ 000001eee89cd340] buffer underflow st=0 bufi=1521 size=3107

Here is part of my code:

FFmpegFrameRecorder recorder = new FFmpegFrameRecorder( videoFile.getAbsolutePath(), Constants.FRAME_SIZE_PIXELS,Constants.FRAME_SIZE_PIXELS);

try {
recorder.setVideoCodec( AV_CODEC_ID_MPEG1VIDEO);
recorder.setFrameRate(30);
recorder.setPixelFormat( AV_PIX_FMT_YUV420P);
recorder.start();
OpenCVFrameConverter.ToIplImage grabberConverter = new OpenCVFrameConverter.ToIplImage()
;
//start of for loop
    ...
    recorder. record(grabberConverter.convert(img));
//end of for loop

recorder.stop();

Where are these warnings coming from and how can I avoid them?

Thanks,

Vid

Samuel Audet

unread,
Nov 1, 2021, 10:15:15 AM11/1/21
to jav...@googlegroups.com, Vid Vartak
If you don't need MPEG-1, I would recommend just using H.264 like everyone else.
It's going to give you higher quality, and will work on the largest amount of devices out there too.

Samuel

Vid Vartak

unread,
Nov 1, 2021, 10:51:23 AM11/1/21
to Samuel Audet, jav...@googlegroups.com
Thanks again, Samuel, that indeed got rid of the warnings. BTW, how do people know that AV_CODEC_ID_H264 is the recommended codec?

Vid

Samuel Audet

unread,
Nov 1, 2021, 10:58:24 AM11/1/21
to Vid Vartak, jav...@googlegroups.com
Well, for example, one could assume that the recommendations from YouTube are probably in line with the industry:

Samuel
Reply all
Reply to author
Forward
0 new messages