Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to extract jpeg images from an mjpeg stream. I've done a search and found a few sources, but those were extracting jpeg images from a mjpeg file, such as this one here. In my case, I don't have a file, but a live video stream. How can I extract jpeg images from this mjpeg stream? My goal at the end of the day is to recreate the video from a series of jpegs.

I'm looking for a command line answer to use in a terminal, as I'm using Ubuntu Server without GUI. If possible, it'd be great if frame rate and/or quality can be configured. I've looked at ffmpeg, libav and vlc, but I can't quite figure it out. Can anyone help?

share|improve this question
    
Couldn't you just save the stream and extract it later—or not extract it at all since you only need the video? Do you have an example stream URL? –  slhck Sep 17 '13 at 6:17
    
Apart from recreating the video, I also have use for the images. Also, the stream might be ongoing for extended periods of time (several hours). In this case, I would have an extremely large file which is inconvenient for me. I plan to send this recording of the live stream to a Tomcat server. I'm not so familiar with all this video/media stuff, but I'm guessing that it's easier to send images rather than packets of data of a video. An example of the stream URL would be http://192.168.254.102:8080/stream?topic=/camera/rgb/image_color. –  Andrew Sep 17 '13 at 7:04

1 Answer 1

up vote 0 down vote accepted

I found a vlc command that solved my issue:

vlc -I dummy \
http://192.168.254.102:8080/stream?topic=/camera/rgb/image_color/ \
--video-filter=scene \
--vout=dummy \
--scene-format=jpg \
--scene-ratio=1 \
--scene-prefix=snapshot \
--scene-path=/home/andrew/frames \
vlc://quit

This saves every frame from the stream. If I want to capture one frame every 10, The --scene-ratio value can changed to 10: --scene-ratio=10.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.