Writes a packet to an output media file ensuring correct interleaving.
The packet must contain one audio or video frame.
If the packets are already correctly interleaved the application should call av_write_frame() instead as it is slightly faster. It is also important to keep in mind that completely non-interleaved input will need huge amounts of memory to interleave with this, so it is preferable to interleave at the demuxer level.
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
The media file handle, a pointer to a AVFormatContext.
The AVPacket, which contains the stream_index, buf/buf_size, dts/pts, …
Returns < 0 if error, = 0 if OK, 1 if end of stream wanted.