Bash – ffmpeg capture current frame and overwrite the image output file

bashffmpeg

I am trying to extract the image file from a RTSP stream url every second (could be every 1 min also) and overwrite this image file.

my below code works but it outputs to multiple image jpg files: img1.jpg, img2.jpg, img3.jpg...

ffmpeg -i rtsp://IP_ADDRESS/live.sdp -f image2 -r 1 img%01d.jpg

How to use ffmpeg or perhaps bash scripts in Linux to overwrite the same image file while continuously extract the image at a NOT high frequecy, say 1 min or 10 sec?

Best Answer

Following command line should work for you.

ffmpeg -i rtsp://IP_ADDRESS/live.sdp -f image2 -updatefirst 1 img.jpg