MediaRecorder启动失败-19在sony z系列中使用libstreaming android
当我在sony z和wowza流媒体服务器上使用mediarecoder和libstreaming android启动实时流媒体时,我遇到了一个错误 07-20 10:49:37.832:E/MediaRecorder(6752):启动失败:-19 ConfNotSupportedException 在(15MediaRecorder启动失败-19在sony z系列中使用libstreaming android,android,h.264,rtsp,live-streaming,Android,H.264,Rtsp,Live Streaming,当我在sony z和wowza流媒体服务器上使用mediarecoder和libstreaming android启动实时流媒体时,我遇到了一个错误 07-20 10:49:37.832:E/MediaRecorder(6752):启动失败:-19 ConfNotSupportedException 在(15
// Configures the SessionBuilder
mSession = SessionBuilder.getInstance()
.setContext(getApplicationContext())
.setAudioEncoder(SessionBuilder.AUDIO_AAC)
.setAudioQuality(new AudioQuality(8000, 16000))
.setVideoEncoder(SessionBuilder.VIDEO_H264)
.setSurfaceView(mSurfaceView).setPreviewOrientation(0)
.setCallback(this).build();
// Configures the RTSP client
mClient = new RtspClient();
mClient.setSession(mSession);
mClient.setCallback(this);
// Use this to force streaming with the MediaRecorder API
mSession.getVideoTrack().setStreamingMethod(
MediaStream.MODE_MEDIARECORDER_API);
此代码包含以下启动流:
protected void encodeWithMediaRecorder() throws IOException, ConfNotSupportedException {
Log.d(TAG,"Video encoded using the MediaRecorder API");
// We need a local socket to forward data output by the camera to the packetizer
createSockets();
// Reopens the camera if needed
destroyCamera();
createCamera();
// The camera must be unlocked before the MediaRecorder can use it
unlockCamera();
try {
mMediaRecorder = new MediaRecorder();
mMediaRecorder.setCamera(mCamera);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mMediaRecorder.setVideoEncoder(mVideoEncoder);
mMediaRecorder.setPreviewDisplay(mSurfaceView.getHolder().getSurface());
mMediaRecorder.setVideoSize(mRequestedQuality.resX,mRequestedQuality.resY);
mMediaRecorder.setVideoFrameRate(mRequestedQuality.framerate);
// The bandwidth actually consumed is often above what was requested
mMediaRecorder.setVideoEncodingBitRate((int)(mRequestedQuality.bitrate*0.8));
// We write the output of the camera in a local socket instead of a file !
// This one little trick makes streaming feasible quiet simply: data from the camera
// can then be manipulated at the other end of the socket
FileDescriptor fd = null;
if (sPipeApi == PIPE_API_PFD) {
fd = mParcelWrite.getFileDescriptor();
} else {
fd = mSender.getFileDescriptor();
}
mMediaRecorder.setOutputFile(fd);
mMediaRecorder.prepare();
mMediaRecorder.start();
} catch (Exception e) {
throw new ConfNotSupportedException(e.getMessage());
}
有人有想法吗?谢谢
mMediaRecorder.setVideoFrameRate(mRequestedQuality.framerate);
解决了我的问题。发表评论
mMediaRecorder.setVideoFrameRate(mRequestedQuality.framerate);
解决了我的问题