[FFmpeg-devel] [PATCH] allow v4l2 to capture mjpeg streams

Ramiro Polla ramiro.polla
Mon Dec 14 03:22:40 CET 2009

On Thu, Dec 10, 2009 at 6:49 AM, Luca Abeni <lucabe72 at email.it> wrote:
> Hi,
> On Wed, 2009-12-09 at 22:40 -0800, klchxbec wrote:
>> Luca,
>> Thanks for the comments. Attaching a revised patch.
> Thanks; it looks good now. I am waiting few days so that other people
> can comment... Then, if there are no objections from other people I'll
> commit your patch.
> [...]
>> >I think the code following these lines will end up by setting a wrong
>> >st->codec->bit_rate in case of compressed formats.
>> Ok, mjpegdec.c seems to cope fine with this. I can't notice anything
>> wrong. Looked at v4l2 api as well as luvcview sources for any clues,
>> but don't see what should be done here.
> I think the application will see the wrong bit_rate for the stream
> (unless something else sets it to the correct value). In my opinion, the
> line
> ? ? ? ?st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
> should be conditional to s->frame_size > 0. Anyway, I can do it after
> committing your patch.

Works fine on the device I have. Thanks.

By the way if the frame rate isn't specified ffmpeg reads data until
it can guess the frame rate (I think?). This is not a good behaviour
on capture devices since it seems to just hang, there's no feedback to
the user...

Ramiro Polla

More information about the ffmpeg-devel mailing list