mpromonet / v4l2rtspserver

RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
The Unlicense
1.86k stars 428 forks source link

Green screen when using MJPG and non default resolution #265

Closed FBITuco closed 1 year ago

FBITuco commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Hello. I found similar problem as in #170 and #140 When using camera "default" resolution 1920x1080 (As default i mean first resolution listed in "v4l2-ctl -d /dev/video0 --list-formats-ext"), all works ok. Used command is: v4l2rtspserver -vvv -fMJPG -W 1920 -H 1080 -A 8000 -C 1 -a S16_LE /dev/video0,pcm.mic_lef t See -vvv log from v4l2rtspserver: v4l2rtspserver-1080.log

See log from ffplay: ffplay-1080.log

But when I try to use different resolution, I only can see green screen with some different colors in top. Command example: v4l2rtspserver -vvv -fMJPG -W 1280 -H 720 -A 8000 -C 1 -a S16_LE /dev/video0,pcm.mic_left image

See -vvv log from v4l2rtspserver: v4l2rtspserver-720.log

See log from ffplay (Look for error string): ffplay-720.log

Desktop (please complete the following information):

Thanks for your work!

khw1006 commented 2 years ago

Hello, FBITuco. Did you solve this problem? I have a same problem. And where did you get 0.2.4 version? I can only find 0.2.1 version. Thank you in advance.

mpromonet commented 2 years ago

Hi @khw1006,

Last release is 0.3.3, you can get it from https://github.com/mpromonet/v4l2rtspserver/releases

Best Regards, Michel.

FBITuco commented 2 years ago

Hello @khw1006. I believe that this is not bug, it is a "feature". RTSP will not transfer huffman tables. RTSP receiver is using tables defined in JPEG standard (See https://ffmpeg.org/doxygen/trunk/jpegtables_8c_source.html). Some webcams will use different huffman tables for different resolutions. This is why when you capture .jpeg image from camera and open it, all looks ok, but images sended over RTSP will not work.

There is no simple way how to "fix" this. You can modify rtspserver application (Need to convert received .jpeg from camera to image with "correct" huffman tables. Captured frame from camera is here: https://github.com/mpromonet/v4l2rtspserver/blob/master/src/V4L2DeviceSource.cpp#L168), or you can modify application which is receiving stream with huffman tables corresponding to .jpeg image from camera.

Or You need to buy different camera :-). Have a nice day!

This issue probably can be closed.