title: How to properly configure ffmpeg for the Go wrapper
body: <p>I've been trying out the wrapper for ffmpeg written in Go (<a href="https://github.com/imkira/go-libav/" rel="nofollow noreferrer">imkira/go-libav</a>) and tried to follow the example, but after a successful build I've got an error that the decoder can't be found.<br>
  This is the part of code where the error occurs:</p>
  
  <pre><code>if ctx.decStream = firstStream(ctx.decFmt); ctx.decStream == nil {
    log.Fatalf("Couldn't find a video stream.")
  }
  
  codecCtx := ctx.decStream.CodecContext()
  codec := avcodec.FindDecoderByID(codecCtx.CodecID())
  if codec == nil {
    log.Fatalf("Could not find decoder: %v\n", codecCtx.CodecID())
  }
  </code></pre>
  
  <p>The <code>first_stream</code> function:</p>
  
  <pre><code>func firstStream(fmtCtx *avformat.Context) *avformat.Stream {
    for _, stream := range fmtCtx.Streams() {
      switch stream.CodecContext().CodecType() {
        case avutil.MediaTypeVideo:
          return stream
      }
    }
    return nil
  }
  </code></pre>
  
  <p>That's the same as in the example, which also has the same problem. I assume it isn't code-based but I can't figure it out. I tried registering all formats but actually it happens in the <code>init()</code> function.<br>
  I'm using Manjaro Linux 19.0.0 and have FFmpeg 3.3.9 installed from source.</p>