3

We're dealing with streaming video on RTMP and my goal is to extract frames from the stream at a given interval, e.g. every 1 second.

Currently I run a command in a loop, which takes a frame and exports it as base64 JPEG:

avconv -i <URL> -y -f image2 -ss 3 -vcodec mjpeg -vframes 1 -s sqcif /dev/stdout 2>/dev/null | base64 -w 0

But each of these processes is long (takes a few seconds -- which adds even more delay on streaming video that's not real time already). I am wondering if there is a way to make avconv or ffmpeg to extract frames at an interval (in seconds or frames) and either save as a file or dump to stdout.

I would really appreciate your help!

Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131
mvbl fst
  • 5,213
  • 8
  • 42
  • 59
  • Do you want the extracted image output to be continuously overwritten or do you want numbered, sequential image outputs? – llogan Oct 04 '13 at 23:20
  • @LordNeckbeard I expect it to be stringified to base64 inline PNG and immediately sent to another server. – mvbl fst Oct 08 '13 at 20:55

1 Answers1

3

did you try this?

ffmpeg -i <URL> -r 1 out%03d.jpg
stakasha
  • 316
  • 2
  • 6
  • I believe it is adequate as an answer. The example will output 1 frame per second as numerically sequential image files. – llogan Oct 08 '13 at 21:46