<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 17, 2013, at 10:31 AM, James Board <<a href="mailto:jpboard2@yahoo.com">jpboard2@yahoo.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt; position: static; z-index: auto; "><div>>And issue is probably withing avi container as it<br clear="none">>may not add every frame into index table.<br clear="none">>And when seeking you never check if returned packet actually is right<br clear="none">>one that you need.<br clear="none">><br clear="none">>Or it could be bug in your code how you seek in file, etc...</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">I did a rewrite of my code and it now works.  But I don't know
 why.</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">I modified the demuxing.c example so that it seeks to frame 0, calls</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">decode_packet, seeks to frame 10, calls decode_packet, etc.  I</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">seek to every 10th frame and call decode_packet().  I also</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">modified decode_packet() so that it writes an output file whenever <br></div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">'got_frame' is non-zero.  For the first four seeks (frame 0, 10, 20, 30),</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">'got_frame' is NULL and no output image files are written.  Then,</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">when I seek to frame 40, the output file for frame 0 is written.  When I seek to</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">60, the output for frame 10 is written.  When I seek to frame 60, the output</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">for frame 20 is written, etc.  Eventually, the 'flush cached frames' loop is</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">entered and the final files are written.</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">Does this make sense or sound familiar to anyone?  What is happening here?<br>Does this have anything to do with cached frames?  I've before what 'cached</div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">frames' are but nobody answered.  Does anyone understand this?</div></div></div></blockquote><div><br></div><div>What you're describing sounds like the multithreading approach that ffmpeg uses. My understanding: The first decode call starts a decode action which spawns a thread to decode that frame. Each subsequent decode call starts a new action/thread, until you run out of threads, at which point the next decode action will return the frame that you started decoding in the first call. That's why you have to look at the frame number of the decoded frame, not of the packet you passed in. Maybe you also get a frame back if it's 'ready' - not sure.</div><div><br></div><div>Note - this means you always have to run decode a few extra times with a null packet to get the frames flushed out.</div><blockquote type="cite"><div><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt; position: static; z-index: auto; "><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">Also, none of the
 above oddness happens if I use AVI files encoded with <br></div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; ">no codec or with lossless JPEG, or a few other codecs.</div></div></div></blockquote><div><br></div><div>Possibly those codecs don't support multithreading? Certainly 'none' wouldn't do anything, so that would be expected. Id' hope that lossless JPEG would use threads though, so I may be off track.</div><div><br></div><div><br></div><div>Bruce</div><div><br></div><div><br></div><br><blockquote type="cite"><div><div style="background-color: rgb(255, 255, 255); font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt; position: static; z-index: auto; "><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida
 Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Wednesday, October 16, 2013 3:48 PM, Paul B Mahol <<a href="mailto:onemda@gmail.com">onemda@gmail.com</a>> wrote:<br> </font> </div>  <div class="y_msg_container">On 10/16/13, Paul B Mahol <<a shape="rect" ymailto="mailto:onemda@gmail.com" href="mailto:onemda@gmail.com">onemda@gmail.com</a>> wrote:<br clear="none">> On 10/16/13, James Board <<a shape="rect" ymailto="mailto:jpboard2@yahoo.com" href="mailto:jpboard2@yahoo.com">jpboard2@yahoo.com</a>> wrote:<br clear="none">>>>Why don't you simply test this yourself?<br clear="none">>>>It cannot take more time to test than to write your<br clear="none">>>>mail, let alone write (and read!) the answers.<br clear="none">>><br clear="none">>> I did.  It generated the extra frames.  So the libav implementation<br clear="none">>> works this way.  Or at least my code works that way,
 and my code<br clear="none">>> might be screwed.  The question I mean to ask (maybe I wasn't clear)<br clear="none">>> is whether there is anything fundamental to the huffyuv algorithm<br clear="none">>> which prevents me from decoding a single frame.  If the answer<br clear="none">>> is 'yes', then I know not to dig through the source code (big<br clear="none">>> learning curve) because that effort can't possibly work.  If<br clear="none">>> the answer is 'no, then I'll press on.<br clear="none">><br clear="none">> There is nothing in huffyuv algorithm and ffvhuff which could cause this.<br clear="none">><br clear="none"><br clear="none">And issue is probably withing avi container as it<br clear="none">may not add every frame into index table.<br clear="none">And when seeking you never check if returned packet actually is right<br clear="none">one that you need.<br clear="none"><br clear="none">Or it could be bug in your code how you seek in file, etc...<div class="yqt9443626572" id="yqtfd11768"><br clear="none">_______________________________________________<br clear="none">Libav-user mailing list<br clear="none"><a shape="rect" ymailto="mailto:Libav-user@ffmpeg.org" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br clear="none"><a shape="rect" href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br clear="none"></div><br><br></div>  </div> </div>  </div> </div></div>_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>http://ffmpeg.org/mailman/listinfo/libav-user<br></blockquote></div><br></body></html>