[FFmpeg-user] R: R: Cannot generate a UDP stream of JPEG frames because there's no way to specify JPEG output if the output is not a file?

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Jun 17 22:08:47 CEST 2012

Marcello Antonucci <m.antonucci <at> ezness.it> writes:

> >> Afaict (and I may of course be wrong), mjpeg is a 
> >> sequence of jpeg images.
> Almost; to convert From MJPEG to JPEG you have to strip off 
> the AVI header (that each MJPEG frame has), and then you have 
> to add another header with specific JPEG information. This is 
> documented in ffmpeg user guide, if you search for "mjpeg2jpeg".

What you write is not necessarily "wrong", but please believe me 
that -f mjpeg does not do anything special to the jpeg frames 
(neither has it any effect to the encoder) - please note 
that you can easily test this by comparing the output of -f mjpeg 
with -f image2 and cat.

(Or in other words: FFmpeg cannot write AVI1, it can only read it, 
there is no way to add the header data that mjpeg2jpeg removes, 
it is not added by -f mjpeg.)

Please understand that -f image2 is a special muxer that is able 
to output multiple files for one stream (it does not only work 
for image codecs, you can also output individual non-I frames). 
As you found out, you can of course not use it with udp (that 
simply makes no sense imo).
For your problem, -f mjpeg is the answer, it simply concatenates 
the frames, that is what you asked originally afaiu.

Carl Eugen

More information about the ffmpeg-user mailing list