小编huy*_*ang的帖子

视频使用OnAudioFilterRead数据编码错误

我正在尝试使用OnAudioFilterRead函数将Unity游戏音频录制到mp4文件.

function OnAudioFilterRead(var data:float[], var channels:int)
Run Code Online (Sandbox Code Playgroud)

我的解决方案概述.
步骤1.将从Unity获取的数据样本转换为bytes []

private void Convert2Bytes(float[] samples) {
    Int16[] intData = new Int16[samples.Length];
    //converting in 2 float[] steps to Int16[], //then Int16[] to Byte[]

    Byte[] bytesData = new Byte[samples.Length * 2];
    //bytesData array is twice the size of
    //dataSource array because a float converted in Int16 is 2 bytes.

    float rescaleFactor = 32767; //to convert float to Int16

    for (int i = 0; i<samples.Length; i++) {
        intData[i] = (short) ((samples[i] * gain) * rescaleFactor); …
Run Code Online (Sandbox Code Playgroud)

mp4 android unity-game-engine h.264 mediacodec

8
推荐指数
0
解决办法
355
查看次数

什么是苹果iOS开发证书和APNs开发iOS

在Apple开发证书页面中有两种类型的证书:

  1. iOS开发
  2. APNs开发iOS

有什么不同?

code-signing apple-push-notifications ios

6
推荐指数
2
解决办法
1万
查看次数