[Android] The toss of the webcam capture function

The company has a new Android project that requires the capture function of the webcam. It seems simple, but it is a little troublesome.

Some problems encountered and solutions:

         1 How to get the RTSP stream address

         2 After obtaining the stream address, the player needs to enter the password, how to enter it automatically

         3 How to capture a video while playing a video       

Solutions:

    1 When looking for information, I found the standard protocol ONVIF of the network camera, and the RTSP stream address can be obtained through the ONVIF protocol.

       The tool used is ONVIF Device Test Tool. Later, it was found that as long as the IP and port number are known, the stream address can be determined.

       For example, rtsp://@172.16.1.236:554, I originally wanted to add the ONVIF protocol, but found that the customer's needs were relatively simple, so I didn't add it.

    2 The account number and password can be included in the stream address, which is the standard of the RTSP protocol. For example, the account password is admin and its address

        For: rtsp://admin:[email protected]:554

    3 Capture while playing the video, this takes the most time, and there are many pitfalls. The main solution ideas:

      1) Find out whether MediaPlayer has this interface ------------- Most platforms currently do not have it

      2) Use SurfaceView to display the video and save the current frame --------------- I found some information on the Internet that seems to be possible but it is not possible. It may be possible, but I have not studied it in depth.

     3) Use the ONVIF protocol to obtain the capture address. Some network cameras have this function, but only some. ------------Because the camera does not support it, this way is blocked

     4) Use the soft decoding library with camera function to decode the video and then capture the photo. ------------------ success

            I found an example on the Internet, using VLC to decode, with a capture function, I found it at the beginning,

             I just feel that there are other methods and I don’t pay attention to it. I will still use this after going around.

           Resource download address: http://download.csdn.net/detail/burly/8897805. Some modifications have been made on the basis of the original:

          1) Modify the APK name 2) Modify the BUG and exit and re-enter and cannot display the video problem 3) Add the function of pressing 2 times to return and exit 

           4) Recording cannot be used, the recording button is hidden 5) When starting up, it displays "Connecting to the camera..."


Summarize:

      It took about a day for this small function. I got to know ONVIF, a standard protocol of network cameras. It will be troublesome if the capture function does not provide relevant interfaces (Daniel can ignore it...)

Guess you like

Origin blog.csdn.net/burly/article/details/46876101