title: WebRTC MediaDevices with Golang and Pion on a Windows 10 "pkg-config error"
body: <p>I try to follow this documentation <a href="https://github.com/pion/mediadevices" rel="nofollow noreferrer">https://github.com/pion/mediadevices</a>. But somehow i constantly run into errors. First i had to install MinGW (gcc). Then i had the problem that i have to install the 64_84 version of it. That done i had the problem that i won't work without pkg-config. So i also installed that. But not finished. Now i had this error:</p>
  <pre><code>pkg-config --cflags -- x264&lt;/br&gt;
  pkg-config --cflags -- x264&lt;/br&gt;
  pkg-config: exit status 0xc0000135&lt;/br&gt;
  </code></pre>
  <p>After a while of trying different non working solutions i found this <a href="https://tousu.in/qa/?qa=419107/" rel="nofollow noreferrer">https://tousu.in/qa/?qa=419107/</a>.</p>
  <p>After this it kinda worked. In cmd I could enter pkg-config --help and got an help sheet.</p>
  <p>In the MediaDevice Golang project i tried to run the command go run main.go. Sadly now i get this error and now i don't know what to do.</p>
  <pre><code>pkg-config --cflags  -- x264 &lt;br /&gt;
  Package x264 was not found in the pkg-config search path. &lt;br /&gt;
  Perhaps you should add the directory containing `x264.pc' &lt;br /&gt;
  to the PKG_CONFIG_PATH environment variable &lt;br /&gt;
  No package 'x264' found &lt;br /&gt;
  pkg-config: exit status 1 &lt;br /&gt;
  PS C:\Projects\go-webrtc_pion&gt; &lt;br /&gt;
  </code></pre>
  <p>My main.go looks like this:</p>
  <pre><code>package main
  
  import (
      &quot;fmt&quot;
      &quot;image/jpeg&quot;
      &quot;os&quot;
  
      &quot;github.com/pion/mediadevices&quot;
      &quot;github.com/pion/mediadevices/pkg/codec/x264&quot;
      // &quot;github.com/pion/mediadevices/pkg/driver/camera&quot;
      // &quot;github.com/pion/mediadevices/pkg/prop&quot;
  
      // This is required to register camera adapter
      _ &quot;github.com/pion/mediadevices/pkg/driver/camera&quot;
      // Note: If you don't have a camera or your adapters are not supported,
      //       you can always swap your adapters with our dummy adapters below.
      // _ &quot;github.com/pion/mediadevices/pkg/driver/videotest&quot;
  )
  
  func main() {
  
      // configure codec specific parameters
      x264Params, _ := x264.NewParams()
      x264Params.Preset = x264.PresetMedium
      x264Params.BitRate = 1_000_000 // 1mbps
  
      codecSelector := mediadevices.NewCodecSelector(
          mediadevices.WithVideoEncoders(&amp;x264Params),
      )
  
      
      stream, _ := mediadevices.GetUserMedia(mediadevices.MediaStreamConstraints{
          Video: func(constraint *mediadevices.MediaTrackConstraints) {},
          Codec: codecSelector,
      })
      fmt.Println(stream)
  
      // Since track can represent audio as well, we need to cast it to 
      // *mediadevices.VideoTrack to get video specific functionalities
      track := stream.GetVideoTracks()[0]
      videoTrack := track.(*mediadevices.VideoTrack)
      defer videoTrack.Close()
  
  
      // Create a new video reader to get the decoded frames. Release is used 
      // to return the buffer to hold frame back to the source so that the buffer 
      // can be reused for the next frames.
      videoReader := videoTrack.NewReader(false)
      frame, release, _ := videoReader.Read()
      defer release()
  
      // Since frame is the standard image.Image, it's compatible with Go standard 
      // library. For example, capturing the first frame and store it as a jpeg image.
      output, _ := os.Create(&quot;frame.jpg&quot;)
      jpeg.Encode(output, frame, nil)
  }
  </code></pre>