Video recording to a circular buffer on Android

后端 未结 1 1348
天涯浪人
天涯浪人 2021-02-06 00:03

I\'m looking for the best way (if any...) to capture continuous video to a circular buffer on the SD card, allowing the user to capture events after they have happened.

1条回答
  •  难免孤独
    2021-02-06 01:02

    In Android's MediaRecorder there is two way to specify the output. One is a filename and another is a FileDescriptor.

    Using static method fromSocket of ParcelFileDescriptor you can create an instance of ParcelFileDescriptor pointing to a socket. Then, call getFileDescriptor to get the FileDescriptor to be passed to the MediaRecorder.

    Since you can get the encoded video from the socket (as if you were creating a local web server), you will be able to access individual frames of the video, although not so directly, because you will need to decode it first.

    0 讨论(0)
提交回复
热议问题