Missing frames when encoding 16x16 video to MPEG4/MPEG2/H264
@vincent
Submitted by Vincent Penquerc'h Link to original bug (#732631)
Description
+++ This bug was initially created as a clone of Bug 732351 +++
When encoding 16x16 video to MPEG, a sanity check triggers in ffmpeg, which causes frames to be not encoded.
To reproduce:
-
Create a 16x16 h264 file:
gst-launch-1.0 videotestsrc pattern=6 num-buffers=1000 ! \
"video/x-raw, format=(string)I420, width=(int)16, height=(int)16, \
framerate=(fraction)1/1" ! x264enc ! qtmux ! filesink location=/tmp/test.mov -
Play this file:
gst-launch-1.0 playbin uri="file:///tmp/test.mov" video-sink=xvimagesink -
See grey output, instead of the solid blue (pattern 6) we expected.
Tracing shows the encoding earlies out in libav from a sanity check on size (which is apparently too strict):
gst-libs/ext/libav/libavcodec/mpegvideo_enc.c, function encode_thread:
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
Commenting out the return -1 above fixes the issue (albeit at the likely cost of possible buffer overflow).