Capture video from android camera with gstreamer

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Capture video from android camera with gstreamer

alex_malishev
Hi! I'm working on the project which will be able to capture video from smartphone's camera and send it to server. But now I'm trying to save it in file and my question is:
Does anybody know how to capture video from android camera and save it to file using gstreamer1.0? I have already tried  camerabin plugin. I built this pipeline:

 gst-launch-1.0 camerabin mode=1 filename="/storage/sdcard0/Movies/camera.ogg"

but it doesn't work. I uderstand that I must set viewfinder-sink and camera-src properties, but when I try to make pipeline by using gstreamer functions like this

 data->pipeline = gst_element_factory_make("camerabin", "camerabin");
 g_object_set(data->pipeline, "mode", MODE_VIDEO, NULL);
 sink = gst_element_factory_make ("filesink", NULL);
 g_object_set(sink, "location","/storage/sdcard0/Movies/test.ogg");
 g_object_set(data->pipeline, "viewfinder-sink", sink, NULL);
 g_object_set(data->pipeline, "filename","/storage/sdcard0/Movies/camera-record.ogg", NULL);
 gst_element_set_state(data->pipeline, GST_STATE_READY);

the app crashes and gives me error:

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x83127d5b in tid 27873 (als.tutorial_51) I add filesink element because when I build pipeline like this:

data->pipeline = gst_parse_launch("camerabin mode=1 filename="/storage/sdcard0/Movies/camera.ogg")

file camera.ogg doesn't create in filesystem.

And I can't set camera-src property, because i don't know what value i should use. In examples peoples use v4l2, but not all devices support this plugin. Also they used ahcsrc, but it gives me error: no elements ahcsrc. I tried to find this element and found out there is no such element in gstreamer1.0, only in gstreamer-0.10 in androidcamera plugin.

Please, help me!
Reply | Threaded
Open this post in threaded view
|

Re: Capture video from android camera with gstreamer

Sebastian Dröge-3
On Mi, 2016-07-06 at 07:18 -0700, alex_malishev wrote:


> A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x83127d5b in tid
> 27873 (als.tutorial_51)

Please get a backtrace of the crash with gdb.

> I add filesink element because when I build pipeline
> And I can't set camera-src property, because i don't know what value i
> should use. In examples peoples use v4l2, but not all devices support this
> plugin. Also they used ahcsrc, but it gives me error: no elements ahcsrc. I
> tried to find this element and found out there is no such element in
> gstreamer1.0, only in gstreamer-0.10 in androidcamera plugin.

Which version of GStreamer are you using? With 1.8 and newer there is
an ahcsrc element contained in the androidmedia plugin.

Please get a debug log if you have this version, link in the plugin but
still can't use it.

--

Sebastian Dröge, Centricular Ltd · http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Capture video from android camera with gstreamer

alex_malishev
I think, the problem was in my C code, when i tried to build camerabin pipeline.

Now, I'm trying the new version of gstreamer.(ver. 1.8.2), as you sad,  and I got this error when build the project:

C:/gsdk/share/gst-android/ndk-build/tools/windows/sed "s/@PLUGINS_DECLARATION@/ GST_PLUGIN_STATIC_DECLARE(coreelements);\n  GST_PLUGIN_STATIC_DECLARE(adder);\n  GST_PLUGIN_STATIC_DECLARE(app);\n  GST_PLUGIN_STATIC_DECLARE(audioconvert);\n  GST_PLUGIN_STATIC_DECLARE(audiorate);\n  GST_PLUGIN_STATIC_DECLARE(audioresample);\n  GST_PLUGIN_STATIC_DECLARE(audiotestsrc);\n  GST_PLUGIN_STATIC_DECLARE(gio);\n  GST_PLUGIN_STATIC_DECLARE(pango);\n  GST_PLUGIN_STATIC_DECLARE(typefindfunctions);\n  GST_PLUGIN_STATIC_DECLARE(videoconvert);\n  GST_PLUGIN_STATIC_DECLARE(videorate);\n  GST_PLUGIN_STATIC_DECLARE(videoscale);\n  GST_PLUGIN_STATIC_DECLARE(videotestsrc);\n  GST_PLUGIN_STATIC_DECLARE(volume);\n  GST_PLUGIN_STATIC_DECLARE(autodetect);\n  GST_PLUGIN_STATIC_DECLARE(videofilter);\n  GST_PLUGIN_STATIC_DECLARE(playback);\n  GST_PLUGIN_STATIC_DECLARE(subparse);\n  GST_PLUGIN_STATIC_DECLARE(ogg);\n  GST_PLUGIN_STATIC_DECLARE(theora);\n  GST_PLUGIN_STATIC_DECLARE(vorbis);\n  GST_PLUGIN_STATIC_DECLARE(opus);\n  GST_PLUGIN_STATIC_DECLARE(ivorbisdec);\n  GST_PLUGIN_STATIC_DECLARE(alaw);\n  GST_PLUGIN_STATIC_DECLARE(apetag);\n  GST_PLUGIN_STATIC_DECLARE(audioparsers);\n  GST_PLUGIN_STATIC_DECLARE(auparse);\n  GST_PLUGIN_STATIC_DECLARE(avi);\n  GST_PLUGIN_STATIC_DECLARE(dv);\n  GST_PLUGIN_STATIC_DECLARE(flac);\n  GST_PLUGIN_STATIC_DECLARE(flv);\n  GST_PLUGIN_STATIC_DECLARE(flxdec);\n  GST_PLUGIN_STATIC_DECLARE(icydemux);\n  GST_PLUGIN_STATIC_DECLARE(id3demux);\n  GST_PLUGIN_STATIC_DECLARE(isomp4);\n  GST_PLUGIN_STATIC_DECLARE(jpeg);\n  GST_PLUGIN_STATIC_DECLARE(matroska);\n  GST_PLUGIN_STATIC_DECLARE(mulaw);\n  GST_PLUGIN_STATIC_DECLARE(multipart);\n  GST_PLUGIN_STATIC_DECLARE(png);\n  GST_PLUGIN_STATIC_DECLARE(speex);\n  GST_PLUGIN_STATIC_DECLARE(taglib);\n  GST_PLUGIN_STATIC_DECLARE(vpx);\n  GST_PLUGIN_STATIC_DECLARE(wavenc);\n  GST_PLUGIN_STATIC_DECLARE(wavpack);\n  GST_PLUGIN_STATIC_DECLARE(wavparse);\n  GST_PLUGIN_STATIC_DECLARE(y4menc);\n  GST_PLUGIN_STATIC_DECLARE(adpcmdec);\n  GST_PLUGIN_STATIC_DECLARE(adpcmenc);\n  GST_PLUGIN_STATIC_DECLARE(dashdemux);\n  GST_PLUGIN_STATIC_DECLARE(dvbsuboverlay);\n  GST_PLUGIN_STATIC_DECLARE(dvdspu);\n  GST_PLUGIN_STATIC_DECLARE(hls);\n  GST_PLUGIN_STATIC_DECLARE(id3tag);\n  GST_PLUGIN_STATIC_DECLARE(kate);\n  GST_PLUGIN_STATIC_DECLARE(midi);\n  GST_PLUGIN_STATIC_DECLARE(mxf);\n  GST_PLUGIN_STATIC_DECLARE(openh264);\n  GST_PLUGIN_STATIC_DECLARE(opusparse);\n  GST_PLUGIN_STATIC_DECLARE(pcapparse);\n  GST_PLUGIN_STATIC_DECLARE(pnm);\n  GST_PLUGIN_STATIC_DECLARE(rfbsrc);\n  GST_PLUGIN_STATIC_DECLARE(schro);\n  GST_PLUGIN_STATIC_DECLARE(gstsiren);\n  GST_PLUGIN_STATIC_DECLARE(smoothstreaming);\n  GST_PLUGIN_STATIC_DECLARE(subenc);\n  GST_PLUGIN_STATIC_DECLARE(videoparsersbad);\n  GST_PLUGIN_STATIC_DECLARE(y4mdec);\n  GST_PLUGIN_STATIC_DECLARE(jpegformat);\n  GST_PLUGIN_STATIC_DECLARE(gdp);\n  GST_PLUGIN_STATIC_DECLARE(rsvg);\n  GST_PLUGIN_STATIC_DECLARE(openjpeg);\n  GST_PLUGIN_STATIC_DECLARE(spandsp);\n  GST_PLUGIN_STATIC_DECLARE(androidmedia);\n  GST_PLUGIN_STATIC_DECLARE(tcp);\n  GST_PLUGIN_STATIC_DECLARE(rtsp);\n  GST_PLUGIN_STATIC_DECLARE(rtp);\n  GST_PLUGIN_STATIC_DECLARE(rtpmanager);\n  GST_PLUGIN_STATIC_DECLARE(soup);\n  GST_PLUGIN_STATIC_DECLARE(udp);\n  GST_PLUGIN_STATIC_DECLARE(dataurisrc);\n  GST_PLUGIN_STATIC_DECLARE(sdp);\n  GST_PLUGIN_STATIC_DECLARE(srtp);\n  GST_PLUGIN_STATIC_DECLARE(rtspclientsink);\n  GST_PLUGIN_STATIC_DECLARE(opensles);\n  GST_PLUGIN_STATIC_DECLARE(opengl);\n  GST_PLUGIN_STATIC_DECLARE(asfmux);\n  GST_PLUGIN_STATIC_DECLARE(dtsdec);\n  GST_PLUGIN_STATIC_DECLARE(faad);\n  GST_PLUGIN_STATIC_DECLARE(mpegpsdemux);\n  GST_PLUGIN_STATIC_DECLARE(mpegpsmux);\n  GST_PLUGIN_STATIC_DECLARE(mpegtsdemux);\n  GST_PLUGIN_STATIC_DECLARE(mpegtsmux);\n  GST_PLUGIN_STATIC_DECLARE(voaacenc);\n  GST_PLUGIN_STATIC_DECLARE(a52dec);\n  GST_PLUGIN_STATIC_DECLARE(amrnb);\n  GST_PLUGIN_STATIC_DECLARE(amrwbdec);\n  GST_PLUGIN_STATIC_DECLARE(asf);\n  GST_PLUGIN_STATIC_DECLARE(dvdsub);\n  GST_PLUGIN_STATIC_DECLARE(dvdlpcmdec);\n  GST_PLUGIN_STATIC_DECLARE(mad);\n  GST_PLUGIN_STATIC_DECLARE(mpeg2dec);\n  GST_PLUGIN_STATIC_DECLARE(xingmux);\n  GST_PLUGIN_STATIC_DECLARE(realmedia);\n  GST_PLUGIN_STATIC_DECLARE(x264);\n  GST_PLUGIN_STATIC_DECLARE(lame);\n  GST_PLUGIN_STATIC_DECLARE(mpg123);\n  GST_PLUGIN_STATIC_DECLARE(libav);\n  GST_PLUGIN_STATIC_DECLARE(mms);\n  GST_PLUGIN_STATIC_DECLARE(rtmp);\n  GST_PLUGIN_STATIC_DECLARE(camerabin);\n  GST_PLUGIN_STATIC_DECLARE(alpha);\n  GST_PLUGIN_STATIC_DECLARE(alphacolor);\n  GST_PLUGIN_STATIC_DECLARE(audiofx);\n  GST_PLUGIN_STATIC_DECLARE(cairo);\n  GST_PLUGIN_STATIC_DECLARE(cutter);\n  GST_PLUGIN_STATIC_DECLARE(debug);\n  GST_PLUGIN_STATIC_DECLARE(deinterlace);\n  GST_PLUGIN_STATIC_DECLARE(dtmf);\n  GST_PLUGIN_STATIC_DECLARE(effectv);\n  GST_PLUGIN_STATIC_DECLARE(equalizer);\n  GST_PLUGIN_STATIC_DECLARE(gdkpixbuf);\n  GST_PLUGIN_STATIC_DECLARE(imagefreeze);\n  GST_PLUGIN_STATIC_DECLARE(interleave);\n  GST_PLUGIN_STATIC_DECLARE(level);\n  GST_PLUGIN_STATIC_DECLARE(multifile);\n  GST_PLUGIN_STATIC_DECLARE(replaygain);\n  GST_PLUGIN_STATIC_DECLARE(shapewipe);\n  GST_PLUGIN_STATIC_DECLARE(smpte);\n  GST_PLUGIN_STATIC_DECLARE(spectrum);\n  GST_PLUGIN_STATIC_DECLARE(videobox);\n  GST_PLUGIN_STATIC_DECLARE(videocrop);\n  GST_PLUGIN_STATIC_DECLARE(videomixer);\n  GST_PLUGIN_STATIC_DECLARE(accurip);\n  GST_PLUGIN_STATIC_DECLARE(aiff);\n  GST_PLUGIN_STATIC_DECLARE(audiofxbad);\n  GST_PLUGIN_STATIC_DECLARE(autoconvert);\n  GST_PLUGIN_STATIC_DECLARE(bayer);\n  GST_PLUGIN_STATIC_DECLARE(coloreffects);\n  GST_PLUGIN_STATIC_DECLARE(debugutilsbad);\n  GST_PLUGIN_STATIC_DECLARE(fieldanalysis);\n  GST_PLUGIN_STATIC_DECLARE(freeverb);\n  GST_PLUGIN_STATIC_DECLARE(frei0r);\n  GST_PLUGIN_STATIC_DECLARE(gaudieffects);\n  GST_PLUGIN_STATIC_DECLARE(geometrictransform);\n  GST_PLUGIN_STATIC_DECLARE(inter);\n  GST_PLUGIN_STATIC_DECLARE(interlace);\n  GST_PLUGIN_STATIC_DECLARE(ivtc);\n  GST_PLUGIN_STATIC_DECLARE(rawparse);\n  GST_PLUGIN_STATIC_DECLARE(removesilence);\n  GST_PLUGIN_STATIC_DECLARE(segmentclip);\n  GST_PLUGIN_STATIC_DECLARE(smooth);\n  GST_PLUGIN_STATIC_DECLARE(speed);\n  GST_PLUGIN_STATIC_DECLARE(soundtouch);\n  GST_PLUGIN_STATIC_DECLARE(videofiltersbad);\n  GST_PLUGIN_STATIC_DECLARE(audiomixer);\n  GST_PLUGIN_STATIC_DECLARE(compositor);\n/g" | \

                C:/gsdk/share/gst-android/ndk-build/tools/windows/sed "s/@G_IO_MODULES_LOAD@/ GST_G_IO_MODULE_LOAD(gnutls);\n/g" | \
                C:/gsdk/share/gst-android/ndk-build/tools/windows/sed "s/@G_IO_MODULES_DECLARE@/ GST_G_IO_MODULE_DECLARE(gnutls);\n/g" > gst-build-armeabi/gstreamer_android.c
"cat" ­Ґ пў«пҐвбп ў­гв७­Ґ© Ё«Ё ў­Ґи­Ґ©
Є®¬ ­¤®©, ЁбЇ®«­пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐв­л¬ д ©«®¬.
make.exe: *** [genstatic_armeabi] Error 255
:app:ndkBuild FAILED
Error:Execution failed for task ':app:ndkBuild'.
> Process 'command 'C:\android-ndk/ndk-build.cmd'' finished with non-zero exit value 2

what should i do?
Reply | Threaded
Open this post in threaded view
|

Re: Capture video from android camera with gstreamer

Sebastian Dröge-3
On Do, 2016-07-07 at 02:04 -0700, alex_malishev wrote:
> I think, the problem was in my C code, when i tried to build
> camerabin pipeline.
>
> Now, I'm trying the new version of gstreamer.(ver. 1.8.2), as you
> sad,  and I got this error when build the project:
> [...]

There was a bug in 1.8.2 causing this. Try replacing the gstreamer-
1.0.mk with the latest one here:
https://cgit.freedesktop.org/gstreamer/cerbero/tree/data/ndk-build/gstreamer-1.0.mk

--

Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Capture video from android camera with gstreamer

alex_malishev
I've just tried this, and now I get this:

GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
Є®¬ ¤®©, ЁбЇ®«пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐвл¬ д ©«®¬.
"C:" Ґ пў«пҐвбп ўгв॥© Ё«Ё ўҐиҐ©
make.exe: *** [genstatic_armeabi] Error 255
Error:Execution failed for task ':app:ndkBuild'.
> Process 'command 'C:\android-ndk/ndk-build.cmd'' finished with non-zero exit value 2
:app:ndkBuild FAILED

What does it mean?
Thank you for your fast replies)

Reply | Threaded
Open this post in threaded view
|

Re: Capture video from android camera with gstreamer

Sebastian Dröge-3
On Do, 2016-07-07 at 02:20 -0700, alex_malishev wrote:

> I've just tried this, and now I get this:
>
> GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
> Є®¬ ¤®©, ЁбЇ®«пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐвл¬ д ©«®¬.
> "C:" Ґ пў«пҐвбп ўгв॥© Ё«Ё ўҐиҐ©
> make.exe: *** [genstatic_armeabi] Error 255
> Error:Execution failed for task ':app:ndkBuild'.
> > Process 'command 'C:\android-ndk/ndk-build.cmd'' finished with non-
> > zero
> > exit value 2
> :app:ndkBuild FAILED
>
> What does it mean?
I don't know, can you set up your system in English or translate the
error yourself?

--

Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re[2]: Capture video from android camera with gstreamer

alex_malishev
In reply to this post by Sebastian Dröge-3
I've just tried this, and now I get this:


GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
Є®¬ ­¤®©, ЁбЇ®«­пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐв­л¬ д ©«®¬.
"C:" ­Ґ пў«пҐвбп ў­гв७­Ґ© Ё«Ё ў­Ґи­Ґ©
make.exe: *** [genstatic_armeabi] Error 255
Error:Execution failed for task ':app:ndkBuild'.
> Process 'command 'C:\android-ndk/ndk-build.cmd'' finished with non-zero exit value 2
:app:ndkBuild FAILED

What does it mean?
Thank you for your fast replies)




Четверг, 7 июля 2016, 12:48 +03:00 от Sebastian Dröge <[hidden email]>:

On Do, 2016-07-07 at 02:04 -0700, alex_malishev wrote:
> I think, the problem was in my C code, when i tried to build
> camerabin pipeline.
>
> Now, I'm trying the new version of gstreamer.(ver. 1.8.2), as you
> sad,  and I got this error when build the project:
> [...]

There was a bug in 1.8.2 causing this. Try replacing the gstreamer-
1.0.mk with the latest one here:
https://cgit.freedesktop.org/gstreamer/cerbero/tree/data/ndk-build/gstreamer-1.0.mk

--

Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re[2]: Capture video from android camera with gstreamer

alex_malishev
In reply to this post by Sebastian Dröge-3
Sebastian, Hi again ) I fixed this error by changing gstreamer sdk version and now it's 1.8.0.  I try to run this pipeline :
 gst_parse_launch("ahcsrc ! glimagesink name=vsink sync=false", error); 
but i always get the same error: no element ahcsrc. I'm sure there is plugin androidmedia in sdk directory and I add this plugin in Android.mk
Also when I run playbin pipeline using gstreamer tutorial 5 video from net plays with lags. I should say the internet connection is very fast. 

Thanks.
 


Четверг, 7 июля 2016, 13:27 +03:00 от Sebastian Dröge <[hidden email]>:

On Do, 2016-07-07 at 02:20 -0700, alex_malishev wrote:
> I've just tried this, and now I get this:
>
> GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
> Є®¬ ¤®©, ЁбЇ®«пҐ¬®© Їа®Ја ¬¬®© Ё«Ё Ї ЄҐвл¬ д ©«®¬.
> "C:" Ґ пў«пҐвбп ўгв॥© Ё«Ё ўҐиҐ©
> make.exe: *** [genstatic_armeabi] Error 255
> Error:Execution failed for task ':app:ndkBuild'.
> > Process 'command 'C:\android-ndk/ndk-build.cmd'' finished with non-
> > zero
> > exit value 2
> :app:ndkBuild FAILED
>
> What does it mean?

I don't know, can you set up your system in English or translate the
error yourself?

--

Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: Capture video from android camera with gstreamer

Sebastian Dröge-3
On Do, 2016-07-07 at 19:40 +0300, Саша Куликов wrote:
> Sebastian, Hi again ) I fixed this error by changing gstreamer sdk version and now it's 1.8.0.  I try to run this pipeline : 
>  gst_parse_launch("ahcsrc ! glimagesink name=vsink sync=false", error); 
> but i always get the same error: no element ahcsrc. I'm sure there is plugin androidmedia in sdk directory and I add this plugin in Android.mk
> Also when I run playbin pipeline using gstreamer tutorial 5 video from net plays with lags. I should say the internet connection is very fast. 

Please show your Android.mk and also provide a debug log with level 6.
Easiest way to do that is to edit gstreamer_android-1.0.c.in before the
build and change the gst_debug_set_default_threshold() in there to get
GST_LEVEL_LOG as parameter.

--

Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment