title: ffmpeg with Popen (python) on Windows
body: <p>I am trying to use ffmpeg with Popen. The ffmpeg command I am trying works on cmd but gives me error with Popen.</p>
  
  <p>I am using the standalone ffmpeg .exe:</p>
  
  <pre><code>ffmpeg -f gdigrab -offset_x 10 -offset_y 20 -show_region 1 -i desktop -video_size 1536x864 -b:v 2M -maxrate 1M -bufsize 1M -tune fastdecode -crf 15 -preset ultrafast -pix_fmt yuv420p -r 25 &lt;path&gt;/video.mov -qp 1 -y -an
  </code></pre>
  
  <p>This gives me <code>Invalid argument</code>, but if I remove the last parameters in order to make the output the last thing on the string, I get a different error:</p>
  
  <p><code>Output file #0 does not contain any stream</code></p>
  
  <p>I tried to use <code>-f dshow -i video="UScreenCapture"</code> instead of the gdigrab, but both give me the same error with and without the parameters in the end. </p>
  
  <p>Both commands work on command line.</p>
  
  <p>On command line this <code>ffmpeg -list_devices true -f dshow -i dummy</code> returns this:</p>
  
  <pre><code>[dshow @ 000001b24fa6a300] DirectShow video devices (some may be both video and audio devices)
  [dshow @ 000001b24fa6a300]  "Integrated Webcam"
  [dshow @ 000001b24fa6a300]     Alternative name "@device_pnp_\\?\usb#vid_1bcf&amp;pid_2b8a&amp;mi_00#6&amp;2c03619a&amp;0&amp;0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
  [dshow @ 000001b24fa6a300]  "UScreenCapture"
  [dshow @ 000001b24fa6a300]     Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\UScreenCapture"
  [dshow @ 000001b24fa6a300] DirectShow audio devices
  [dshow @ 000001b24fa6a300]  "Microphone (Realtek Audio)"
  [dshow @ 000001b24fa6a300]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{35EBFC89-7B09-4557-8032-85AA0B688FE9}"
  </code></pre>
  
  <p>But on popen I can't check it: </p>
  
  <p><code>-list_devices true -f dshow -i dummy: Invalid argument</code></p>
  
  <p>For the python part of the code I am using this:</p>
  
  <pre><code>p = subprocess.Popen([getPathForFile("windows/ffmpeg").replace('\\','/'),  " -f gdigrab -offset_x 10 -offset_y 20 -show_region 1 -i desktop -video_size 1536x864 -b:v 2M -maxrate 1M -bufsize 1M -tune fastdecode -crf 15 -preset ultrafast -pix_fmt yuv420p -r 25 -qp 1 -y -an "+ path.replace('\\\\','/').replace('\\','/')+"video.mov"], shell=True)
  </code></pre>
  
  <p>The <code>getPathForFile</code> is a custom function that returns the path. this is correct, mainly because the errors I am getting are from the ffmpeg, so...</p>
  
  <p>I am on a Windows 10. FFmpeg 4.0. Python 3.5.</p>
  
  <p>Any ideas why am I getting these errors on Popen but not on command line and how to fix them? (mainly the second error)</p>