ios - AVURLAsset cannot find video track -



ios - AVURLAsset cannot find video track -

i utilize uivideoeditorcontroller trim video. after editing, in delegate, seek remix video other media. however, [avurlasset trackwithmediatype:] unable find video track. code follow:

- (void)video:(nsstring*)videopath didfinishsavingwitherror:(nserror*)error contextinfo:(void*)contextinfo { nsurl *videourl = [nsurl urlwithstring:videopath]; avurlasset *asset = [avurlasset urlassetwithurl:videourl options:nil]; if(asset == nil) { nslog(@"cannot create avurlasset"); return; } else { nslog(@"asset: %@", asset); } if([asset trackswithmediatype:avmediatypevideo].count == 0) { nslog(@"no video track"); return; } else if([asset trackswithmediatype:avmediatypeaudio].count == 0) { nslog(@"no sound track"); return; } // follow codes hidden intentionally }

the console log prints:

2014-10-15 13:35:45.913 testvideotrim[3278:1191544] asset: <avurlasset: 0x178229e00, url = /private/var/mobile/containers/data/application/96e7c0ff-92eb-44f7-8e35-b29fd0e58302/tmp/trim.ec3fb214-9907-411d-b3a3-75 ... 41e5.mov> 2014-10-15 13:35:45.981 testvideotrim[3278:1191544] no video track

however, when go photo app , play trimmed video, video plays audio. reason of unable find video track?

p.s. delegate function's nserror returns null, representing there no error occurred when editing video.

replace

nsurl *videourl = [nsurl urlwithstring:videopath];

with

nsurl *videourl = [nsurl fileurlwithpath:videopath];

ios video avfoundation uivideoeditorcontroller

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -