Hi,

Locutus wrote:
> 
> Luca Abeni wrote:
>> Are you saying that the "width" field in AVCodecContext is now filled 
>> with a different value?
>>
>> Can you reproduce the problem with the "ffmpeg" program? Or, can you 
>> post some code that reproduces the problem?
>>
> 
> I've only tested the newer library with MPEG2, so whatever changes I make
> should work across all formats.  In my code, I did dump out the decoded
> images and they are being padded on the right side.

What do you mean by "are being padded on the right side"? If I 
understand your description well, the "width" field of AVCodecContext is
correct, so there is no padding...


>  As my code has not
> changed, something must have changed in the library.  The width and height
> fields in the AVCodecContext do show the correct dimensions of 704x480, but
> the decoded frame is 736x480 with the linesize[0] field equal to 736.

This should not generate any problem. AFAIK, libavcodec is free to set 
linesize to the value it prefers (with linesize > width, of course). But 
this does not mean that the decoded image is larger or is padded: 
libavcodec is simply storing each picture in a larger buffer. 
av_picture_pad() should be able to correctly cope with this situation.


> When I test playback using ffplay, the video window is shown in a larger
> resolution with padding, half of the padding on the left and half of the
> padding on the right.  I used the following command line to dump the decoded
> video to a series of images "ffmpeg -i sample.mp2 -f image2 samples%d.ppm". 
> The resultant images were created at the correct dimensions of 704x480.

Ok. So, your video is 704x480, and ffmpeg is dumping a set of 704x480 
pictures... Looks correct.


> Here's the code that has been working correctly with r12279:
> 
> int nBytesDecoded = avcodec_decode_video(pCodecContext, pFrame,
> &nFrameFinished, packet.data, packet.size);
> if(nVideoFrameFinished > 0 && nBytesDecoded > 0)
> {
>   if(nWidth == nReqWidth)
>   {
>     // Use sws_scale for resizing and/or colorspace conversion
>     if(pSwsContextOut == NULL) 
>     {
>       pSwsContextOut = sws_getContext(nSourceWidth, nSourceHeight,
> pCodecContext->pix_fmt, nWidth, nHeight, outputPixelFormat, nSwsFlags, NULL,
> NULL, NULL);
[...]

It's difficult to say where the problem is here, because you do not show 
how "nWidth", "nReqWidth", "nSourceWidth", and friends are set.
I guess there is some confusion between "width" and "linesize" 
somewhere, but this is just a guess.



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

Reply via email to