Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

h 264 Hardware encoding /decoding For IOS(IPhone/Ipad)?

i have done Real time video processing in ios using AVFoundation framework , help of this link.i have tested it is working fine. now i want to use h264 encoding and decoding[Before draw] .i try to get h264 encoded data from AVCaptureSession ,so i have set AVVideoCodecH264 in AVCaptureSession's videosetting,before Start capturing .

NSDictionary* videoSettings = [NSDictionary dictionaryWithObjectsAndKeys:value,key,AVVideoCodecH264,AVVideoCodecKey, nil]; [captureOutput setVideoSettings:videoSettings];

above code doesn't produce any change in output buffer,same buffer format get as like before. how to accomplish my requirement ? is it possible ? if so Please Help me to getting started ,h264 in ios.

like image 970
Asta ni enohpi Avatar asked Jan 23 '12 06:01

Asta ni enohpi


1 Answers

There's no direct access to encoded keyframes. You may found some insightful comments about that here: https://stackoverflow.com/questions/4399162/how-to-stream-live-video-from-iphone-to-a-media-server-like-wowza

A pair AVVideoCodecH264, AVVideoCodecKey may be used as parameters in outputSettings in

NSError *error = nil;
NSDictionary *outputSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                AVVideoCodecH264, AVVideoCodecKey, nil];

AVAssetWriterInput *assetWriterInput = [[AVAssetWriterInput alloc]
                                   initWithMediaType:AVMediaTypeVideo
                                      outputSettings:outputSettings];
AVAssetWriter *assetWriter = [[AVAssetWriter alloc] initWithURL:fileURL
                                                       fileType:AVFileTypeMPEG4
                                                          error:&error];
if (!error && [assetWriter canAddInput:assetWriterInput])
  [assetWriter addInput:assetWriterInput];
like image 61
Daniel Bauke Avatar answered Nov 03 '22 09:11

Daniel Bauke