objective c - AVCaptureSession w/o Decompression -


environment

  • os-x
  • yosemite
  • objective-c
  • compressed video input ( avcapturedeviceformat == 'muxx'/'isr ' )

use-case

compressed video stream exposed os hal capture device ( avcapturedevice ) supporting 'muxx/isr ' payload format, able directly access raw bytes of compressed payload w/o decompressing.

implementation

  1. find device using "+ (avcapturedevice *)devicewithuniqueid:(nsstring *)deviceuniqueid"
  2. create 'avcapturedeviceinput'
  3. create 'avcapturevideodataoutput'
  4. associate 'avcapturedevice' 'avcapturedeviceinput'
  5. setsamplebufferdelegate on 'avcapturevideodataoutput'
  6. create avcapturesession
  7. configure session adding inputs , outputs ( no preset selected )
  8. start session calling [session startrunning]
  9. upon 'avcapturevideodataoutputsamplebufferdelegate' invocation call 'cmsamplebuffergetdatabuffer(samplebuffer);' reference raw buffer

problem description

while delegate invoked system buffers refer decoded yuy2 image rather compressed buffer ( before de-muxed , de-coded ), , thus, 'cmsamplebuffergetdatabuffer' returns nil pointer.

how can raw payload sent avcapturedevice w/o decompressing?

the solution use c++ coremediaio framework, sample provided @ link, main problem coremediaio is not used , has minimal documentation, sample code provided apple old , req quite tinkering before can compile recent sdks, however, in end, works, this blog entry has nice example.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -