MJPEG capture and playback issues


I am trying to capture a stream from my webcam, display it on screen and save it in the file system.
The pipeline i use is the following:
gst-launch-0.10 --eos-on-shutdown v4l2src num-buffers=90000 ! ‘video/x-raw-yuv, width=800,height=600, format=(fourcc)I420, framerate=25/1’ ! ffmpegcolorspace ! tee name=“splitter” ! queue ! xvimagesink sync=false splitter. ! queue ! nvjpegenc ! avimux ! filesink location=/home/ubuntu/work/webcam_800x600_mjpeg.avi

The video can be played back using vlc but not gstreamer. I am using the following pipeline for playback:

gst-launch-0.10 filesrc location=/home/ubuntu/work/webcam_800x600_mjpeg.avi ! nvjpegdec ! ffmpegcolorspace ! xvimagesink

It appears that only the first frame is displayed and then playback stops. Any ideas what may be wrong? Thanks in advance.

Hi piperak,

I had much the same issue with nvjpegdec. I reported the issue to NVIDIA and received a nice message saying that this issue has been fixed in their development versions. The fix will be available in the next L4T release. I don’t have an ETA for the release, hopefully it will be soon.

Hope this helps.

ffmpegcolorspace uses CPU only to do colour space conversion. If nvvidconv works, that would be more optimized solution.

Also VLC is CPU only. To use CPU only solution with gstreamer you should be able to switch nvjpegdec with ffdec_mjpeg. Maybe that could be a suboptimal workaround while waiting for the next L4T release?


thanks for the information, there seem to be several other issues with playback too. For example, if you try to playback a 640x480 raw image captured from a usb camera using nv_omx_hdmi_video_sink (no scaling), the screen goes nuts. MJPEG decoding from a web camera also suffers. In my installation nv_omx_videosink does not even exist. Anyway, I hope the new release fixes some of the playback issues.

Hi piperak,
I’ve found the Gstreamer support to be rather hit and miss. I’ve been having trouble with recording audio and sound together using the H.264 encoder, saving it in a file, and playing it back in sync. It works correctly for the first 10 seconds, and then the video playback speeds up 2x, while audio remains correct. It’s pretty much hit and miss. I’m waiting for the next release before getting too excited.

I did an article: http://jetsonhacks.com/2014/10/16/gstreamer-xvimage/ showing MJPEG decoding of a couple of webcams using gst-launch-1.0. It worked well, there’s also a link to a YouTube video showing the performance.
It’s stuff you probably already know, but it might help others if they stumble on this thread later.