Media Recorder with HEVC encoding
まだ誰も着手していません。
評価
調査の方向性
MainActivity.java:226 から始めて、issue に示されている MediaRecorder の設定を確認します。特に HEVC エンコーダーと start failed: -2147483648 例外を確認してください。周辺の sample エントリーポイントを調べ、issue を再現できるかどうかを判断します。payload にはコード変更も明確な完了条件も定義されていません。
索引モデルが issue の本文から書いたものです。
説明
Hello,
When I set videoEndoderto HEVC mediarecorder.start() is not working below is the exception. Kindly let me know the reason or whats going wrong.
{
// BEGIN_INCLUDE (configure_preview)
mCamera = CameraHelper.getDefaultCameraInstance();
// We need to make sure that our preview and recording video size are supported by the
// camera. Query camera to find all the sizes and choose the optimal size given the
// dimensions of our preview surface.
Camera.Parameters parameters = mCamera.getParameters();
List<Camera.Size> mSupportedPreviewSizes = parameters.getSupportedPreviewSizes();
List<Camera.Size> mSupportedVideoSizes = parameters.getSupportedVideoSizes();
Camera.Size optimalSize = CameraHelper.getOptimalVideoSize(mSupportedVideoSizes,
mSupportedPreviewSizes, mPreview.getWidth(), mPreview.getHeight());
// Use the same size for recording profile.
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
profile.videoFrameWidth = optimalSize.width;
profile.videoFrameHeight = optimalSize.height;
// likewise for the camera object itself.
parameters.setPreviewSize(profile.videoFrameWidth, profile.videoFrameHeight);
mCamera.setParameters(parameters);
try {
// Requires API level 11+, For backward compatibility use {@link setPreviewDisplay}
// with {@link SurfaceView}
mCamera.setPreviewTexture(mPreview.getSurfaceTexture());
} catch (IOException e) {
Log.e(TAG, "Surface texture is unavailable or unsuitable" + e.getMessage());
return false;
}
// END_INCLUDE (configure_preview)
// BEGIN_INCLUDE (configure_media_recorder)
mMediaRecorder = new MediaRecorder();
// Step 1: Unlock and set camera to MediaRecorder
mCamera.unlock();
mMediaRecorder.setCamera(mCamera);
// Step 2: Set sources
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT );
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setVideoSize(1280,720);
mMediaRecorder.setVideoEncodingBitRate(1500);
mMediaRecorder.setVideoFrameRate(30);
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.HEVC);
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
// Step 3: Set a CamcorderProfile (requires API Level 8 or higher)
// mMediaRecorder.setProfile(profile);
// Step 4: Set output file
mOutputFile = CameraHelper.getOutputMediaFile(CameraHelper.MEDIA_TYPE_VIDEO);
if (mOutputFile == null) {
return false;
}
mMediaRecorder.setOutputFile(mOutputFile.getPath());
// END_INCLUDE (configure_media_recorder)
// Step 5: Prepare configured MediaRecorder
try {
mMediaRecorder.prepare();
} catch (IllegalStateException e) {
Log.d(TAG, "IllegalStateException preparing MediaRecorder: " + e.getMessage());
releaseMediaRecorder();
return false;
} catch (IOException e) {
Log.d(TAG, "IOException preparing MediaRecorder: " + e.getMessage());
releaseMediaRecorder();
return false;
}
return true;
}
Exceptions
D/vndksupport: Loading /vendor/lib/hw/gralloc.msm8974.so from current namespace instead of sphal namespace.
07-02 17:34:19.078 24853-24889/com.example.android.mediarecorder D/vndksupport: Loading /vendor/lib/hw/[email protected] from current namespace instead of sphal namespace.
07-02 17:34:19.080 24853-24889/com.example.android.mediarecorder D/vndksupport: Loading /vendor/lib/hw/gralloc.msm8974.so from current namespace instead of sphal namespace.
07-02 17:34:20.585 24853-24897/com.example.android.mediarecorder E/MediaRecorder: start failed: -2147483648
07-02 17:34:20.592 24853-24897/com.example.android.mediarecorder E/AndroidRuntime: FATAL EXCEPTION: AsyncTask android/android-MediaRecorder#1
Process: com.example.android.mediarecorder, PID: 24853
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.example.android.mediarecorder.MainActivity$MediaPrepareTask.doInBackground(MainActivity.java:226)
at com.example.android.mediarecorder.MainActivity$MediaPrepareTask.doInBackground(MainActivity.java:218)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
- 主要言語
- Kotlin
- スター
- 1.4k
- フォーク
- 782
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
android/media-samples のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
android/media-samples#117 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
android/media-samples#116 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
android/media-samples#112 ·
-
بانلبرلبتオープン
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
android/media-samples#111 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
android/media-samples#97 · コメント 3 件 · リアクション 2 件 ·
android/media-samples の issue をすべて見る
似ている issue
-
Meta request
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
keiyoushi/extensions-source#19500 ·
メンテナーはふだん 1 日以内に返信
-
go 🏃 testing 🧪
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
valkey-io/valkey-glide#7239 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ethereum-lists/chains#8788 ·
メンテナーはふだん 1 日以内に返信
-
documentation P1
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modelcontextprotocol/kotlin-sdk#1050 ·
メンテナーはふだん 2 日以内に返信