慕田峪7331174
这是一个很好的起点:https://github.com/nareix/joy4/blob/05a4ffbb53695aaacf9a2e2624472686280ab6dc/cgo/ffmpeg/video.go#L64-L88一旦你拥有了你所能做到的:*C.AVFrameframefunc fromCPtr(buf unsafe.Pointer, size int) (ret []uint8) { hdr := (*reflect.SliceHeader)((unsafe.Pointer(&ret))) hdr.Cap = size hdr.Len = size hdr.Data = uintptr(buf) return}w := int(frame.width)h := int(frame.height)ys := int(frame.linesize[0])cs := int(frame.linesize[1])img = image.YCbCr{ Y: fromCPtr(unsafe.Pointer(frame.data[0]), ys*h), Cb: fromCPtr(unsafe.Pointer(frame.data[1]), cs*h/2), Cr: fromCPtr(unsafe.Pointer(frame.data[2]), cs*h/2), YStride: ys, CStride: cs, SubsampleRatio: image.YCbCrSubsampleRatio420, Rect: image.Rect(0, 0, w, h),}在 哪个实现中填充映像image.YCbCrimage.Image