<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">Le 10 mars 2017 1:52 AM, "Rafael Sierra" <<a href="mailto:tt.babyvitals.01@gmail.com">tt.babyvitals.01@gmail.com</a>> a écrit :<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
I'm recording MJPEG video from a Logitech C920 USB camera, with this pipeline:<br>
<br>
gst-launch-1.0 -e v4l2src device=/dev/video0 \<br>
   ! image/jpeg,width=1280,height=7<wbr>20,framerate=24/1 \<br>
   ! jpegparse ! avimux ! filesink location=mjpeg-01.avi<br>
<br>
I use the -e flag so, according to the documentation, an EOS signal is sent and the video file is properly created/closed.<br>
The problem is that after I use the -e flag in a pipeline, almost any subsequent pipeline that access the camera will fail and cause a camera disconnection, where it needs to be replugged to be usable again. If I remove the -e flag, there are no problems, but the video file is saved without an index and is not readily usable.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I'll have to test that. I have never seen such issue. As the GStreamer process quits, something must be going wrong in your kernel.</div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Questions:<br>
- Is the pipeline a proper one?<br>
- Is this normal behavior? Or is it a known bug?<br>
- What can I do to avoid the issue with the -e flag? Note that I need it  to record usable video files.<br>
- Would it be worth it to avoid gst-launch and write my pipeline in C/C++, or would I eventually hit the same issue?<br>
<br>
I've tried some debugging and came out with the steps below to reproduce the issue.<br>
System Configuration: (Ubuntu 16.04.1)<br>
<br>
$ uname -a<br>
Linux NUC02 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux<br>
<br>
$ gst-launch-1.0 --version<br>
gst-launch-1.0 version 1.8.3<br>
GStreamer 1.8.3<br>
<br>
Camera is /dev/video0. Using the lsusb command between launches ensures the next pipeline launch will fail, it is not necessary, it just makes it fail faster.<br>
------------------------------<wbr>-<br>
# Check camera is present:<br>
ll /dev/vid*<br>
crw-rw----+ 1 root video 81, 0  Mar 10 15:20 /dev/video0<br>
<br>
# launch simple pipeline; interrupt it after a few seconds:<br>
$ gst-launch-1.0 -ev v4l2src device=/dev/video0 ! autovideosink<br>
Setting pipeline to PAUSED ...<br>
Pipeline is live and does not need PREROLL ...<br>
Setting pipeline to PLAYING ...<br>
New clock: GstSystemClock<br>
/GstPipeline:pipeline0/GstV4l2<wbr>Src:v4l2src0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)2304\,\ height\=\(int\)1536\,\ pixel-aspect-ratio\=\(fraction<wbr>\)1/1\,\ interlace-mode\=\(string\)prog<wbr>ressive\,\ colorimetry\=\(string\)2:4:7:1<wbr>\,\ framerate\=\(fraction\)2/1"<br>
/GstPipeline:pipeline0/GstAuto<wbr>VideoSink:autovideosink0.<wbr>GstGhostPad:sink.GstProxyPad:<wbr>proxypad0: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)2304\,\ height\=\(int\)1536\,\ pixel-aspect-ratio\=\(fraction<wbr>\)1/1\,\ interlace-mode\=\(string\)prog<wbr>ressive\,\ colorimetry\=\(string\)2:4:7:1<wbr>\,\ framerate\=\(fraction\)2/1"<br>
/GstPipeline:pipeline0/GstAuto<wbr>VideoSink:autovideosink0/<wbr>GstXvImageSink:autovideosink0-<wbr>actual-sink-xvimage.GstPad:<wbr>sink: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)2304\,\ height\=\(int\)1536\,\ pixel-aspect-ratio\=\(fraction<wbr>\)1/1\,\ interlace-mode\=\(string\)prog<wbr>ressive\,\ colorimetry\=\(string\)2:4:7:1<wbr>\,\ framerate\=\(fraction\)2/1"<br>
/GstPipeline:pipeline0/GstAuto<wbr>VideoSink:autovideosink0.<wbr>GstGhostPad:sink: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)2304\,\ height\=\(int\)1536\,\ pixel-aspect-ratio\=\(fraction<wbr>\)1/1\,\ interlace-mode\=\(string\)prog<wbr>ressive\,\ colorimetry\=\(string\)2:4:7:1<wbr>\,\ framerate\=\(fraction\)2/1"<br>
^Chandling interrupt.<br>
Interrupt: Stopping pipeline ...<br>
EOS on shutdown enabled -- Forcing EOS on the pipeline<br>
Waiting for EOS...<br>
Got EOS from element "pipeline0".<br>
EOS received - stopping pipeline...<br>
Execution ended after 0:00:05.728170506<br>
Setting pipeline to PAUSED ...<br>
Setting pipeline to READY ...<br>
Setting pipeline to NULL ...<br>
Freeing pipeline ...<br>
<br>
# check the device is still there (not mandatory): OK:<br>
$ lsusb<br>
Bus 002 Device 003: ID 046d:082d Logitech, Inc. HD Pro Webcam C920<br>
...<br>
<br>
#launch same pipeline a second time; now it fails after hanging for a while:<br>
$ gst-launch-1.0 -v v4l2src device=/dev/video0 ! autovideosink<br>
Setting pipeline to PAUSED ...<br>
ERROR: Pipeline doesn't want to pause.<br>
ERROR: from element /GstPipeline:pipeline0/GstV4l2<wbr>Src:v4l2src0: Could not open device '/dev/video0' for reading and writing.<br>
Additional debug info:<br>
v4l2_calls.c(620): gst_v4l2_open (): /GstPipeline:pipeline0/GstV4l2<wbr>Src:v4l2src0:<br>
system error: Device or resource busy<br>
Setting pipeline to NULL ...<br>
Freeing pipeline ...<br>
<br>
# ls: the camera is gone; lsusb command will hang. Need to replug<br>
$ ll /dev/vid*<br>
ls: cannot access '/dev/vid*': No such file or directory<br>
------------------------------<wbr>-------------<br>
Notes:<br>
- I use the -e flag because I need to record proper video files. The above test uses a simplified pipeline just to show the issue with the flag<br>
- I have similar trouble with two other cameras. These don't disconnect but the image gets distorted.<br>
  1. VF0560 Live! Cam Optia AF (Creative)<br>
  2. QuickCam Pro for Notebooks (Logitech)<br>
<br>
<br>
Thank you,<br>
Rafael<br>
<br>
______________________________<wbr>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesk<wbr>top.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/gstreamer-dev<wbr>el</a><br>
</blockquote></div><br></div></div></div>