title: Nginx Live transcoding with ffmpeg
body: <p>I'm live streaming video to my server(It's external somewhere in the world).
  And what I'm trying to do here, is that my server will transcode the input to a lower bitrate before it pushes it to the video site like twitch and so on.</p>
  
  <p>And I'm doing this on windows. I have tried to google around watched youtube videos. and so on.. But couldn't find any solution for it. So here is what I have at this moment(not working).</p>
  
  <p>In my nginx.conf:</p>
  
  <pre><code>rtmp {
  server {
      listen 1935;
      chunk_size 8192;
  
      application code {
          live on;
  
      }
  
      application twitch {
          push rtmp://live-ams.twitch.tv/app/live_xxxxxxxxxxxxxxxxx;
      }
  }
  </code></pre>
  
  <p>So here the application code is receving the stream from my computer at home. I'm using ffmpeg to transcode it.</p>
  
  <p>And here is my batch file(That I have to start manualy. Can't start it within the config of nginx on windows.)</p>
  
  <pre><code>ffmpeg -i rtmp://localhost/code -vcodec flv -acodec copy -s 1280x720 -f flv rtmp://localhost/twitch
  pause
  </code></pre>
  
  <p>Right now It's just downscaling but that is okay. So this is supposed to send the stream back to the "twitch" application in my nginx config. And then nginx will stream it to twitch. </p>
  
  <p>But when I launch my ffmpeg bat file.. I get this:
  <img src="https://i.stack.imgur.com/ZqL8D.png" alt="enter image description here"></p>
  
  <p>So it's here my road ends. Anyone knows how to do this?</p>
  
  <p>Thanks in advance :) Stian</p>