我成功地将AVFoundation Framework的AVCaptureVideoPreviewLayer捕获的一系列图像编码为使用AVAssetWriter和AVAssetWriterInput的视频.
但是视频的大小太大了,在这种情况下,你们中的任何人都可以向我推荐一个教程或者至少是直接的我,或者给我正确的视频压缩视频输出设置.
我正在使用以下VideoOutputSetting.
videoOutputSettings = @{
AVVideoCodecKey: AVVideoCodecH264,
AVVideoWidthKey: [NSNumber numberWithInt:width],
AVVideoHeightKey: [NSNumber numberWithInt:height],
AVVideoCompressionPropertiesKey: @{
AVVideoAverageBitRateKey: [NSNumber numberWithInt:bitrate],
AVVideoMaxKeyFrameIntervalKey: @(150),
AVVideoProfileLevelKey: AVVideoProfileLevelH264BaselineAutoLevel,
AVVideoAllowFrameReorderingKey: @NO,
AVVideoH264EntropyModeKey: AVVideoH264EntropyModeCAVLC,
AVVideoExpectedSourceFrameRateKey: @(30),
AVVideoAverageNonDroppableFrameRateKey: @(30)
}
};
videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
_videoWriterInput.expectsMediaDataInRealTime = YES;
Run Code Online (Sandbox Code Playgroud) 我尝试解密从Web服务收到的加密数据.
加密是使用完成的AES 128.
我使用以下代码来解密数据:
public static String decrypt(String strToDecrypt)
{
try
{
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); //AES/CBC/PKCS7Padding
SecretKeySpec secretKey = new SecretKeySpec(AppConstants.AESEncryptionKey.getBytes("UTF8"), "AES");
int blockSize = cipher.getBlockSize();
cipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(new byte[blockSize])); //new IvParameterSpec(new byte[16])
byte decBytes[] = cipher.doFinal(Base64.decode(strToDecrypt, 0));
// byte decBytes[] = cipher.doFinal(Base64.decodeBase64(strToDecrypt));
String decStr = new String(decBytes);
System.out.println("After decryption :" + decStr);
return decStr;
}
catch (Exception e)
{
System.out.println("Exception in decryption : " + e.getMessage());
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
在
cipher.doFinal()
我得到以下例外:
javax.crypto.badpaddingexception pad块损坏 …
我在我的项目中集成了Aviary SDK.我正在使用Android Studio.
我还集成了Appcompact V7仍然出现以下错误:
错误:检索项目的父项时出错:找不到与给定名称"@ style/Theme.Base.AppCompat.Dialog.FixedSize"匹配的资源.
请帮助我们提供宝贵的意见.