小编Kev*_*ong的帖子

如何在使用MediaRecorder Class时更改帧速率

我尝试使用MediaRecorder Class录制视频.

但是我发现我没有降低视频流的帧速率.

我使用H.264作为我的视频编码器和AAC作为我的音频编码器(是的,API LEVEL 10及以上版本,AKA Android 2.3.3+支持)主要来源如下.

recorder = new MediaRecorder(); 
recorder.setPreviewDisplay(surfaceHolder.getSurface());
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); 
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
//set the Output Format
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);  
//set the Video Size
recorder.setVideoSize(176,144);   
//set the Frame rate
recorder.setVideoFrameRate(15);

//Set the Video Encoder
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); 
//Set the Audio Encoder
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);          
recorder.setOutputFile(myRecAudioFile.getAbsolutePath());
recorder.prepare();
recorder.start();
Run Code Online (Sandbox Code Playgroud)

但是我收到了调试信息:

03-22 22:39:41.120: WARN/StagefrightRecorder(662): Intended video encoding frame rate (15 fps) is too small and will be set to (27 fps)
Run Code Online (Sandbox Code Playgroud)

很奇怪,我还收到一条错误消息:

03-22 22:39:41.380: ERROR/VENC_ENC(662): Bitrate 192000
Run Code Online (Sandbox Code Playgroud)

最后,我得到了一个mp4文件,其帧速率接近28fps.


我也尝试使用最低的CamcorderProfile

recorder = new MediaRecorder(); 
recorder.setPreviewDisplay(surfaceHolder.getSurface());
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); 
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

//replacement …
Run Code Online (Sandbox Code Playgroud)

android frame-rate video-streaming mediarecorder

7
推荐指数
1
解决办法
4738
查看次数

有没有办法将 <canvas> 覆盖在全屏 HTML5 <video> 上?

我正在使用 videojs 来播放视频,并且我对视频内容逐帧进行了一些操作并将其显示在<canvas>(ID:“显示”)中。

视频播放时,可以用下面的css<canvas>显示在前面。<video>

<style type="text/css">
    canvas#display {
        z-index: 1;
        postion: relative;
        top: some-video-height-px;
    }

    video#videoDiv_html5_api {
        z-index: -2;
    }

    div.vjs-controls {
        z-index: 3;
    }

</style>
Run Code Online (Sandbox Code Playgroud)

进入全屏模式时,该属性似乎z-index不起作用。<video>它保持在前面并且<canvas>不能覆盖<video>


在 W3C 文档中 https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#ui

我们有

:fullscreen {
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  z-index:2147483647;
  box-sizing:border-box;
  margin:0;
  width:100%;
  height:100%;
}
Run Code Online (Sandbox Code Playgroud)

看来 z-index 已设置为Integer.MAX_VALUE...

html javascript z-index fullscreen html5-video

5
推荐指数
1
解决办法
6260
查看次数