How to convert mjpg file type to flv using ffmpeg?

0

1

I can convert avi, wmv and other video files easilly, but not this format. I`ve looked for some info how to convert mjpg files with ffmpeg and found nothing.

As this format is widely used in web cameras I need to handle this and think answer how to convert it will be usefull to everybody.

Yaroslav Yakovlev

Posted 2009-08-26T08:49:35.350

Reputation: 123

Answers

1

If you are referring to the m-jpeg format.
It might be a good idea to convert it to a regular mpg file and then to FLV.

This HOWTO is a good read if you are playing with ffmpeg.

nik

Posted 2009-08-26T08:49:35.350

Reputation: 50 788

really thanks for your answer! I knew a lot of information from that link. But still need to know hot to convert video from mjpg to mpg with ffmpeg? I dont mind to convert in two steps, just when I tried to convert it to mpg I got the following error:doesnt support 15/1 fps. my conversion string is the following: ffmpeg -i in.avi -out.mpg. I also tried ffmpeg -in.avi -sameq -r x -y out.mpg where x was from 1 to 15 and it didn`t work. Any ideas? – Yaroslav Yakovlev – 2009-08-26T10:42:38.897

0

m-jpeg is not one standard format. It is a group of formats that use a series of jpegs to store the frames of your video. Each implementation of this is propriotary and generally incompatible. So basically you need the codec from manufacturer of the camera (which will likely only be available for windows) and then you can use something like virtualdub to reencode it into a standard format.

ffmpeg won't use windows codecs so is not the ideal tool to use in this case.

I would highly recommend against converting to an mpg and then to an flv as reencoding twice incurs a big loss in quality over recoding directly. If you need to do it in 2 steps then the intermediate format should be uncompressed or a lossless format such as huffyuv.

JamesRyan

Posted 2009-08-26T08:49:35.350

Reputation: 1 591

0

I had the same issue but wanted .mp4 instead of .flv. Was able to get it working using ffmpeg (v1.1.2-tessus).

ffmpeg -i input_movie.mjpg -c:v libx264 output_movie.mp4

Once you have it in .mp4 you can easily convert it to other formats. Play around with using different codecs if you're looking for lossless quality conversion.

user1861862

Posted 2009-08-26T08:49:35.350

Reputation: 1