-
Notifications
You must be signed in to change notification settings - Fork 1.7k
RaspiCam V4L2 MJPEG mode stopped working under kernel 3.18 #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@6by9 any ideas? |
Not off the top of my head. I seem to recall a fair amount changed around 3.14 within V4L2 buffer management (I only know that due to trying to build drivers for my DVB-S2 cards which the manufacturer hasn't upstreamed, just provides patches for particular kernel releases). Oddly that callstack is showing it being solely within the V4L2 and videobuf2 framework code, it hasn't apparently touched the bcm2835-v4l2 driver at this point. Any chance either of you could just try the simple streaming example using v4l2-ctl from http://www.raspberrypi.org/forums/viewtopic.php?f=43&t=62364 first post with each of the pixel formats (0 to 13 I think it is)? If not I'll try to find some time later on. |
Hmm, the warning has the comment against it of
The docs for stop_streaming then say
Sounds plausible that we aren't returning all the buffers, although I need to check exactly when buffers are dequeued and requeued. |
Further thought whilst waiting for my new 3.18 tree to build, this is only a warning message on stop_streaming so shouldn't stop anything else working. Do you get any frames through in MJPEG mode and things die when stopping, or does it just produce nothing at all? |
Tested v4l2-ctl with pixelformat 0...13, no error messages during runs:
This produces files between 4 and 800 MB which I could not play on my Mac. For every run the warning appears in dmeg at the end of the stream (with different PIDs):
Tested again mjpeg-streamer and it works without problems in YUYV mode (the -y flag, no warning in dmesg) but does not show any video in MJPEG mode (with warning in dmesg):
If it's just a warning, it's strange that things stopped working with mjpg-streamer just by updating to 3.18. Can I help with something else? |
Thank you so much for doing that - my time for playing with the Pi is very limited, so having a decent description and as much debug as possible makes my life much easier. Pixel format 4 (H264) should play back in VLC happily. I'm still fairly confident that is just a warning and shouldn't cause any issues. It's also on stop_streaming only, and I wouldn't expect mjpg_streamer to be stopping the stream too often. There is extra logging you can enable from the V4L2 driver via debugfs. I can never remember exactly where it is, but a I'm looking at a couple of other minor issues in the time that I do get, but should hopefully get a chance to look at this properly soon. |
Okay, happy if I can do my part. Will try the next steps later, there seems to be something else regarding mjpg-streamer and 3.18, but with a USB webcam: http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97983 |
That does seem to imply that something odd is happening to an MJPEG stream, potentially within the V4L2 core. I can't see why both Pi Camera and a Logitech camera would suddenly start showing issues otherwise. That might make capturing the output from v4l2-ctl with pixelformat=5 and analysing it more useful. I think the runes need to be something like |
Yes, the output pixelformat=5 (MJPG) plays back without problems and shows the video as expected. So indeed, that part seems to work. Whatever causes the warning and stops mjpg-streamer from working remains unknown. |
I did download and run the latest V4L2 conformance test last night. It threw up 7 failures (about 38 passes) which may shed some light on the issue. Generally they're minor whinges rather doing anything significantly wrong though. It'd also be worth trying qv4l2 (part of v4l-utils same as v4l2-ctl) which is a QT graphical app that provides the equivalent to v4l2-ctl but also allows viewing the images. If MJPEG works from there, then I really am running out of ideas. |
May be a total red herring, but just picked up on Hexxeh/rpi-firmware#57 which has been linked to https://bugzilla.kernel.org/show_bug.cgi?id=81611 "[regression] in kernel 3.16, uvcvideo no longer works for usb Laptop_Integrat..." |
I did some testing with my Logitech C270 and following apps: guvcview, mjpg-streamer and qv4l2 on Rasbian with kernel 3.12 and 3.18 and also on my desktop with Ubuntu 14.04 with kernel 3.13 and 3.16. All application are running OK with kernel 3.12 (raspberry) and 3.13 (desktop), however with newer kernel 3.16 (desktop) and 3.18 (raspberry) only qv4l2 is working correctly and mjpg-streamer is working only with YUYV, but not with MJPG. |
Yes this does make sense. Per a discussion in http://www.mail-archive.com/[email protected]/msg80144.html between the developers it seems the v4l2-core.c module had a bug fixed that gucview and, apparently, mjpg-streamer relied on. With the "fix", the apps broke. It looks like Paulo Assis did develop a workaround to the fix in gucview but I assume the input_uvc.c module has not been touched. I am going to test the "jacksonliam" fork and see how that works. UPDATE: I looked at the "jacksonliam" project and there is nothing in the input_uvc plugin that has been updated recently. Not sure why it should work under 3.18+ without compensating for the bytesused field change. I'm going to skip testing it at this point. |
https://github.com/jacksonliam/mjpg-streamer is using the MMAL library directly rather than going through UVC (not applicable for the Pi Camera anyway) or V4L2, hence probably working without issue with the Pi Camera. |
I think mjpg-streamer can use V4L2, because I compiled with "make USE_LIBV4L2=true" |
mjpg_streamer by default uses V4L2, and USE_LIBV4L2 builds the UVC input module with different options to use the libv4l2 helper library. jacksonliam's version includes an alternate input plugin to talk directly to the Pi GPU using MMAL. You didn't say what command line you were using to launch mjpg-streamer in each case. It looks like you have to amend the command line to ask for input-raspicam to get the direct MMAL option, so perhaps it was still using V4L2 but somehow not hitting the issue. |
Sorry for confusion, I didn't noticed you were referring only to "jacksonliam's version", so my comment doesn't make sense. (I used "make USE_LIBV4L2=true" only with general version of mjpg-streamer.) Here is a patch for mjpg-streamer as was published on http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97983&sid=dfb94ec454719c686940ff9983162fba
|
Can we close this then, as it isn't a firmware bug? |
IMHO it is fixed. Streaming is working fine on 3.18.xx with the above patches. |
Before kernel 3.18 I could use the bcm2835-v4l2 kernel module to access the Raspberry Pi via /dev/video0 in MJPEG format with mjpg-streamer.
Starting with kernel 3.18 something seems to be broken, mjpg-streamer does not work in MJPEG mode anymore but only in YUYV mode.
dmsg output regarding this problem:
The text was updated successfully, but these errors were encountered: