Note that there are some explanatory texts on larger screens.

plurals
  1. PONode.js asynchronous video conversion slow
    primarykey
    data
    text
    <p>I wrote a little website/service, which can download a video from a website (currently Youtube) and converts it on the fly to an mp3 file and sends this file back as the response.</p> <p>For example, you when you request <a href="http://localhost:8000/v=http://www.youtube.com/watch?v=HhoewflkQu0" rel="nofollow">http://localhost:8000/v=http://www.youtube.com/watch?v=HhoewflkQu0</a>, then it will download this video and response the audio layer encoded in MP3.</p> <p>This all works very well, my problem is that this is very slow and I can't figure out why.</p> <hr> <p>Simplified the script behaves like this:</p> <p>Download the video and write it to the stdin of ffmpeg, and the stdout goes to the response. Video (MP4, FLV) -> FFMPEG -> MP3</p> <p>I used curl to figure out how fast the script is:</p> <pre><code>$ curl http://localhost:8000/v=http://www.youtube.com/watch?v=HhoewflkQu0 </code></pre> <p>I get only about 5-10k.</p> <p>So why is this so slow?</p> <ol> <li>The server, from which I am downloading the video is slow.</li> <li>The conversion is slow (because of a slow CPU).</li> <li>The data transfer between node.js -> FFMPEG is slow.</li> </ol> <p>I tried to download the video in a normal download manager, and i got about 320k, which is my normal download speed, so the first point isn't the bottleneck.</p> <p>To point 2 and 3, I tried to write a local file to the stdin, and I got about 600k so that isn't it either.</p> <p>So why is my script so slow, and what can I do to make it faster?</p> <p><a href="https://gist.github.com/1304637" rel="nofollow">https://gist.github.com/1304637</a></p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    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. 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