Giter Site home page Giter Site logo

Pause recording about uvccamera HOT 6 CLOSED

saki4510t avatar saki4510t commented on August 14, 2024
Pause recording

from uvccamera.

Comments (6)

saki4510t avatar saki4510t commented on August 14, 2024

Hi,

Technically it is possible. but actual implementation depends on what result you want and how long do you want to pause etc.
One example is available on my repository, TimeLapseRecordingSample. The video source of "TimeLapseRecordingSample" is internal camera but you can use by similar way.
If you want very long time pause(once per hours or longer), I assume saving a still image periodically (as jpeg or png) and making a movie after getting all images.
saki

from uvccamera.

pricsko avatar pricsko commented on August 14, 2024

HI,

Thank you very much, i'll check the TimeLapseRecording. Technically, i dont want to pause the record, i just want to start 2 recording at the same time, and decide on some conditions to which recording i want to append the current frame.

from uvccamera.

pricsko avatar pricsko commented on August 14, 2024

Hi,

i checked the TimeLapseRecording, and i am wondering, is it possible to record the camera frame (onPreviewFrame - with PreviewCallback) as mp4? i tried to change handle open, handle preview etc... in camerahandler and changed iframecallback to previewcallback but the recorded video's color is not correct. I think it is because onPreviewFrame gives NV21 format (tried to change previewformat, but it was even worse). how to decode properly the onpreviewframe with uvccamera's camerahandler and mediacodec?

from uvccamera.

pricsko avatar pricsko commented on August 14, 2024

basically what i tried :
change byte[] data (from onpreviewframe) to mat in jni, like this :
IplImage *pYuvImage = cvCreateImage(cvSize(frame->width, frame->height), IPL_DEPTH_8U, 2);
pYuvImage->imageData = (char *) frame->data;
cv::Mat _yuv = cv::cvarrToMat(pYuvImage);
cvReleaseImage(&pYuvImage);
(which works well with uvccamera's frame with iframecallback set to PIXEL_FORMAT_YUV420SP - with nv21 it was the same color error)
i also tried with yuyv2iyuv420SP but it was the same :(

After that the rest is the same as in uvccamerapreview's do_capture_callback :

IplImage *pYuvImage = cvCreateImage(cvSize(frame->width, frame->height), IPL_DEPTH_8U, 2);
pYuvImage->imageData = (char *) frame->data;
cv::Mat _yuv = cv::cvarrToMat(pYuvImage);
cvReleaseImage(&pYuvImage);
_yuv = put_text_on_frame(env, _yuv);
int callbackPixelBytes2 = (int) (_yuv.total() * _yuv.channels());
memcpy(frame->data, _yuv.data, callbackPixelBytes2);
_yuv.release();

uvc_frame_t *callback_frame = frame;
callback_frame = get_frame(callbackPixelBytes2);
uvc_yuyv2iyuv420SP(frame, callback_frame);

recycle_frame(frame);

jobject buf = env->NewDirectByteBuffer(callback_frame->data, callbackPixelBytes);
env->CallVoidMethod(mFrameCallbackObj, itextcallback_fields.onTextFinished, buf);
env->ExceptionClear();
env->DeleteLocalRef(buf);

recycle_frame(callback_frame);

from uvccamera.

saki4510t avatar saki4510t commented on August 14, 2024

Hi,
I assume you may initialize MediaCodec encoder with wrong parameter(s).

If you want to encode video frame data using MediaCodec, you must use same pixel format for both MediaCodec and video source data(may come from IFrameCallback). Actual pixel format(s) that MediaCodec supports depend(s) on each device that you use. So you need to confirm on runtime and select the usable color format for both. All mediaCodec encoder on all sample projects are initialized for using Surface as video source now (because using Surface as video source is the fastest & best way to use MediaCodec as video encoder).
saki

from uvccamera.

pricsko avatar pricsko commented on August 14, 2024

Hi,

i solved my problem. It was a known issue. Reference and solution here : http://stackoverflow.com/questions/34145713/how-to-convert-yv12-to-color-formatyuv420semiplanar

Thanks for the quick answer btw :)

from uvccamera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.