有没有办法从NSData创建CMSampleBufferRef? NSData对象以前也是从CMSampleBufferRef构造的。我需要转换,因为我想保存使用AVFoundation从实时相机拍摄的CMSampleBufferRef帧(作为NSData),然后能够使用CMSampleBufferRef帧(通过将NSData对象转换为CMSampleBufferRef)来构建视频。
提前致谢...
答案 0 :(得分:0)
import numpy as np
inp_arr = np.array([[255, 255, 255, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255],
[255, 0, 0, 255, 255, 255, 255, 255],
[255, 0, 0, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255],
[255, 255, 255, 255, 0, 0, 255, 255],
[255, 255, 255, 255, 0, 0, 255, 255],
[255, 255, 255, 255, 255, 255, 255, 255]])
out_arr = np.array([[255, 255, 255, 255, 255, 255, 255, 255],
[0, 0, 0, 0, 255, 255, 255, 255],
[0, 0, 0, 0, 255, 255, 255, 255],
[0, 0, 0, 0, 255, 255, 255, 255],
[0, 0, 0, 0, 255, 255, 255, 255],
[255, 255, 255, 0, 0, 0, 0, 255],
[255, 255, 255, 0, 0, 0, 0, 255],
[255, 255, 255, 0, 0, 0, 0, 255],
[255, 255, 255, 0, 0, 0, 0, 255]])