Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ffmpeg-doc / usr / share / doc / ffmpeg-doc / api / group__lavf__encoding.html
Size: Mime:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>FFmpeg: Muxing</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">FFmpeg
   &#160;<span id="projectnumber">2.7.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Muxing</div>  </div>
<div class="ingroups"><a class="el" href="group__libavf.html">I/O and Muxing/Demuxing Library</a></div></div><!--header-->
<div class="contents">

<p>Muxers take encoded data in the form of <a class="el" href="structAVPacket.html">AVPackets</a> and write it into files or other output bytestreams in the specified container format.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structAVOutputFormat.html">AVOutputFormat</a></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#ga78d4e734fecb1d2385536e6dd5b7b9f5">avformat_write_header</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s, <a class="el" href="group__lavu__dict.html#ga1d7cc0833bee918994a600556410315f">AVDictionary</a> **options)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocate the stream private data and write the stream header to an output media file.  <a href="#ga78d4e734fecb1d2385536e6dd5b7b9f5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#gaa85cc1774f18f306cd20a40fc50d0b36">av_write_frame</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s, <a class="el" href="structAVPacket.html">AVPacket</a> *<a class="el" href="extract__mvs_8c.html#a3d4c6562f0b27cf0cacbbea5c038c090">pkt</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a packet to an output media file.  <a href="#gaa85cc1774f18f306cd20a40fc50d0b36"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1">av_interleaved_write_frame</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s, <a class="el" href="structAVPacket.html">AVPacket</a> *<a class="el" href="extract__mvs_8c.html#a3d4c6562f0b27cf0cacbbea5c038c090">pkt</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a packet to an output media file ensuring correct interleaving.  <a href="#ga37352ed2c63493c38219d935e71db6c1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#gaab766dccdff1bf323a2fc604e723b441">av_write_uncoded_frame</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s, int stream_index, <a class="el" href="structAVFrame.html">AVFrame</a> *<a class="el" href="extract__mvs_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a uncoded frame to an output media file.  <a href="#gaab766dccdff1bf323a2fc604e723b441"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#gafe9916c601bba6827d6f9271a61260e4">av_interleaved_write_uncoded_frame</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s, int stream_index, <a class="el" href="structAVFrame.html">AVFrame</a> *<a class="el" href="extract__mvs_8c.html#ad7d33d579a8d4241a5e643e39287a209">frame</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a uncoded frame to an output media file.  <a href="#gafe9916c601bba6827d6f9271a61260e4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#ga5f6bebdc8c234a5ad9740de89acb15e6">av_write_uncoded_frame_query</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s, int stream_index)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Test whether a muxer supports uncoded frame.  <a href="#ga5f6bebdc8c234a5ad9740de89acb15e6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#ga7f14007e7dc8f481f054b21614dfec13">av_write_trailer</a> (<a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Write the stream trailer to an output media file and free the file private data.  <a href="#ga7f14007e7dc8f481f054b21614dfec13"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structAVOutputFormat.html">AVOutputFormat</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#ga8795680bd7489e96eeb5aef5e615cacc">av_guess_format</a> (const char *short_name, const char *filename, const char *mime_type)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match.  <a href="#ga8795680bd7489e96eeb5aef5e615cacc"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum <a class="el" href="group__lavc__core.html#gaadca229ad2c20e060a14fec08a5cc7ce">AVCodecID</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#gae8a1efab53a348857f209ea51037da4c">av_guess_codec</a> (<a class="el" href="structAVOutputFormat.html">AVOutputFormat</a> *fmt, const char *short_name, const char *filename, const char *mime_type, enum <a class="el" href="group__lavu__misc.html#ga9a84bba4713dfced21a1a56163be1f48">AVMediaType</a> type)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Guess the codec ID based upon muxer and filename.  <a href="#gae8a1efab53a348857f209ea51037da4c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__lavf__encoding.html#ga661ee0b2f3dbcaaef5d68f2f5d75e2d4">av_get_output_timestamp</a> (struct <a class="el" href="structAVFormatContext.html">AVFormatContext</a> *s, int stream, int64_t *dts, int64_t *wall)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get timing information for the data currently output.  <a href="#ga661ee0b2f3dbcaaef5d68f2f5d75e2d4"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>Muxers take encoded data in the form of <a class="el" href="structAVPacket.html">AVPackets</a> and write it into files or other output bytestreams in the specified container format. </p>
<p>The main API functions for muxing are <a class="el" href="group__lavf__encoding.html#ga78d4e734fecb1d2385536e6dd5b7b9f5" title="Allocate the stream private data and write the stream header to an output media file.">avformat_write_header()</a> for writing the file header, <a class="el" href="group__lavf__encoding.html#gaa85cc1774f18f306cd20a40fc50d0b36" title="Write a packet to an output media file.">av_write_frame()</a> / <a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1" title="Write a packet to an output media file ensuring correct interleaving.">av_interleaved_write_frame()</a> for writing the packets and <a class="el" href="group__lavf__encoding.html#ga7f14007e7dc8f481f054b21614dfec13" title="Write the stream trailer to an output media file and free the file private data.">av_write_trailer()</a> for finalizing the file.</p>
<p>At the beginning of the muxing process, the caller must first call <a class="el" href="group__lavf__core.html#gac7a91abf2f59648d995894711f070f62" title="Allocate an AVFormatContext.">avformat_alloc_context()</a> to create a muxing context. The caller then sets up the muxer by filling the various fields in this context:</p>
<ul>
<li>The <a class="el" href="structAVFormatContext.html#a20d80ac07e38ff5c268d15aaf2798b98">oformat</a> field must be set to select the muxer that will be used.</li>
<li>Unless the format is of the AVFMT_NOFILE type, the <a class="el" href="structAVFormatContext.html#a1e7324262b6b78522e52064daaa7bc87">pb</a> field must be set to an opened IO context, either returned from <a class="el" href="avio_8h.html#ade8a63980569494c99593ebf0d1e891b" title="Create and initialize a AVIOContext for accessing the resource indicated by url.">avio_open2()</a> or a custom one.</li>
<li>Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must be created with the <a class="el" href="group__lavf__core.html#gadcb0fd3e507d9b58fe78f61f8ad39827" title="Add a new stream to a media file.">avformat_new_stream()</a> function. The caller should fill the <a class="el" href="structAVStream.html#a56f20051fb99339cc588cd3a07ab8c96">stream codec context</a> information, such as the codec <a class="el" href="structAVCodecContext.html#a3f99ca3115c44e6d7772c9384faf15e6">type</a>, <a class="el" href="structAVCodecContext.html#adc5f65d6099fd8339c1580c091777223">id</a> and other parameters (e.g. width / height, the pixel or sample format, etc.) as known. The <a class="el" href="structAVStream.html#a9db755451f14e2bf590d4b85d82b32e6">stream timebase</a> should be set to the timebase that the caller desires to use for this stream (note that the timebase actually used by the muxer can be different, as will be described later).</li>
<li>It is advised to manually initialize only the relevant fields in <a class="el" href="structAVCodecContext.html" title="main external API structure.">AVCodecContext</a>, rather than using <a class="el" href="group__lavc__core.html#ga3933b21b9dcb9173df3e56673b7a7d76">avcodec_copy_context()</a> during remuxing: there is no guarantee that the codec context values remain valid for both input and output format contexts.</li>
<li>The caller may fill in additional information, such as <a class="el" href="structAVFormatContext.html#a3019a56080ed2e3297ff25bc2ff88adf">global</a> or <a class="el" href="structAVStream.html#a50d250a128a3da9ce3d135e84213fb82">per-stream</a> metadata, <a class="el" href="structAVFormatContext.html#ac17d5fc2dcdb00806cc83b02d9f940f3">chapters</a>, <a class="el" href="structAVFormatContext.html#a4c2c5a4c758966349ff513e95154d062">programs</a>, etc. as described in the <a class="el" href="structAVFormatContext.html" title="Format I/O context.">AVFormatContext</a> documentation. Whether such information will actually be stored in the output depends on what the container format and the muxer support.</li>
</ul>
<p>When the muxing context is fully set up, the caller must call <a class="el" href="group__lavf__encoding.html#ga78d4e734fecb1d2385536e6dd5b7b9f5" title="Allocate the stream private data and write the stream header to an output media file.">avformat_write_header()</a> to initialize the muxer internals and write the file header. Whether anything actually is written to the IO context at this step depends on the muxer, but this function must always be called. Any muxer private options must be passed in the options parameter to this function.</p>
<p>The data is then sent to the muxer by repeatedly calling <a class="el" href="group__lavf__encoding.html#gaa85cc1774f18f306cd20a40fc50d0b36" title="Write a packet to an output media file.">av_write_frame()</a> or <a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1" title="Write a packet to an output media file ensuring correct interleaving.">av_interleaved_write_frame()</a> (consult those functions' documentation for discussion on the difference between them; only one of them may be used with a single muxing context, they should not be mixed). Do note that the timing information on the packets sent to the muxer must be in the corresponding <a class="el" href="structAVStream.html" title="Stream structure.">AVStream</a>'s timebase. That timebase is set by the muxer (in the <a class="el" href="group__lavf__encoding.html#ga78d4e734fecb1d2385536e6dd5b7b9f5" title="Allocate the stream private data and write the stream header to an output media file.">avformat_write_header()</a> step) and may be different from the timebase requested by the caller.</p>
<p>Once all the data has been written, the caller must call <a class="el" href="group__lavf__encoding.html#ga7f14007e7dc8f481f054b21614dfec13" title="Write the stream trailer to an output media file and free the file private data.">av_write_trailer()</a> to flush any buffered packets and finalize the output file, then close the IO context (if any) and finally free the muxing context with <a class="el" href="group__lavf__core.html#gac2990b13b68e831a408fce8e1d0d6445" title="Free an AVFormatContext and all its streams.">avformat_free_context()</a>. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga78d4e734fecb1d2385536e6dd5b7b9f5"></a><!-- doxytag: member="avformat.h::avformat_write_header" ref="ga78d4e734fecb1d2385536e6dd5b7b9f5" args="(AVFormatContext *s, AVDictionary **options)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#ga78d4e734fecb1d2385536e6dd5b7b9f5">avformat_write_header</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__lavu__dict.html#ga1d7cc0833bee918994a600556410315f">AVDictionary</a> **&#160;</td>
          <td class="paramname"><em>options</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Allocate the stream private data and write the stream header to an output media file. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>Media file handle, must be allocated with <a class="el" href="group__lavf__core.html#gac7a91abf2f59648d995894711f070f62" title="Allocate an AVFormatContext.">avformat_alloc_context()</a>. Its oformat field must be set to the desired output format; Its pb field must be set to an already opened <a class="el" href="structAVIOContext.html" title="Bytestream IO Context.">AVIOContext</a>. </td></tr>
    <tr><td class="paramname">options</td><td>An AVDictionary filled with <a class="el" href="structAVFormatContext.html" title="Format I/O context.">AVFormatContext</a> and muxer-private options. On return this parameter will be destroyed and replaced with a dict containing options that were not found. May be NULL.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, negative AVERROR on failure.</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__avoptions.html#gae31ae7fb20113b00108d0ecf53f25664" title="Look for an option in an object.">av_opt_find</a>, <a class="el" href="group__lavu__dict.html#ga8d9c2de72b310cef8e6a28c9cd3acbbe" title="Set the given entry in *pm, overwriting an existing entry.">av_dict_set</a>, <a class="el" href="avio_8h.html#a371a670112abc5f3e15bc570da076301" title="Create and initialize a AVIOContext for accessing the resource indicated by url.">avio_open</a>, <a class="el" href="group__lavf__core.html#ga8fe016b9e8df67a5ffde855f2f891d71" title="If f is NULL, returns the first registered output format, if f is non-NULL, returns the next register...">av_oformat_next</a>. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="muxing_8c-example.html#a144">muxing.c</a>, <a class="el" href="remuxing_8c-example.html#a38">remuxing.c</a>, <a class="el" href="transcode_aac_8c-example.html#a57">transcode_aac.c</a>, and <a class="el" href="transcoding_8c-example.html#a60">transcoding.c</a>.</dd>
</dl>
<p>Referenced by <a class="el" href="muxing_8c_source.html#l00556">main()</a>, <a class="el" href="transcoding_8c_source.html#l00087">open_output_file()</a>, and <a class="el" href="transcode__aac_8c_source.html#l00291">write_output_file_header()</a>.</p>

</div>
</div>
<a class="anchor" id="gaa85cc1774f18f306cd20a40fc50d0b36"></a><!-- doxytag: member="avformat.h::av_write_frame" ref="gaa85cc1774f18f306cd20a40fc50d0b36" args="(AVFormatContext *s, AVPacket *pkt)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#gaa85cc1774f18f306cd20a40fc50d0b36">av_write_frame</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structAVPacket.html">AVPacket</a> *&#160;</td>
          <td class="paramname"><em>pkt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Write a packet to an output media file. </p>
<p>This function passes the packet directly to the muxer, without any buffering or reordering. The caller is responsible for correctly interleaving the packets if the format requires it. Callers that want libavformat to handle the interleaving should call <a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1" title="Write a packet to an output media file ensuring correct interleaving.">av_interleaved_write_frame()</a> instead of this function.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>media file handle </td></tr>
    <tr><td class="paramname">pkt</td><td>The packet containing the data to be written. Note that unlike <a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1" title="Write a packet to an output media file ensuring correct interleaving.">av_interleaved_write_frame()</a>, this function does not take ownership of the packet passed to it (though some muxers may make an internal reference to the input packet). <br/>
 This parameter can be NULL (at any time, not just at the end), in order to immediately flush data buffered within the muxer, for muxers that buffer up data internally before writing it to the output. <br/>
 Packet's <a class="el" href="structAVPacket.html#a0d1cb9b5a32b00fb6edc81ea3aae2a49">stream_index</a> field must be set to the index of the corresponding stream in <a class="el" href="structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348">s-&gt;streams</a>. It is very strongly recommended that timing information (<a class="el" href="structAVPacket.html#a73bde0a37f3b1efc839f11295bfbf42a">pts</a>, <a class="el" href="structAVPacket.html#a85dbbd306b44b02390cd91c45e6a0f76">dts</a>, <a class="el" href="structAVPacket.html#af151ba1967c37038088883cd544eeacd">duration</a>) is set to correct values. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>&lt; 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1" title="Write a packet to an output media file ensuring correct interleaving.">av_interleaved_write_frame()</a> </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a83">transcode_aac.c</a>.</dd>
</dl>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00550">encode_audio_frame()</a>.</p>

</div>
</div>
<a class="anchor" id="ga37352ed2c63493c38219d935e71db6c1"></a><!-- doxytag: member="avformat.h::av_interleaved_write_frame" ref="ga37352ed2c63493c38219d935e71db6c1" args="(AVFormatContext *s, AVPacket *pkt)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1">av_interleaved_write_frame</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structAVPacket.html">AVPacket</a> *&#160;</td>
          <td class="paramname"><em>pkt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Write a packet to an output media file ensuring correct interleaving. </p>
<p>This function will buffer the packets internally as needed to make sure the packets in the output file are properly interleaved in the order of increasing dts. Callers doing their own interleaving should call <a class="el" href="group__lavf__encoding.html#gaa85cc1774f18f306cd20a40fc50d0b36" title="Write a packet to an output media file.">av_write_frame()</a> instead of this function.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>media file handle </td></tr>
    <tr><td class="paramname">pkt</td><td>The packet containing the data to be written. <br/>
 If the packet is reference-counted, this function will take ownership of this reference and unreference it later when it sees fit. The caller must not access the data through this reference after this function returns. If the packet is not reference-counted, libavformat will make a copy. <br/>
 This parameter can be NULL (at any time, not just at the end), to flush the interleaving queues. <br/>
 Packet's <a class="el" href="structAVPacket.html#a0d1cb9b5a32b00fb6edc81ea3aae2a49">stream_index</a> field must be set to the index of the corresponding stream in <a class="el" href="structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348">s-&gt;streams</a>. It is very strongly recommended that timing information (<a class="el" href="structAVPacket.html#a73bde0a37f3b1efc839f11295bfbf42a">pts</a>, <a class="el" href="structAVPacket.html#a85dbbd306b44b02390cd91c45e6a0f76">dts</a>, <a class="el" href="structAVPacket.html#af151ba1967c37038088883cd544eeacd">duration</a>) is set to correct values.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, a negative AVERROR on error. Libavformat will always take care of freeing the packet, even if this function fails.</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__lavf__encoding.html#gaa85cc1774f18f306cd20a40fc50d0b36" title="Write a packet to an output media file.">av_write_frame()</a>, <a class="el" href="structAVFormatContext.html#a00edb6b7a31f8dabfa668334ca1f92d7" title="Maximum buffering duration for interleaving.">AVFormatContext.max_interleave_delta</a> </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="muxing_8c-example.html#a30">muxing.c</a>, <a class="el" href="remuxing_8c-example.html#a45">remuxing.c</a>, and <a class="el" href="transcoding_8c-example.html#a102">transcoding.c</a>.</dd>
</dl>
<p>Referenced by <a class="el" href="transcoding_8c_source.html#l00366">encode_write_frame()</a>, <a class="el" href="remuxing_8c_source.html#l00046">main()</a>, <a class="el" href="muxing_8c_source.html#l00080">write_frame()</a>, and <a class="el" href="muxing_8c_source.html#l00490">write_video_frame()</a>.</p>

</div>
</div>
<a class="anchor" id="gaab766dccdff1bf323a2fc604e723b441"></a><!-- doxytag: member="avformat.h::av_write_uncoded_frame" ref="gaab766dccdff1bf323a2fc604e723b441" args="(AVFormatContext *s, int stream_index, AVFrame *frame)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#gaab766dccdff1bf323a2fc604e723b441">av_write_uncoded_frame</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stream_index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> *&#160;</td>
          <td class="paramname"><em>frame</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Write a uncoded frame to an output media file. </p>
<p>The frame must be correctly interleaved according to the container specification; if not, then <a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1" title="Write a packet to an output media file ensuring correct interleaving.">av_interleaved_write_frame()</a> must be used.</p>
<p>See <a class="el" href="group__lavf__encoding.html#ga37352ed2c63493c38219d935e71db6c1" title="Write a packet to an output media file ensuring correct interleaving.">av_interleaved_write_frame()</a> for details. </p>

</div>
</div>
<a class="anchor" id="gafe9916c601bba6827d6f9271a61260e4"></a><!-- doxytag: member="avformat.h::av_interleaved_write_uncoded_frame" ref="gafe9916c601bba6827d6f9271a61260e4" args="(AVFormatContext *s, int stream_index, AVFrame *frame)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#gafe9916c601bba6827d6f9271a61260e4">av_interleaved_write_uncoded_frame</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stream_index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structAVFrame.html">AVFrame</a> *&#160;</td>
          <td class="paramname"><em>frame</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Write a uncoded frame to an output media file. </p>
<p>If the muxer supports it, this function makes it possible to write an <a class="el" href="structAVFrame.html" title="This structure describes decoded (raw) audio or video data.">AVFrame</a> structure directly, without encoding it into a packet. It is mostly useful for devices and similar special muxers that use raw video or PCM data and will not serialize it into a byte stream.</p>
<p>To test whether it is possible to use it with a given muxer and stream, use <a class="el" href="group__lavf__encoding.html#ga5f6bebdc8c234a5ad9740de89acb15e6" title="Test whether a muxer supports uncoded frame.">av_write_uncoded_frame_query()</a>.</p>
<p>The caller gives up ownership of the frame and must not access it afterwards.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>&gt;=0 for success, a negative code on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga5f6bebdc8c234a5ad9740de89acb15e6"></a><!-- doxytag: member="avformat.h::av_write_uncoded_frame_query" ref="ga5f6bebdc8c234a5ad9740de89acb15e6" args="(AVFormatContext *s, int stream_index)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#ga5f6bebdc8c234a5ad9740de89acb15e6">av_write_uncoded_frame_query</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stream_index</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Test whether a muxer supports uncoded frame. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>&gt;=0 if an uncoded frame can be written to that muxer and stream, &lt;0 if not </dd></dl>

</div>
</div>
<a class="anchor" id="ga7f14007e7dc8f481f054b21614dfec13"></a><!-- doxytag: member="avformat.h::av_write_trailer" ref="ga7f14007e7dc8f481f054b21614dfec13" args="(AVFormatContext *s)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#ga7f14007e7dc8f481f054b21614dfec13">av_write_trailer</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Write the stream trailer to an output media file and free the file private data. </p>
<p>May only be called after a successful call to avformat_write_header.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>media file handle </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if OK, AVERROR_xxx on error </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="muxing_8c-example.html#a145">muxing.c</a>, <a class="el" href="remuxing_8c-example.html#a47">remuxing.c</a>, <a class="el" href="transcode_aac_8c-example.html#a90">transcode_aac.c</a>, and <a class="el" href="transcoding_8c-example.html#a124">transcoding.c</a>.</dd>
</dl>
<p>Referenced by <a class="el" href="muxing_8c_source.html#l00556">main()</a>, and <a class="el" href="transcode__aac_8c_source.html#l00637">write_output_file_trailer()</a>.</p>

</div>
</div>
<a class="anchor" id="ga8795680bd7489e96eeb5aef5e615cacc"></a><!-- doxytag: member="avformat.h::av_guess_format" ref="ga8795680bd7489e96eeb5aef5e615cacc" args="(const char *short_name, const char *filename, const char *mime_type)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structAVOutputFormat.html">AVOutputFormat</a>* <a class="el" href="group__lavf__encoding.html#ga8795680bd7489e96eeb5aef5e615cacc">av_guess_format</a> </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>short_name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>mime_type</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the output format in the list of registered output formats which best matches the provided parameters, or return NULL if there is no match. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">short_name</td><td>if non-NULL checks if short_name matches with the names of the registered formats </td></tr>
    <tr><td class="paramname">filename</td><td>if non-NULL checks if filename terminates with the extensions of the registered formats </td></tr>
    <tr><td class="paramname">mime_type</td><td>if non-NULL checks if mime_type matches with the MIME type of the registered formats </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="transcode_aac_8c-example.html#a20">transcode_aac.c</a>.</dd>
</dl>
<p>Referenced by <a class="el" href="transcode__aac_8c_source.html#l00120">open_output_file()</a>.</p>

</div>
</div>
<a class="anchor" id="gae8a1efab53a348857f209ea51037da4c"></a><!-- doxytag: member="avformat.h::av_guess_codec" ref="gae8a1efab53a348857f209ea51037da4c" args="(AVOutputFormat *fmt, const char *short_name, const char *filename, const char *mime_type, enum AVMediaType type)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__lavc__core.html#gaadca229ad2c20e060a14fec08a5cc7ce">AVCodecID</a> <a class="el" href="group__lavf__encoding.html#gae8a1efab53a348857f209ea51037da4c">av_guess_codec</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structAVOutputFormat.html">AVOutputFormat</a> *&#160;</td>
          <td class="paramname"><em>fmt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>short_name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>mime_type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="group__lavu__misc.html#ga9a84bba4713dfced21a1a56163be1f48">AVMediaType</a>&#160;</td>
          <td class="paramname"><em>type</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Guess the codec ID based upon muxer and filename. </p>

</div>
</div>
<a class="anchor" id="ga661ee0b2f3dbcaaef5d68f2f5d75e2d4"></a><!-- doxytag: member="avformat.h::av_get_output_timestamp" ref="ga661ee0b2f3dbcaaef5d68f2f5d75e2d4" args="(struct AVFormatContext *s, int stream, int64_t *dts, int64_t *wall)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="group__lavf__encoding.html#ga661ee0b2f3dbcaaef5d68f2f5d75e2d4">av_get_output_timestamp</a> </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structAVFormatContext.html">AVFormatContext</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t *&#160;</td>
          <td class="paramname"><em>dts</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t *&#160;</td>
          <td class="paramname"><em>wall</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get timing information for the data currently output. </p>
<p>The exact meaning of "currently output" depends on the format. It is mostly relevant for devices that have an internal buffer and/or work in real time. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir"></td><td class="paramname">s</td><td>media file handle </td></tr>
    <tr><td class="paramdir"></td><td class="paramname">stream</td><td>stream in the media file </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">dts</td><td>DTS of the last packet output for the stream, in stream time_base units </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">wall</td><td>absolute time when that packet whas output, in microsecond </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 if OK, <a class="el" href="group__lavu__error.html#gae4bb6f165973d09584e0ec0f335f69ca">AVERROR(ENOSYS)</a> if the format does not support it Note: some formats or devices may not allow to measure dts and wall atomically. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>