How to retrieve streams from Android camera?

I want to create rtsp server in Android device.

Now I can retrieve streams from MP4 that stored in device: /storage/emulated/0/Download/01.mp4.
And I can perform streaming on another Android device with VLC.

Can someone recommend how to retrieve streams from Android camera instead of mp4 ?
Which src element could be used or how to build pipeline?

kind regards

I guess you want to stream video from one android device to another one.
two things you need to do:

  1. make a RTSP server
  2. create a RTSP pipeline to record, encode and send out video.

I guess VLC receives RTSP streaming(decoding) only.

Thank you for your answer.

Do you know which source element needs to be used to build the pipeline?
Is it v4l2src?
When I used v4l2src to build a pipeline, I received this error:
gst_parse_element_make no element “v4l2src”

Do you know how to add v4l2src on Android?


The android camera source is called ahcsrc.

You likely will not have direct access to any v4l2 API on android unless you are running a rooted device.

Thank you.

Can you give me an example of pipeline using ahcsrc?
I cannot obtain related information using gst-inspect-1.0 on Windows.


You use it like any other source element: ahcsrc ! ...

ahcsrc is an android-specific element and will not be available outside of Android. You will not find the element available on Windows, macOS, iOS, or Linux.

Thank you.

Do you know how to obtain detailed information about ahcsrc?
For example, Caps and Properties.