How to capture an ip camera (mjpeg) stream and replay it later via commandline?

Rodja picture Rodja · Apr 18, 2012 · Viewed 11.4k times · Source

To test a software which processes ip camera streams (eg. mjpeg) I would like to capture a short sequence from an original camera and later stream this recording in loop as if it would come from an ip camera. It should be commandline based to simplify automated integration testing.

I already figured out the recording part (capturing 10 seconds):

$ vlc -I dummy --run-time=10 http://192.168.0.142:8080/videofeed  --sout=file/asf:test-stream.asf vlc://quit

How to use vlc or similar to loop this recording as a mjpeg stream served on http://localhost:8080 or similar?

Answer

Rodja picture Rodja · Apr 18, 2012

I figured it out by myself:

$ vlc  -I dummy  -vvv test-stream.asf -L --sout '#standard{access=http,mux=mpjpeg,dst=:8080}'