问题
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!
回答1:
did you try this?
ffmpeg -i <URL> -r 1 out%03d.jpg
来源:https://stackoverflow.com/questions/19191717/how-to-continuously-extract-video-frames-from-streaming-rtmp-using-avconv-ffmp