<div dir="ltr"><div><div>I have set up a custom AVIOContext that takes a callback function and writes out data to a buffer.<br><br>static int WritePacket(void *opaque, uint8_t *pBuffer, int pBufferSize) {<br>    printf("Writen to file %i\n",pBufferSize);<br>

    return fwrite(pBuffer, pBufferSize, 1, FileOut);<br>}<br><br>int BUFFERSIZE= 32768;<br>AVIOContext *pAVIOContext= NULL;<br>unsigned char *pBufferCallBack= (unsigned char*)av_malloc(BUFFERSIZE * sizeof(uint8_t));<br>pAVIOContext= avio_alloc_context(pBufferCallBack, BUFFERSIZE, 1, NULL, NULL, WritePacket, NULL);<br>

<br></div>After avformat_write_header I would like to flush that to 
direct to the buffer before I write any frames to the buffer.  As of now
 it takes a 30 frames before that buffer flushes.  I need access to the 
header before frames are written.  I tried avio_flush, but that didn't 
seem to do anything.<br>
<br></div>Is there a way I can do this?<br><br>Thanks</div>