bytedeco / sample-projects

Sample project files for JavaCPP, JavaCPP Presets, and JavaCV
219 stars 174 forks source link

From where recorder is getting the images or Frames to be recorded i found no link with preview to the recorder. #62

Closed qaisbayabani closed 2 years ago

qaisbayabani commented 2 years ago

Its working nice if added with permission nice means 100% correct. but i cant find out that from where recorder is getting the Frames from preview and where is connection between them. thanx in anticipation.

initRecorder()

    images[i] = new Frame(imageWidth, imageHeight, Frame.DEPTH_UBYTE, 2); ? or somewhere else

recorder = new FFmpegFrameRecorder(ffmpeg_link, imageWidth, imageHeight, 1);

    recorder.setFormat("mp4");
    recorder.setSampleRate(sampleAudioRateInHz);
    // Set in the surface changed method
    recorder.setFrameRate(frameRate);
    audioRecordRunnable = new AudioRecordRunnable();
    audioThread = new Thread(audioRecordRunnable);
    runAudioThread = true;
saudet commented 2 years ago

FFmpeg supports a variety of protocols. Just put your URL in ffmpeg_link and see if it works or not.

saudet commented 2 years ago

Or maybe what you're looking for is this line? https://github.com/bytedeco/sample-projects/blob/master/JavaCV-android-example/app/src/main/java/org/bytedeco/javacv_android_example/record/RecordActivity.java#L503

saudet commented 2 years ago

BTW, it's also possible to use FFmpeg or OpenCV to capture video on Android now, see https://github.com/bytedeco/javacv/issues/1692.

qaisbayabani commented 2 years ago
            ((ByteBuffer) yuvImage.image[0].position(0)).put(data); is the line i think i  have to understand and i just want single image not video?
saudet commented 2 years ago

That uses the old deprecated Camera Preview API, but yes that's how it's doing it.

qaisbayabani commented 2 years ago

FFmpeg supports a variety of protocols. Just put your URL in ffmpeg_link and see if it works or not.

direct stream from android phone cam :) . Is a URL can attain it?

saudet commented 2 years ago

Yes, something like this: https://github.com/bytedeco/javacv/issues/1692#issuecomment-978814766