I translate the article android设备外接多个usb摄像头(Chinese version) into English because a few days ago I found lots of people access this article. I think more people will like it.
The car repairer uses a mini USB camera as an endoscope to repair the car. The endoscope used by the doctor to view the internal organs of the patient. The key is off the Toilet, looking for a waterproof USB camera with a hook (joking), and so on.
Some time ago, I specially studied android devices to connect multiple USB cameras because I was obsessed with doing another thing, at my spare time from searching relative materials, supporting conditions to purchase hardware (camera, smart machine), and finally implementing external connection USB cameras based on an open-source code on GitHub.
This article implemented using Xiaomi tablet to connect multiple usb cameras. Xiaomi tablet is a android device like ipad. A application show all usb camera's record at the same time.
Total money: ¥1353.9
You need release resource that you applied when you deubug.
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="50dp" android:id="@+id/release" android:text="release all cameras"/> </LinearLayout>
protected void onCreate(final Bundle savedInstanceState) { // ...... releaseBtn = (Button)findViewById(R.id.release); releaseBtn.setOnClickListener(mReleaseOnClickListener); // ...... } private final OnClickListener mReleaseOnClickListener = new OnClickListener() { @Override public void onClick(final View view) { if (DEBUG) {Log.v(TAG, "camera numbers-->" + mCameras.size());} for (final CameraRec rec: mCameras.values()) { if (DEBUG) {Log.v(TAG, "release camera-->" + rec.mCamera.toString()+);} rec.release(); } } };
adb shell cd sys/bus/usb/drivers ls
If the result show uvcvideo
, it means this support UVC protocol.
[11019*stream.c:1589: uvc_stream_start_bandwidth]:fail
The maximum that Xiaomi pad can support 2 USB cameras because of bandwidth. If you are interested you could think about through the computer.
If you are interested in this article, please email me. frankshaohua@gmail.com