<html>
    <head>
      <base href="https://bugzilla.libav.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - The nut encoder can choose the wrong codec tag"
   href="https://bugzilla.libav.org/show_bug.cgi?id=883">883</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>The nut encoder can choose the wrong codec tag
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Libav
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>---
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>libavformat
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>bugzilla@libav.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>_@habnab.it
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In my specific case, I was using RGB24 UTVIDEO, and the nut encoder wrote out
the codec tag for RGBA UTVIDEO instead. 

<a href="https://code.videolan.org/libav/libav/blob/v11.2/libavformat/nutenc.c#L420-447">https://code.videolan.org/libav/libav/blob/v11.2/libavformat/nutenc.c#L420-447</a>
are the relevant lines from the version of libav I was using, but this appears
to affect git HEAD too. Specifically, av_codec_get_tag returns the first
matching tag, and nut defers to ff_codec_bmp_tags for some codec tags. Since 
<a href="https://code.videolan.org/libav/libav/blob/v11.2/libavformat/riff.c#L328-329">https://code.videolan.org/libav/libav/blob/v11.2/libavformat/riff.c#L328-329</a>
only lists AV_CODEC_ID_UTVIDEO, the first tag (ULRA, for RGBA) is chosen. Since
it isn't a RAWVIDEO codec, the nut encoder writes out that first tag instead of
consulting codec->codec_tag, which is the correct value ULRG. gdb shows:

(gdb) p (char[4])codec->codec_tag
$38 = "ULRG"
(gdb) p (char[4])codec_tag
$39 = "ULRA"</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are watching all bug changes.</li>
      </ul>
    </body>
</html>