We have moved to a new Sailfish OS Forum. Please start new discussions there.
3

Internal error in gstreamer element droidcamsrc

asked 2020-03-25 19:42:09 +0300

murphee gravatar image

updated 2020-03-25 19:42:39 +0300

I'm trying to get a video stream from the camera of my Xperia 10 using gstreamer. Reading the video/x-raw source of the droidcamsrc element works fine:

gst-launch-1.0 -v droidcamsrc mode=2 ! video/x-raw ! fakesink

However, reading the video/x-h264 or video/mpeg sources using

gst-launch-1.0 -v droidcamsrc mode=2 ! video/mpeg ! fakesink

throws an error

ERROR: from element /GstPipeline:pipeline0/GstDroidCamSrc:droidcamsrc0: Internal data stream error. Additional debug info: gstdroidcamsrc.c(1231): gst_droidcamsrc_loop (): /GstPipeline:pipeline0/GstDroidCamSrc:droidcamsrc0: stream stopped, reason not-linked

This is my first time using gstreamer. What am I doing wrong?

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-04-17 21:06:47 +0300

takimata gravatar image

updated 2020-05-10 20:01:01 +0300

I just found this question because I also wanted to use the phone's camera image on another computer.

For me, even your first example fails twice for me:

> gst-launch-1.0 -v droidcamsrc mode=2 ! video/x-raw ! fakesink
[...]
** (gst-launch-1.0:20467): CRITICAL **: 19:52:03.716: gst_pad_set_caps: assertion 'caps != NULL && gst_caps_is_fixed (caps)' failed
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstDroidCamSrc:droidcamsrc0: The stream is in the wrong format.
Additional debug info:
gstdroidcamsrcmode.c(202): gst_droidcamsrc_mode_negotiate_pad (): /GstPipeline:pipeline0/GstDroidCamSrc:droidcamsrc0:
failed to negotiate vidsrc.
[...]
Freeing pipeline ...
double free or corruption (out)
Aborted

(I played around with different commands and gstreamer seems to have memory management issues - it also has some memory leaks which quickly use up all memory when using "incorrect" pipelines)

I tried (but failed) to replicate the pipeline from there: https://github.com/sailfishos/gst-droidcamsrc/blob/master/test/video.c as command line:

> gst-launch-1.0 droidcamsrc mode=2 ! filesink location=foo.yuv
[...]
** (gst-launch-1.0:20913): CRITICAL **: 19:56:59.176: gst_pad_set_caps: assertion 'caps != NULL && gst_caps_is_fixed (caps)' failed
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstDroidCamSrc:droidcamsrc0: The stream is in the wrong format.
Additional debug info:
gstdroidcamsrcmode.c(202): gst_droidcamsrc_mode_negotiate_pad (): /GstPipeline:pipeline0/GstDroidCamSrc:droidcamsrc0:
failed to negotiate vidsrc.

Even when directly attacking the Pads as described in https://gstreamer.freedesktop.org/documentation/tools/gst-launch.html :

> gst-launch-1.0 droidcamsrc.vidsrc mode=2 ! filesink.sink location=foo.yuv
ERROR: pipeline could not be constructed: unexpected reference "droidcamsrc" - ignoring.

Interestingly, the following at least runs (but shows an garbled image):

ssh MYPHONEHOSTNAME gst-launch-1.0 droidcamsrc ! videoconvert ! rtpvrawpay ! filesink location=/dev/stdout | gst-launch-1.0 filesrc location=/dev/stdin ! videoparse ! autovideoconvert ! autovideosink

edit: I guess this is related to the fact that droidcamsrc has start-capture/stop-capture actions, which need to be triggered in video mode (mode=2) to actually record a video. For taking photos (i.e., no mode specified) no such action needs to be called. Unfortunately, afaik, we can't do such dynamic stuff via the command line. -> Use C or Python.

edit2:Confirm previous edit; also see example at https://github.com/sailfishos/gst-droidcamsrc/blob/master/test/video.c#L35

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
5 followers

Stats

Asked: 2020-03-25 19:42:09 +0300

Seen: 668 times

Last updated: May 10 '20