I'd like to process the output of a youtube live stream every few seconds. With help from others I've come up with a solution to capture an image for processing later, but it tends to break and is much too slow:
youtube-dl --prefer-ffmpeg -f worst "https://www.youtube.com/watch?v=Gy5PC5Auoak" -o - | dd count=32 bs=4096 | ffmpeg -i - -f image2 -frames:v 1 img22.jpeg
(grabs 128 KB of stream data and extracts one frame from that into a jpg). The fastest run of this took about 30 seconds. Other attempts involved piping youtube-dl into mplayer, but the approach shown above seems to make more sense because it explicitly limits the amount of data received.
- Why is that taking so long? Also, might some advertisement have come in the way that just took the first 25 seconds or so?
- Are there faster solutions to this?
- an equal stream is available via ustream, if that makes it easier.
I would like the result to run on a raspberry pi.