title: Python Video Manipulation
body: <p>I'm new with python and I want to do is receive UDP stream (streaming from VLC, H264) and make any modifications to the video and display it (Python 2.7).</p>
  
  <p>I used openCV (openCV 2.4.9) and I can receive video frames and also modify it. Now I need to do is create a video file using these frames and display it and I don't need to save both frames and the video.</p>
  
  <p>I tried <em>FFMPEG,FFPLAY</em> and it works on saved video frames.</p>
  
  <p>I appreciate that if you can point out the steps or any other alternatives.</p>
  
  <p>First of all sorry about my explanation early. Here is what I've tried:</p>
  
  <ol>
  <li><p>Receive UDP video stream.</p></li>
  <li><p>Modify the video stream: I used openCV and get video frames from stream and modified them it working.</p>
  
  <pre><code>cap = cv2.VideoCapture("udp://224.1.1.1:1234")
  while(cap.isOpened()):
      success, image = cap.read()
      ...
      cv2.imwrite("./frames/frame%d.jpeg" %count, image)
      count += 1
  </code></pre></li>
  <li><p>Create video and display: I tried FFMPEG and FFPLAY</p>
  
  <pre><code>command1 = 'ffmpeg -i ./frames/frame%d.jpeg -c:v libx264 -vf fps=23.97 -pix_fmt yuv420p -f rawvideo -'
  command2 = 'ffplay -'
  
  pipe1 = sp.Popen(command1,stdout=sp.PIPE)  
  pipe2 = sp.Popen(command2,stdin=pipe1.stdout)
  </code></pre></li>
  </ol>
  
  <p>These steps working but I cannot save frames or video file physically. I need to do is after step 2 direcly pass video frames to FFMPEG, FFPLAY to play without saving them in frames folder.</p>