- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正尝试在我的 Nexus 5x 上拍摄慢动作视频。这就是我配置媒体记录器的方式:
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH_SPEED_HIGH);
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);
// Step 3: Set the high speed CamcorderProfile
mMediaRecorder.setProfile(profile);
// Step 4: Set output file
// Step 5: Prepare media recorder
// Step 6: Capture video
问题是,捕获的视频不是我的设备支持的 120 fps 慢动作视频。它们是常规的 29 fps 视频。
我经历了this answer ,在 official documentation 中讨论了以下内容:
For all the high speed profiles defined below ((from QUALITY_HIGH_SPEED_LOW to QUALITY_HIGH_SPEED_2160P), they are similar as normal recording profiles, with just higher output frame rate and bit rate. Therefore, setting these profiles with setProfile(CamcorderProfile) without specifying any other encoding parameters will produce high speed videos rather than slow motion videos that have different capture and output (playback) frame rates. To record slow motion videos, the application must set video output (playback) frame rate and bit rate appropriately via setVideoFrameRate(int) and setVideoEncodingBitRate(int) based on the slow motion factor. If the application intends to do the video recording with MediaCodec encoder, it must set each individual field of MediaFormat similarly according to this CamcorderProfile.
我不明白的是,setProfile已经使用从所选 CamcorderProfile 派生的参数调用了两个方法 setVideoFrameRate 和 setVideoEncodingBitRate。为什么我需要再次给他们打电话?我在这里缺少什么?
如有任何帮助,我们将不胜感激。对于我的生活,我无法让它工作!
编辑:我试过像这样调用方法,但它仍然捕获正常速度的视频:
mMediaRecorder.setVideoFrameRate(profile.videoFrameRate/4);
mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate/4);
1/4,因为 CamcorderProfile.QUALITY_HIGH_SPEED_HIGH 宣传的帧速率是 120,我想捕捉文档 here 中所述的 30 fps 视频
public int videoFrameRate
Added in API level 8 The target video frame rate in frames per second.
This is the target recorded video output frame rate per second if the application configures the video recording via setProfile(CamcorderProfile) without specifying any other MediaRecorder encoding parameters. For example, for high speed quality profiles (from QUALITY_HIGH_SPEED_LOW to QUALITY_HIGH_SPEED_2160P), this is the frame rate where the video is recorded and played back with. If the application intends to create slow motion use case with the high speed quality profiles, it must set a different video frame rate that is corresponding to the desired output (playback) frame rate via setVideoFrameRate(int). For example, if QUALITY_HIGH_SPEED_720P advertises 240fps videoFrameRate in the CamcorderProfile, and the application intends to create 1/8 factor slow motion recording videos, the application must set 30fps via setVideoFrameRate(int). Failing to do so will result in high speed videos with normal speed playback frame rate (240fps for above example). If the application intends to do the video recording with MediaCodec encoder, it must set each individual field of MediaFormat similarly according to this CamcorderProfile.
最佳答案
mMediaRecorder.setVideoFrameRate(QUALITY_HIGH_SPEED_LOW);
或
mMediaRecorder.setVideoFrameRate(QUALITY_HIGH_SPEED_HIGH);
关于Android 使用 CamcorderProfile 捕捉慢动作视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35116159/
Posical duplicate MediaRecorder start failed: -16 MediaRecorder 启动失败:-16 当将 CamcorderProfile.QUALITY
我的代码: mediaRecorder = new MediaRecorder(); mediaRecorder.setCamera(camera); mediaRecorder.setVideoSo
我在尝试使用 CamcorderProfile.hasProfile(xyz) 时收到运行时 NoSuchMethodError。在我的应用 list 中指定了正确的 API 这是我想使用的 blo
这是我的问题,我正在开发一个使用摄像头和录制视频的软件,一切正常,但我不知道如何管理设置,例如我有一个三星 galaxy S 可以录制视频1280x720,但当我将此分辨率设置为: Camcorder
根据docs , 你可以使用 CamcorderProfile 获取设备默认的视频编解码器格式,然后将其设置为 MediaRecorder,如下所示: CamcorderProfile mProfil
我正尝试在我的 Nexus 5x 上拍摄慢动作视频。这就是我配置媒体记录器的方式: CamcorderProfile profile = CamcorderProfile.get(CamcorderP
到目前为止,我还没有找到任何解释。基本上我有一个视频录制类,当我的三星 Galaxy S2 上的 setVideoSize() 设置为 720 x 480 时,它的效果非常好。 我希望它以尽可能高的分
我有一个代码示例: mediaRecorder = new MediaRecorder(); mediaRecorder.setPreviewDisplay(surfaceHolder.getSurf
我的应用程序使用 HLS 从服务器流式传输视频,但是当我从服务器请求 HLS 流时,我需要将设备可以处理的最大视频比特率传递给它。在Android API guides它说“设备的可用视频录制配置文件
由于我想通过 CamcorderProfiles (CamcorderProfile.QUALITY_HIGH/LOW) 设置 Android 摄像机录制质量,我还需要相应地设置相机预览尺寸(和布局)
我在 Nexus 7 2012 上使用自定义摄像头录制视频时遇到了这个问题,而其他设备,如 Zenfone 2、Galaxy S3、S6、HTC One M7、Oppo N1、Sony Xperia
我是一名优秀的程序员,十分优秀!