Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok I got it working. thanks to LordNeckbeard suggestion to use image2pipe. I had to use jpg encoding instead of <a href="https://ffmpeg.org/trac/ffmpeg/ticket/1272">png because image2pipe with png doesn't work on my verision of ffmpeg</a>. The first script is essentially the same as your question's code except I implemented a simple image creation that just creates images going from black to red. I also added some code to time the execution.</p> <p><strong>serial execution</strong></p> <pre><code>import subprocess, Image fps, duration = 24, 100 for i in range(fps * duration): im = Image.new("RGB", (300, 300), (i, 1, 1)) im.save("%07d.jpg" % i) subprocess.call(["ffmpeg","-y","-r",str(fps),"-i", "%07d.jpg","-vcodec","mpeg4", "-qscale","5", "-r", str(fps), "video.avi"]) </code></pre> <p><strong>parallel execution (with no images saved to disk)</strong></p> <pre><code>import Image from subprocess import Popen, PIPE fps, duration = 24, 100 p = Popen(['ffmpeg', '-y', '-f', 'image2pipe', '-vcodec', 'mjpeg', '-r', '24', '-i', '-', '-vcodec', 'mpeg4', '-qscale', '5', '-r', '24', 'video.avi'], stdin=PIPE) for i in range(fps * duration): im = Image.new("RGB", (300, 300), (i, 1, 1)) im.save(p.stdin, 'JPEG') p.stdin.close() p.wait() </code></pre> <p>the results are interesting, I ran each script 3 times to compare performance: <strong>serial:</strong></p> <pre><code>12.9062321186 12.8965060711 12.9360799789 </code></pre> <p><strong>parallel:</strong> </p> <pre><code>8.67797684669 8.57139396667 8.38926696777 </code></pre> <p>So it seems the parallel version is faster about 1.5 times faster.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload