2

I work with a Panasonic hcm280a camera that can be controlled by my software, It generates a stream of jpeg files that are huge and I want to convert this stream to a FLV stream preferably with a good compressional ration

Does FFMpeg do that? I am basically looking for an off the shelve open source software (or commercial software) that can generate that streaming media for me. Again my input is a stream of jpg files that come from the camera server.

Any insight or comment would be greatly appreciated Thanks

Mark
  • 10,754
  • 20
  • 60
  • 81
  • this one does the trick: http://sourceforge.net/projects/mjpg-streamer/ –  Jul 21 '12 at 23:15

4 Answers4

3

Answers to this question confirm that FFmpeg is able to build a video from a sequence of images. However, no detail is given there.

In FFmpeg FAQ you can find:

3.2 How do I encode single pictures into movies?

First, rename your pictures to follow a numerical sequence. For example, img1.jpg, img2.jpg, img3.jpg,... Then you may run:

ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg

Notice that %d is replaced by the image number.

img%03d.jpg means the sequence img001.jpg, img002.jpg, etc...

The same logic is used for any image format that ffmpeg reads.

Community
  • 1
  • 1
mouviciel
  • 66,855
  • 13
  • 106
  • 140
  • But I have streams of images, I don't have a bunch of picture and pictures come as I run my webcam, I want something that continuously runs on the server and encode pictures into the stream as they arrive – Mark Apr 15 '09 at 10:36
  • Sorry, I was confused by the "jpeg files" expression. – mouviciel Apr 15 '09 at 10:42
  • Then you'll need to compile a program that uses the ffmpeg libraries (libavcodec/libavformat) directly. The command-line tools can't really stream, though you could fake it by chunking a certain quantity of JPEGs as files into short streams played end-to-end. – bobince Apr 15 '09 at 11:34
1

Motion outputs flv files using ffmpeg: http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome you can disable the motion detection and make it output continuously (see 'output_all on' 'ffmpeg_video_codec flv').

Dave
  • 11
  • 1
1

This isn't specifically an answer to your question, but www.doom9.org is an excellent source of information video related, worth checking out the downloads and guides

Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
1

To do it with ffmpeg. I assume your frame are names as frame0000.jpg, frame0001.jpg, ...

ffmpeg -f image2 -r 1 -i frame%04d.jpg  -s 320x240 -y -an -r 24 out.flv

-r 1 tells that input stream is one frame per second (one image per second), choose the one you like -s 320x240 scales all frames -y -an to overwrite output file and to disable audio recording -r 24 to have 24 fps in the output stream

You can also consider putting -sameq in the middle to preserve quality as much as possible.

To rename all your frames properly, you can use this bash one liner:

i=0 ; for f in *.jpg ; do mv "$f" $(printf "frame%04d.jpg" $i) ; i=$((i+1)) ; done
sastanin
  • 40,473
  • 13
  • 103
  • 130
  • Not sure if we are on a same page, I guess your method generates FLV from a bunch of jpgs already stored on hard drive is that right? My jpeg s arrive as my webcam is running so I cannot assume they all exist already – Mark Apr 15 '09 at 11:10
  • Yes. Does it mean you camera generates a MJPEG stream? http://en.wikipedia.org/wiki/Motion_JPEG. If so, you can convert that stream as well. Probably something like -f mjpeg i streamfile will do. Or is it a V4L/V4L2 device? Then you can grab the stream too, smth like, -f mjpeg -vd /dev/video0 – sastanin Apr 15 '09 at 12:08
  • Or does your cam write an additional JPEG once in a while? In this case I don't know a solution. – sastanin Apr 15 '09 at 12:10