[FFmpeg-devel] [PATCH] examples/demuxing_decoding: use correct size of video_dst_data[0]

Michael Niedermayer michaelni at gmx.at
Tue May 12 00:28:44 CEST 2015

On Mon, May 11, 2015 at 11:34:32PM +0200, Andreas Cadhalpun wrote:
> Currently video_dst_bufsize is used, which is set to the return value
> of av_image_alloc, but this is the combined size of all planes.
> Only the first plane is written in fwrite.
> The size of the first plane is the product of video_dst_linesize[0] and
> height.
> This fixes 'Syscall param write(buf) points to uninitialised byte(s)'
> valgrind warnings.
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  doc/examples/demuxing_decoding.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

this breaks demuxing_decoding with pixel formats that use more than
1 plane

for example:
doc/examples/demuxing_decoding lena255.jpg out.raw /dev/null
    Could not find audio stream in input file 'lena255.jpg'
    Input #0, image2, from 'lena255.jpg':
    Duration: 00:00:00.04, start: 0.000000, bitrate: 3124 kb/s
        Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 255x255, 25 tbr, 25 tbn, 25 tbc
    Demuxing video from file 'lena255.jpg' into 'out.raw'
    video_frame n:0 coded_n:0 pts:NOPTS
    Demuxing succeeded.
    Play the output video file with the command:
    ffplay -f rawvideo -pix_fmt yuvj444p -video_size 255x255 out.raw

but the printed command line for ffplay does not work as the stored
image is not containing teh chroma planes

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150512/c786673b/attachment.asc>

More information about the ffmpeg-devel mailing list