After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 657079 - JPEG RTP Payloader Change to support FaceVsion Webcams
JPEG RTP Payloader Change to support FaceVsion Webcams
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.x
Other Linux
: Normal normal
: 1.1.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-08-22 14:03 UTC by Robert Krakora
Modified: 2013-06-26 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
JPEG RTP Payloader Change to support FaceVsion Webcams (1.39 KB, patch)
2011-08-22 14:04 UTC, Robert Krakora
none Details | Review
Previous patch is incorrect... (712 bytes, patch)
2011-08-23 11:34 UTC, Robert Krakora
none Details | Review
Obsolete Prior Patch... (940 bytes, patch)
2011-08-23 16:14 UTC, Robert Krakora
none Details | Review
MJPEG from Creative Optia AF Webcam (516.36 KB, image/jpeg)
2013-01-28 14:26 UTC, Robert Krakora
  Details
gstrtpjpegpay.c containing "hack" to allow RTP encapsulation of Optia AF MJPEG (25.64 KB, text/plain)
2013-01-28 14:32 UTC, Robert Krakora
  Details
gdppay results (785.42 KB, application/octet-stream)
2013-01-28 15:29 UTC, Robert Krakora
  Details
Skype Specification (1.10 MB, application/pdf)
2013-05-28 15:14 UTC, Robert Krakora
  Details
Skype Library (1.42 MB, application/gzip)
2013-05-28 15:15 UTC, Robert Krakora
  Details

Description Robert Krakora 2011-08-22 14:03:20 UTC
FaceVsion webcames (E1 and V1) seem to break the JPEG RTP Payloader when they issue an EOI with no SOS.  The patch that is attached fixes the issue.  However, I am not certain as to how.  I see no disruption in video due to the fix, but my knowledge on motion JPEG is somewhat limited.  This patch needs review by someone that is more knowledgeable that myself on motion JPEG.
Comment 1 Robert Krakora 2011-08-22 14:04:07 UTC
Created attachment 194367 [details] [review]
JPEG RTP Payloader Change to support FaceVsion Webcams
Comment 2 Robert Krakora 2011-08-23 11:34:52 UTC
Created attachment 194474 [details] [review]
Previous patch is incorrect...
Comment 3 Robert Krakora 2011-08-23 16:14:08 UTC
Created attachment 194495 [details] [review]
Obsolete Prior Patch...
Comment 4 David Schleef 2011-08-27 07:20:39 UTC
I suppose technically a JPEG image with no actual data would be valid, but that doesn't seem very useful.

What happens when you use jpegparse before the payloader?  (Without the patch, obviously.)
Comment 5 Robert Krakora 2011-08-27 17:37:34 UTC
(In reply to comment #4)
> I suppose technically a JPEG image with no actual data would be valid, but that
> doesn't seem very useful.
> 
> What happens when you use jpegparse before the payloader?  (Without the patch,
> obviously.)

Hi David,

I tried placing jpegparse before the payloader without the patch and it really had no affect.  This occurs with the Logitech B990 and the FaceVsion E1 webcams.  There are SOI without EOI and then and EOI every nth SOI.  I am a MPEG2 transport/MPEG4 container guy, I don't have a lot of experience with Motion JPEG.  However, with this change I do not see the payloader throwing an error any more and halting the pipeline.  This also occurred with a beta version of a Creative webcam that I was testing as well.  All three cameras also support H.264 but not multiplexed with Motion JPEG as proposed in the specification that Logitech co-authored and presented to USB-IF.

Best Regards,

Rob
Comment 6 Wim Taymans 2013-01-28 12:12:12 UTC
Could you make a capture available? 

something ... ! gdppay ! filesink location="..."
Comment 7 Robert Krakora 2013-01-28 13:57:00 UTC
Hi Wim,

I will capture some MJPEG from the camera and upload it today.  I will also post my hack-around.

Best Regards,

Rob
Comment 8 Robert Krakora 2013-01-28 14:26:45 UTC
Created attachment 234620 [details]
MJPEG from Creative Optia AF Webcam

MJPEG from Creative Optia AF Webcam that cannot be RTP encapsulated without "hack" to gstrtpjpegpay.c.
Comment 9 Robert Krakora 2013-01-28 14:32:18 UTC
Created attachment 234621 [details]
gstrtpjpegpay.c containing "hack" to allow RTP encapsulation of Optia AF MJPEG

gstrtpjpegpay.c containing "hack" to allow RTP encapsulation of Optia AF MJPEG...
Comment 10 Robert Krakora 2013-01-28 14:36:53 UTC
Hi Wim,

Let me know if you need anything else...there is one Logitech webcam, one FaceVsion webcam and one Creative webcam from which I have seen MJPEG such as this.  If I use qtmux to encapsulate it, then it plays fine under QuickTime on a Mac or a PC.

Best Regards,

Rob Krakora
Comment 11 Robert Krakora 2013-01-28 14:47:54 UTC
Using GStreamer RTSP server I pass in this pipeline:

v4l2src device=/dev/video0 ! queue ! image/jpeg,width=640,height=480,framerate=(fraction)30/1 ! queue ! rtpjpegpay pt=26 name=pay0

Using GStreamer RTSP Source I use this pipeline:

gst-launch -e rtspsrc location=rtsp://<server IP>:<server Port>/<filename>.sdp ! rtpjpegdepay ! qtmux ! filesink location=<some path to file>.mov

The result plays fine on QuickTime on Mac or PC...as well as on Totem on Linux...
Comment 12 Robert Krakora 2013-01-28 14:48:14 UTC
Let me know if you need more information...
Comment 13 Wim Taymans 2013-01-28 15:01:32 UTC
There is just an incomplete jpeg frame at the end and the payloader doesn't like it but surely that's not the problem you are seeing..

What I want to know is what data you feed into the jpeg payloader. The payloader can only handle one jpeg frame per input buffer. Are you feeding a payloader from an http src?

I would like a capture of the stream like you would put it in the payloader so:

httpsrc location="..." ! gdppay ! filesink location="..."
Comment 14 Wim Taymans 2013-01-28 15:02:52 UTC
so,

v4l2src device=/dev/video0 ! image/jpeg,width=640,height=480,framerate=(fraction)30/1 ! gdppay ! filesink location="..."

would be interesting
Comment 15 Robert Krakora 2013-01-28 15:29:34 UTC
Created attachment 234629 [details]
gdppay results
Comment 16 Robert Krakora 2013-01-28 15:40:16 UTC
JPEG frames are quite large and Bugzilla limits the size to 10 Meg...may I share a larger capture with you via my YouSendIt account?
Comment 17 Robert Krakora 2013-01-28 15:43:28 UTC
If you look at "MY HACK" below, you will see what I had to do...maybe this will also provide some clues...

      case JPEG_MARKER_EOI:
        GST_WARNING_OBJECT (pay, "EOI reached before SOS!");
	gst_buffer_unref (buffer); // <-- MY HACK
	return GST_FLOW_OK; // <---MY HACK
        break;
Comment 18 Robert Krakora 2013-01-28 15:44:21 UTC
Maybe the first frame is always incomplete but subsequent frames are O.K.?
Comment 19 Olivier Crête 2013-05-27 16:25:19 UTC
At least for the logitech C920, you want to discard the empty JPEG frames, there is uvch264mjpgdemux for that.
Comment 20 Robert Krakora 2013-05-27 16:38:44 UTC
Understood.  However, most other webcams don't adhere to the UVC JPEG container multiplexing scheme proposed in the spec authored by Logitech and cannot make use of uvch264_src (0.10) or uvch264src (1.xx).  That would mean other JPEG related plugins would have to be modified/fixed.  Creative and FaceVsion cameras for example.  There is also a Skype spec which I believe some of the cameras firmware is coded to...
Comment 21 Olivier Crête 2013-05-27 18:24:43 UTC
I'm not sure how different the others are, if they're not too different, I guess we could extend uvch264src. Otherwise, another custom source is needed, and at least a custom mjpeg demultiplexer if they multiplex other things in their jpeg files.
Comment 22 Robert Krakora 2013-05-28 15:14:45 UTC
Created attachment 245455 [details]
Skype Specification

Skype specification on MJPEG multiplexing...
Comment 23 Robert Krakora 2013-05-28 15:15:48 UTC
Created attachment 245456 [details]
Skype Library

Skype Library...
Comment 24 Robert Krakora 2013-05-28 15:18:49 UTC
I just uploaded the Skype Webcam specification on MJPEG multiplexing and such as well as their supporting library.  If anything, uvch264_src (0.10) and uvch264src (1.xx) are unique to (currently) only the C920 webcam (Logitech).  It should probably be left alone.  Another source plugin could be developed to support webcams that adhere to the attached Skype specification using the attached library.
Comment 25 Olivier Crête 2013-05-28 15:31:16 UTC
That specification seems pretty close to the UVC H.264 spec actually. And the attached library seems to be not so useful, as we already have v4l2src and a way to inject extra XU into there.
Comment 26 Robert Krakora 2013-05-28 15:39:50 UTC
Yes, it is close to the UVC H.264 spec.  The driver included for v4l2 with the library seems useful.  I am worried that subtle differences between the UVC H264 and Skype specifications may make an all-in-one uvch264/Skype plugin overly complicated.  I really have not compared the two specs in detail but it seems that at some point Skype and Logitech diverged.  Although, I don't know for sure.
Comment 27 Robert Krakora 2013-05-28 15:52:30 UTC
Also Olivier, I submitted a bug report recently against 1.xx v4l2src as it seems to break 1.xx uvch264src after 30 seconds of playback.  I compared the 1.xx uvch264src with 0.10 uvch264_src source and per the porting guidelines and it appears that all of the functionality has been ported without degradation.  So, I suspect 1.xx v4l2src...sorry for getting off-topic.  I just wanted you to know that if you are thinking of utilizing 1.xx uvch264src to investigate the current topic of this bug report.
Comment 28 Wim Taymans 2013-06-26 18:51:24 UTC
I think this will do as well, keep the warnings but don't error out.

commit 4258ddcc36a182c230a6a145b4e410cb6cc7b9f6
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Wed Jun 26 20:49:41 2013 +0200

    jpegpay: turn some errors into warnings
    
    Turn some errors into warnings, we can continue processing so this should
    not be fatal.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=657079
Comment 29 Robert Krakora 2013-06-26 19:58:47 UTC
Sounds good.