<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-GB link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi Chris,</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>To me that looks like you wrote some wrong data inside the picture and it looks skewed. Some indexes could be wrong.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, const char *filename)</p><p class=MsoNormal>{</p><p class=MsoNormal>                FILE *f;</p><p class=MsoNormal>                int i;</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>                f = fopen(filename, "w");</p><p class=MsoNormal>                fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);</p><p class=MsoNormal>                for (i = 0; i < ysize; i++)</p><p class=MsoNormal>                                fwrite(buf + i * wrap, 1, xsize, f);</p><p class=MsoNormal>                fclose(f);</p><p class=MsoNormal>}</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The above method should be called with pgm_save(frame->data[0], frame->linesize[0], frame->width, frame->height, “name.pgm”);</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Kind regards,</p><p class=MsoNormal>Strahinja</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>From: </b><a href="mailto:chris.bennett@dreamworks.com">Chris Bennett</a><br><b>Sent: </b>31 August 2018 19:41<br><b>To: </b><a href="mailto:libav-user@ffmpeg.org">libav-user@ffmpeg.org</a><br><b>Subject: </b>[Libav-user] decode_video example pgm files distorted? (v4.0.2 Winbuild)</p></div><p class=MsoNormal><o:p> </o:p></p><div><div><div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>Hello All!<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>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.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>I cloned 4.0.2 and compiled the libraries (MS VS 2013 x64) without issue.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>I decided to try the examples as a learning opportunity, choosing decode_video. I ended up with this result:  </span><span style='font-size:12.0pt'><a href="https://drive.google.com/file/d/1DPu1EaM7i5J3LFaaGmZNO4Hoi_QzVcKM/view?usp=sharing">https://drive.google.com/file/d/1DPu1EaM7i5J3LFaaGmZNO4Hoi_QzVcKM/view?usp=sharing</a></span><span style='font-size:9.5pt'> <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>At the top and bottom of the image there is is wavy distortion. I am not sure what is causing it.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>The source file is a quicktime of a Motion JPEG video.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>I had also compiled the exe as well and ran this command<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>ffmpeg.exe -ss 0.5 -i my_quicktime.mov  -t 1 -s 480x300 -f image2 C:/frame-%03d.jpg<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>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)<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>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.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>Thanks,<o:p></o:p></span></p></div></div></div></div><p class=MsoNormal style='background:white'><span style='font-size:9.5pt'>Chris Bennett<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>