title: Live streaming with FFmpeg
body: <p>How to use this code in python, please guide in detail i am completely new.</p>
  
  <pre><code>ffmpeg \
  -f alsa -ac 2 -i hw:1,0 \
  -f v4l2 -r 10 -i /dev/video0 \
  -c:v libx264 -pix_fmt yuv420p -preset ultrafast -g 20 -b:v 2500k \
  -c:a aac -ar 44100 \
  -threads 0 -bufsize 512k \
  -f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAM &amp;&gt; stream.log
  </code></pre>
  
  <p>i tried writing it in pycharm</p>
  
  <ol>
  <li><p>when i just pasted in the editor it gave me error as usual</p></li>
  <li><p>Then i tried it writing in os.system() and subprocess.call() like this</p></li>
  </ol>
  
  <h1>os.system</h1>
  
  <pre><code>os.system(ffmpeg \)
  os.system(-f alsa -ac 2 -i hw:1,0 \)
  os.system(-f v4l2 -r 10 -i /dev/video0 \)
  os.system(-c:v libx264 -pix_fmt yuv420p -preset ultrafast -g 20 -b:v 2500k\)
  os.system(-c:a aac -ar 44100 \)
  os.system(-threads 0 -bufsize 512k \)
  os.system(-f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAM &amp;&gt; stream.log)
  </code></pre>
  
  <h1>subprocess.call()</h1>
  
  <pre><code>subprocess.call(ffmpeg \)
  subprocess.call(-f alsa -ac 2 -i hw:1,0 \)
  subprocess.call(-f v4l2 -r 10 -i /dev/video0 \)
  subprocess.call(-c:v libx264 -pix_fmt yuv420p -preset ultrafast -g 20 -b:v 2500k\)
  subprocess.call(-c:a aac -ar 44100 \)
  subprocess.call(-threads 0 -bufsize 512k \)
  subprocess.call(-f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAM &amp;&gt; stream.log)
  </code></pre>
  
  <p>both time it gave me errors like </p>
  
  <pre><code>'-i' is not recognized as an internal or external command,
  operable program or batch file.
  '-vcodec' is not recognized as an internal or external command,
  operable program or batch file.
  '-acodec' is not recognized as an internal or external command,
  operable program or batch file.
  '-f' is not recognized as an internal or external command,
  operable program or batch file.
  </code></pre>
  
  <p>Please guide me and if there is any other way to upload a video to youtube live stream through python please let me know</p>