Hi,

I am currently encoding a series of high resolution frames to the MOV format.

Using dump_format I am getting this:

Output #0, mov, to '/tmp/temp.mov':
Stream #0.0: Video: mpeg4, yuv420p, 1680x1050, q=2-31, 1048 kb/s, 90k tbn, 25 tbc

I am setting up the stream as follows:

_videoStream->codec->codec_type = CODEC_TYPE_VIDEO;
_videoStream->codec->width = 1680;
_videoStream->codec->height = 1050;
_videoStream->codec->bit_rate = 1024 * 1024;
_videoStream->codec->time_base.den = 25;
_videoStream->codec->time_base.num = 1;
_videoStream->codec->gop_size = 30;
_videoStream->codec->pix_fmt = PIX_FMT_YUV420P;
_videoStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;

I am then converting the frame, which is RGBA to the output's pixel format, using sws_scale.

With the output frame I am then encoding it and writing it out to file.

uint32_t outSize = avcodec_encode_video( _videoStream->codec, _outBuffer, _outBufferSize, outFrame );

if ( outSize > 0 )
{
    AVPacket pkt;
    av_init_packet( &pkt );

    if ( _videoStream->codec->coded_frame->pts != AV_NOPTS_VALUE )
    {
        pkt.pts = av_rescale_q(    _videoStream->codec->coded_frame->pts,
                                _videoStream->codec->time_base,
                                _videoStream->time_base );

    }

    if ( _videoStream->codec->coded_frame->key_frame )
    {
        pkt.flags |= PKT_FLAG_KEY;
    }

    pkt.stream_index = _videoStream->index;
    pkt.data = _outBuffer;
    pkt.size = outSize;
    av_interleaved_write_frame( _outputFormatContext, &pkt );
    av_free_packet( &pkt );
}

At the start of the encoding I get the follow error: [mpeg4 @ 0x1837a00]encoded frame too large

The resulting video outputted contains quite a few artifacts especially when there is movement in the scene.

I am presuming that the problem has something to do with my settings for the output video stream in the first block above but I am sure what. Where am I going wrong?

Thanks in advance, Andy



_______________________________________________
libav-user mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-user

Reply via email to