title: Execute FFmpeg command in Python on Raspberry PI
body: <p>I used FFmpeg to record video on my Raspberry PI. The code is here:</p>
  
  <pre><code>ffmpeg -f video4linux2 -y -r 4 -i /dev/video0 -vf "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:expansion=strftime:text='%Y-%m-%d %H\\:%M\\:%S': fontcolor=white:box=1:boxcolor=black@0.8:x=w-text_w:y=h-line_h" -vframes 20 -vcodec mpeg4 out.mp4 
  </code></pre>
  
  <p>I ran this code in terminal and it worked fine. However I need to run this by using Python. Then I wrote this code which shown below:</p>
  
  <pre><code>from subprocess import Popen
  from os import system
  x = "drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:expansion=strftime:text='%Y-%m-%d %H\\:%M\\:%S': fontcolor=white:box=1:boxcolor=black@0.8:x=w-text_w:y=h-line_h"
  result = ['ffmpeg', '-f', 'video4linux2', '-y', '-r', '4', '-i', '/dev/video0', '-vf', x, '-vframes ','20', '-vcodec', 'mpeg4', 'out.mp4']
  Popen(result)
  </code></pre>
  
  <p>It is working for only a very short time (absolutely less than 1s). Anything wrong with it?</p>