Tuesday, 15 July 2014

ios - Transcoded MPEG-4 video not playing on Android's native app -



ios - Transcoded MPEG-4 video not playing on Android's native app -

i'm doing transcoding programmatically , created an mpeg4 video. problem not play on android's native player (galaxy nexus , nexus s). see error , codec details below.

i have files play , files fail play. wrong file android unable create media player?

question: why isn't file beingness played?

more info: transcode created using iphone. pseudocode: avassetexportsession->>exportasynchronouslywithcompletionhandler(avfiletypempeg4)

here's codec of video:

here's error:

02-14 12:39:33.243: e/mediaplayerservice(132): error: -2147483648 02-14 12:39:33.243: e/mediaplayer(25598): unable to create media player 02-14 12:39:33.251: w/videoview(25598): unable open content: file:///storage/sdcard0/download/img_0002.mov-st.mp4 02-14 12:39:33.251: w/videoview(25598): java.io.ioexception: setdatasourcefd failed.: status=0x80000000 02-14 12:39:33.251: w/videoview(25598): @ android.media.mediaplayer.setdatasource(native method) 02-14 12:39:33.251: w/videoview(25598): @ android.media.mediaplayer.setdatasource(mediaplayer.java:976) 02-14 12:39:33.251: w/videoview(25598): @ android.media.mediaplayer.setdatasource(mediaplayer.java:955) 02-14 12:39:33.251: w/videoview(25598): @ android.media.mediaplayer.setdatasource(mediaplayer.java:918) 02-14 12:39:33.251: w/videoview(25598): @ android.media.mediaplayer.setdatasource(mediaplayer.java:870) 02-14 12:39:33.251: w/videoview(25598): @ android.widget.videoview.openvideo(videoview.java:238) 02-14 12:39:33.251: w/videoview(25598): @ android.widget.videoview.access$2000(videoview.java:52) 02-14 12:39:33.251: w/videoview(25598): @ android.widget.videoview$6.surfacecreated(videoview.java:492) 02-14 12:39:33.251: w/videoview(25598): @ android.view.surfaceview.updatewindow(surfaceview.java:569) 02-14 12:39:33.251: w/videoview(25598): @ android.view.surfaceview.setvisibility(surfaceview.java:249) 02-14 12:39:33.251: w/videoview(25598): @ com.android.gallery3d.app.movieplayer$4.run(movieplayer.java:147) 02-14 12:39:33.251: w/videoview(25598): @ android.os.handler.handlecallback(handler.java:725) 02-14 12:39:33.251: w/videoview(25598): @ android.os.handler.dispatchmessage(handler.java:92) 02-14 12:39:33.251: w/videoview(25598): @ android.os.looper.loop(looper.java:137) 02-14 12:39:33.251: w/videoview(25598): @ android.app.activitythread.main(activitythread.java:5039) 02-14 12:39:33.251: w/videoview(25598): @ java.lang.reflect.method.invokenative(native method) 02-14 12:39:33.251: w/videoview(25598): @ java.lang.reflect.method.invoke(method.java:511) 02-14 12:39:33.251: w/videoview(25598): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 02-14 12:39:33.251: w/videoview(25598): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 02-14 12:39:33.251: w/videoview(25598): @ dalvik.system.nativestart.main(native method) 02-14 12:39:33.251: d/videoview(25598): error: 1,0

after running same problem, did lot of digging around , tried many different techniques solve issue. many other questions of same type have gotten responses of "just save .mov file iphone creates .mp4". in theory work since both containers, however, (at to the lowest degree me) lead same "unable open content" error mentioned here (and on every device tested with). solution me did end beingness using avassetexportsession. code used:

avurlasset *avasset = [avurlasset urlassetwithurl:self.sharingmovieurl options:nil]; nsarray *compatiblepresets = [avassetexportsession exportpresetscompatiblewithasset:avasset]; if ([compatiblepresets containsobject:avassetexportpresetlowquality]) { avassetexportsession *exportsession = [[avassetexportsession alloc]initwithasset:avasset presetname:avassetexportpresetpassthrough]; nsstring *filepath = [nstemporarydirectory() stringbyappendingpathcomponent:@"temp3.mp4"]; exportsession.outputurl = [nsurl fileurlwithpath:filepath]; exportsession.outputfiletype = avfiletypempeg4; [exportsession exportasynchronouslywithcompletionhandler:^{ switch ([exportsession status]) { case avassetexportsessionstatusfailed: //if fails, might because temorary //files weren't cleaned , isn't overwriting //the temporary filename nslog(@"export failed: %@", [[exportsession error] localizeddescription]); //perform failed logic break; case avassetexportsessionstatuscancelled: nslog(@"export canceled"); //perform cancel logic break; default: //this should have been success //file should saved @ filepath //upload file here break; } }]; }

android ios android-mediaplayer codec

No comments:

Post a Comment