Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MediaRecorder启动失败-19在sony z系列中使用libstreaming android_Android_H.264_Rtsp_Live Streaming - Fatal编程技术网

MediaRecorder启动失败-19在sony z系列中使用libstreaming android

MediaRecorder启动失败-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

当我在sony z和wowza流媒体服务器上使用mediarecoder和libstreaming android启动实时流媒体时,我遇到了一个错误

07-20 10:49:37.832:E/MediaRecorder(6752):启动失败:-19 ConfNotSupportedException

在(1530)中更改视频的帧速率时引发此错误。如果我设置fps=15或fps=30,则不会抛出此错误。此错误仅在sony z设备上出现,在一些不同的设备上,三星、Htc、Nexus都没有

我下载了Wowza Gocoder应用程序来测试这个错误是否只出现在sony z上。而且,我可以将fps从15更改为60,没有任何错误。因此,我想libstreaming库有问题

我的配置代码:

// 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);
解决了我的问题