Opened 10 years ago

#1753 new defect

v4l2 compressed streams need accurate framesize

Reported by: pete@… Owned by: reimar
Priority: normal Component: streaming
Version: HEAD Severity: normal
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: Analyzed by developer:


When capturing compressed MJPEG video from a Video4Linux2 capture device and storing the result in an AVI format using -ovc copy, the bitrate in the video stream is much larger than expected. The following command produces the next line of stream statistics (notice the bitrate is roughly 150Mbit!)

mencoder tv:// -tv driver=v4l2:outfmt=mjpg:width=640:height=480:norm=NTSC:noaudio -fps 30 -ovc copy -o output_mjpeg.avi

Video stream: 147456.000 kbit/s (18432000 B/s) size: 58982400 bytes 3.200 secs 96 frames

This is due to the framesize calculation in stream/tvi_v4l2.c:get_video_framesize() not waiting for a frame before returning the maximum allowed frame size.

The attached patch produces a more reasonable result for the stream bitrate:

Video stream: 13116.062 kbit/s (1639507 B/s) size: 5519676 bytes 3.367 secs 101 frames

Attachments (1)

v4l2_compressed_streams_need_accurate_framesize.patch (724 bytes) - added by pete@… 10 years ago.

Download all attachments as: .zip

Change History (1)

Changed 10 years ago by pete@…


Note: See TracTickets for help on using tickets.