[Libav-user] decode_video example pgm files distorted? (v4.0.2 Winbuild)

Strahinja Radman dr.strashni at gmail.com
Fri Aug 31 20:48:22 EEST 2018


Hi Chris,

To me that looks like you wrote some wrong data inside the picture and it looks skewed. Some indexes could be wrong.

void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, const char *filename)
{
	FILE *f;
	int i;

	f = fopen(filename, "w");
	fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);
	for (i = 0; i < ysize; i++)
		fwrite(buf + i * wrap, 1, xsize, f);
	fclose(f);
}

The above method should be called with pgm_save(frame->data[0], frame->linesize[0], frame->width, frame->height, “name.pgm”);

Kind regards,
Strahinja

From: Chris Bennett
Sent: 31 August 2018 19:41
To: libav-user at ffmpeg.org
Subject: [Libav-user] decode_video example pgm files distorted? (v4.0.2 Winbuild)

Hello All!

My apologies if this is a rookie question as I am just now learning the innards of ffmpeg, but I am reaching out hoping someone may have had the same issue as myself or has any advice.

I cloned 4.0.2 and compiled the libraries (MS VS 2013 x64) without issue.
I decided to try the examples as a learning opportunity, choosing decode_video. I ended up with this result:  https://drive.google.com/file/d/1DPu1EaM7i5J3LFaaGmZNO4Hoi_QzVcKM/view?usp=sharing 

At the top and bottom of the image there is is wavy distortion. I am not sure what is causing it.
The source file is a quicktime of a Motion JPEG video.

I had also compiled the exe as well and ran this command

ffmpeg.exe -ss 0.5 -i my_quicktime.mov  -t 1 -s 480x300 -f image2 C:/frame-%03d.jpg

and those images turned out just fine (I am sure this probably runs some completely different underlying code but I just wanted to make sure what I compiled was capable of a successful result)

I figure I am doing something incorrectly but I do not know where else to look. If anyone has any advice on what to tinker with, I would greatly appreciate it.

Thanks,
Chris Bennett

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180831/64b17874/attachment.html>


More information about the Libav-user mailing list