ios - Having issue with AVAssetWriterInput parameter sourceFormatHint -
i working avassetwriterinput
sourceformathint
parameter giving warning:
incompatible integer pointer conversion sending 'int' parameter of type 'cmformatdescriptionref' (aka 'const struct opaquecmformatdescription *')
here code:
avassetwriterinput* videowriterinput = [avassetwriterinput assetwriterinputwithmediatype:avmediatypevideo outputsettings:settings sourceformathint:kcmmediatype_video]; videowriterinput.expectsmediadatainrealtime = yes; videowriterinput.transform = videotrack.preferredtransform; avassetwriter *videowriter = [[avassetwriter alloc] initwithurl:outputurl filetype:@"public.mpeg-4" error:nil]; [videowriter addinput:videowriterinput];
what parameter should pass in sourceformathint
?
hello see below setup working me....:)
-(bool) setupwriter { nserror* error = nil; videowriter = [[avassetwriter alloc] initwithurl:[self tempfileurl] filetype:avfiletypequicktimemovie error:&error]; nsparameterassert(videowriter); //configure video nsdictionary* videocompressionprops = [nsdictionary dictionarywithobjectsandkeys: [nsnumber numberwithdouble:1024*1024], avvideoaveragebitratekey, nil ]; nsdictionary* videosettings = [nsdictionary dictionarywithobjectsandkeys: avvideocodech264, avvideocodeckey, [nsnumber numberwithint:320.0], avvideowidthkey, [nsnumber numberwithint:568.0], avvideoheightkey, videocompressionprops, avvideocompressionpropertieskey, nil]; videowriterinput = [avassetwriterinput assetwriterinputwithmediatype:avmediatypevideo outputsettings:videosettings]; // videowriterinput =[avassetwriterinput assetwriterinputwithmediatype:avmediatypevideo outputsettings:videosettings sourceformathint:kcmmediatype_video]; nsparameterassert(videowriterinput); videowriterinput.expectsmediadatainrealtime = yes; nsdictionary* bufferattributes = [nsdictionary dictionarywithobjectsandkeys: [nsnumber numberwithint:kcvpixelformattype_32argb], kcvpixelbufferpixelformattypekey, nil]; avadaptor = [avassetwriterinputpixelbufferadaptor assetwriterinputpixelbufferadaptorwithassetwriterinput:videowriterinput sourcepixelbufferattributes:bufferattributes] ; //add input [videowriter addinput:videowriterinput]; [videowriter startwriting]; [videowriter startsessionatsourcetime:cmtimemake(0, 1000)]; homecoming yes; }
ios objective-c avfoundation avassetwriter
No comments:
Post a Comment