media.captureVideo / media.playVideo cross platform incompatibilty?

OK, thanks for all your help dchan. I copied your file and tried it, and it worked…

My original 3gp didnt, blank player… I did get a different 3gp to play in the player with that code though, I think it was from a newer droid. Having 3 3gp files, recorded on various droids, 2 worked, 1 didn’t, I looked at the files in g-spot (nice free container/codec inspection utility).

Your 3gp:

isom: MP4  Base Media v1 [IS0 14496-12:2003]

  • 3gp4: 3GPP Media (.3GP) Release 4
    Recommended Display Size: 1920 x 1080
    Created:     2013 Oct 24   16:57:20
    Modified:     2013 Oct 24   16:57:20
     

My working 3gp (from android jelly bean/nexus 7):

3gp6: 3GPP Media (.3GP) Release 6 Basic Profile

  • isom: MP4  Base Media v1 [IS0 14496-12:2003]
    Recommended Display Size: 480 x 360
    Created:     2013 Oct 11   23:20:08
    Modified:     2013 Oct 11   23:20:08
     

My not working 3gp (from android 2.3.6):

3gp4: 3GPP Media (.3GP) Release 4
Recommended Display Size: 320 x 240
 

I’m going to go back through things, as I hadn’t noticed the I could playback the nexus 7 videos on ios before…

But a LOT thanks for your help dchan… I guess the best scenario would be if the older phones just dont have the encoding (until android 3.0? http://developer.android.com/guide/appendix/media-formats.html – most of the way down the page it shows pre 3.0 only doing h.263 encoding, and after 3.0 h.264 … Could that be why?) 

I’ll let you know if I find out more specifics, thanks again!

Can you attach your non working 3gp file so I can play around with it?  Thanks.

Sure thing.

@dchan: OK, my mistake testing above –

Although I can playback your 3gp file on iOS, I can’t playback 3gp’s on iOS from either of my droids. Attached is another example 3gp, this one from my nexus 7 (Jelly bean).

This 3gp has something in common with the other one, the audio compression. And the audio compression on both of these failing ones is listed in the gspot utility as: “samr: AMR Narrowband”… Note that these .3gp’s were recorded in corona using the “Medium” record setting for media.captureVideo, which the documentation says defaults to “low” on android…

Your .3gp file appears to be recorded from the “high” setting (given it’s 1920x1080 size), and gspot lists your files audio codec as: " mp4a: MPEG-4 AAC LC"

A couple questions, if you’ve got time for any of them – Does this 3gp, from a new nexus 7 (recorded with “low” in media.captureVideo) playback for you on iOS? (It does in osx/windows, but not on an ios device for me…) If you record a video set to medium/low on your own android device using media.captureVideo, do you get the same “amr narrowband” audio codec result? Will your own medium/low video play back on ios using media.playVideo? (basically, is that how we’re getting different results / why it won’t play back… because of my low setting/codec, and yours?)

NOTE: In gspot, at the bottom of the main window under the “Proposed Codec Solutions and tests”, you click the “1” test button in the “MS/AV” column, gspot throws an error: “Partial render failure: Video could be rendered, but the audio could not.” It’s got more details about the error / codecs, but, it looks like some kind of error to gspot it seems (you’re hi-res 3gp does not throw this gspot error).

@dchan – and one more data point… (Recording “medium” / “low” video record quality on droid)… (seen in build 2090 and earlier)

I’m getting a major error even attempting to record low/medium quality on my Nexus 7 (last years model). 50% or more of the time that I try and record video, the camera activity crashes. I think it is also related to the audio… (As I mentioned above, I think the playback of 3gp on ios is also failing because of the low/medium android audio format)…

In this case, the recorder failing, I have a good log from the nexus (again, this is while recording “medium” quality on android - the camera activity pops up on screen, and > 50% of the time crashes right out):

I/Corona  ( 3453):  – camera init called
I/ActivityManager(  430): START u0 {act=android.media.action.VIDEO_CAPTURE cmp=c
om.google.android.gallery3d/com.android.camera.VideoCamera (has extras)} from pi
d 3453
W/InputMethodManagerService(  430): Window already focused, ignoring focus gain
of: com.android.internal.view.IInputMethodClient$Stub$Proxy@425e2920 attribute=n
ull, token = android.os.BinderProxy@424a62a0
I/Corona  ( 3453): * systemListener() called – Global event occurred:
I/Corona  ( 3453): *  event.type ==     applicationSuspend
I/Corona  ( 3453):   – applicationSuspend
I/Corona  ( 3453): *******************
I/ActivityManager(  430): Start proc com.google.android.gallery3d for activity c
om.google.android.gallery3d/com.android.camera.VideoCamera: pid=3737 uid=10019 g
ids={50019, 1006, 3003, 1015, 1028}
I/MPL-storeload(  430): mpl state size = 5584
E/MPL-storeload(  430): calData from inv_save_mpl_states, size=2
I/MPL-storeload(  430): cal data size to write = 5584
I/MPL-storeload(  430): Bytes written = 5584
D/libgps  (  430): proxy_gps_stop()
D/libgps  (  430): proxy_gps_status_cb()
D/libgps  (  430): proxy_gps_status_cb()
I/MPL-storeload(  430): mpl state size = 5584
E/MPL-storeload(  430): calData from inv_save_mpl_states, size=2
I/MPL-storeload(  430): cal data size to write = 5584
I/MPL-storeload(  430): Bytes written = 5584
I/MPL-storeload(  430): mpl state size = 5584
E/MPL-storeload(  430): calData from inv_save_mpl_states, size=2
I/MPL-storeload(  430): cal data size to write = 5584
I/MPL-storeload(  430): Bytes written = 5584
D/dalvikvm( 3737): GC_CONCURRENT freed 312K, 5% free 7631K/8004K, paused 5ms+3ms
, total 43ms
D/dalvikvm( 3737): GC_CONCURRENT freed 177K, 4% free 7902K/8148K, paused 3ms+3ms
, total 49ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 143K, 4% free 7983K/8292K, paused 17ms, to
tal 17ms
I/dalvikvm-heap( 3737): Grow heap (frag case) to 8.132MB for 291616-byte allocat
ion
D/dalvikvm( 3737): GC_FOR_ALLOC freed <1K, 4% free 8267K/8580K, paused 17ms, tot
al 17ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 287K, 7% free 8206K/8808K, paused 15ms, to
tal 15ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed <1K, 4% free 8491K/8808K, paused 15ms, tot
al 15ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 328K, 7% free 8487K/9060K, paused 15ms, to
tal 15ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 553K, 11% free 8107K/9060K, paused 15ms, t
otal 15ms
D/dalvikvm( 3737): GC_CONCURRENT freed 3K, 5% free 8615K/9060K, paused 2ms+2ms,
total 19ms
D/dalvikvm( 3737): WAIT_FOR_CONCURRENT_GC blocked 13ms
I/dalvikvm-heap( 3737): Grow heap (frag case) to 8.750MB for 291616-byte allocat
ion
D/dalvikvm( 3737): GC_FOR_ALLOC freed 284K, 8% free 8615K/9348K, paused 15ms, to
tal 16ms
V/CameraHolder( 3737): open camera 0
V/StateManager( 3737): startState class com.android.gallery3d.app.FilmstripPage
I/AwesomePlayer(  125): setDataSource_l(URL suppressed)
D/dalvikvm( 3737): GC_CONCURRENT freed 479K, 8% free 8654K/9348K, paused 2ms+3ms
, total 26ms
I/AwesomePlayer(  125): setDataSource_l(URL suppressed)
I/CameraClient(  125): Opening camera 0
I/NvOmxCamera(  125): HAL_camera_device_open: open camera 0
E/        (  125): ioctl SetWhiteBalance failed: -1
E/NvOmxCameraSettingsParser(  125): Param type 70 not supported
I/NvOmxCamera(  125): HAL_camera_device_open: opened camera 0 (0x410cf728)
V/CAM_VideoModule( 3737): mDesiredPreviewWidth=704. mDesiredPreviewHeight=576
V/CAM_VideoModule( 3737): startPreview
W/Util    ( 3737): No picture size match the aspect ratio
V/CAM_VideoModule( 3737): Video snapshot size is 1280x720
I/CAM_ScreenNail( 3737): aspect ratio clamping disabled
I/CAM_ScreenNail( 3737): aspect ratio clamping enabled, surfaceTexture scale: 1.
0, 1.0
D/dalvikvm( 3737): GC_CONCURRENT freed 265K, 6% free 8880K/9348K, paused 1ms+2ms
, total 23ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 19K, 6% free 8869K/9348K, paused 24ms, tot
al 24ms
I/dalvikvm-heap( 3737): Grow heap (frag case) to 8.969MB for 262160-byte allocat
ion
D/dalvikvm( 3737): GC_FOR_ALLOC freed <1K, 6% free 9125K/9608K, paused 16ms, tot
al 16ms
D/libgps  (  430): proxy_gps_release_wakelock_cb()
D/CameraStorage( 3737): External storage state=mounted
V/CAM_VideoModule( 3737): mDesiredPreviewWidth=704. mDesiredPreviewHeight=576
V/CAM_VideoModule( 3737): startPreview
W/Util    ( 3737): No picture size match the aspect ratio
V/CAM_VideoModule( 3737): Video snapshot size is 1280x720
D/libEGL  ( 3737): loaded /system/lib/egl/libEGL_tegra.so
D/libEGL  ( 3737): loaded /system/lib/egl/libGLESv1_CM_tegra.so
D/libEGL  ( 3737): loaded /system/lib/egl/libGLESv2_tegra.so
D/OpenGLRenderer( 3737): Enabling debug mode 0
I/CAM_ScreenNail( 3737): preview layout size: 800/1205
I/CAM_ScreenNail( 3737): aspect ratio clamping enabled, surfaceTexture scale: 0.
8121827, 1.0
I/GLRootView( 3737): onSurfaceChanged: 800x1205, gl10: com.google.android.gles_j
ni.GLImpl@42195c38
I/GLRootView( 3737): layout content pane 800x1205 (compensation 0)
D/PhotoView( 3737): compensation = 0, CameraRelativeFrame = Rect(0, 0 - 0, 0), m
CameraRect = Rect(0, 0 - 0, 0)
D/dalvikvm( 3737): GC_FOR_ALLOC freed 213K, 4% free 9322K/9700K, paused 30ms, to
tal 30ms
I/ActivityManager(  430): Displayed com.google.android.gallery3d/com.android.cam
era.VideoCamera: +1s261ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 57K, 5% free 9309K/9700K, paused 26ms, tot
al 26ms
I/dalvikvm-heap( 3737): Grow heap (frag case) to 9.755MB for 635812-byte allocat
ion
D/dalvikvm( 3737): GC_FOR_ALLOC freed <1K, 4% free 9930K/10324K, paused 30ms, to
tal 30ms
D/dalvikvm(  678): GC_CONCURRENT freed 508K, 9% free 8665K/9436K, paused 31ms+2m
s, total 70ms
D/dalvikvm(  678): WAIT_FOR_CONCURRENT_GC blocked 26ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed <1K, 4% free 9931K/10324K, paused 29ms, to
tal 29ms
D/dalvikvm( 3737): GC_CONCURRENT freed 57K, 4% free 10480K/10816K, paused 17ms+6
ms, total 57ms
D/dalvikvm( 3737): WAIT_FOR_CONCURRENT_GC blocked 30ms
D/libgps  (  430): proxy_gps_inject_location()
D/dalvikvm( 3737): GC_FOR_ALLOC freed 622K, 9% free 10479K/11440K, paused 32ms,
total 32ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 676K, 10% free 10390K/11440K, paused 20ms,
 total 20ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed <1K, 4% free 11011K/11440K, paused 20ms, t
otal 20ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed 676K, 9% free 10923K/11932K, paused 20ms,
total 20ms
D/dalvikvm( 3737): GC_FOR_ALLOC freed <1K, 4% free 11544K/11932K, paused 18ms, t
otal 18ms
V/CAM_VideoModule( 3737): closeCamera
V/CAM_VideoModule( 3737): Closing effects
D/CAM_VideoModule( 3737): Effects are already closed. Nothing to do
D/        (  125): Camera fd open as: 122
E/NvOmxCamera(  125): OMX_ERRORTYPE android::NvOmxCamera::getCameraStereoMode(Nv
xComponent*, NvOmxCameraUserStereoMode&): Error: invalid NVX mode 0.
E/NvOmxCamera(  125): OMX_ERRORTYPE android::NvOmxCamera::getCameraStereoModeAnd
CaptureInfo(NvxComponent*, NvOmxCameraUserStereoMode&, NVX_STEREOCAPTUREINFO&):
getCameraStereoMode failed with 0x00000000
D/        (  125): Camera fd close (MI1040)
E/NvOmxCamera(  125): Already called release()
I/CameraClient(  125): Destroying camera 0
W/NvOmxCamera(  125): Already called release()
W/dalvikvm( 3737): threadid=22: thread exiting with uncaught exception (group=0x
418ee700)
W/AudioFlinger(  125): session id 37 not found for pid 125
W/AudioFlinger(  125): session id 38 not found for pid 125
E/AndroidRuntime( 3737): FATAL EXCEPTION: Thread-292
E/AndroidRuntime( 3737): java.lang.RuntimeException: startPreview failed
E/AndroidRuntime( 3737):        at com.android.camera.VideoModule.startPreview(V
ideoModule.java:867)
E/AndroidRuntime( 3737):        at com.android.camera.VideoModule.access$800(Vid
eoModule.java:73)
E/AndroidRuntime( 3737):        at com.android.camera.VideoModule$5.run(VideoMod
ule.java:773)
E/AndroidRuntime( 3737):        at java.lang.Thread.run(Thread.java:841)
E/AndroidRuntime( 3737): Caused by: android.view.ViewRootImpl$CalledFromWrongThr
eadException: Only the original thread that created a view hierarchy can touch i
ts views.
E/AndroidRuntime( 3737):        at android.view.ViewRootImpl.checkThread(ViewRoo
tImpl.java:5908)
E/AndroidRuntime( 3737):        at android.view.ViewRootImpl.invalidateChildInPa
rent(ViewRootImpl.java:869)
E/AndroidRuntime( 3737):        at android.view.ViewGroup.invalidateChild(ViewGr
oup.java:4250)
E/AndroidRuntime( 3737):        at android.view.View.invalidate(View.java:10539)

E/AndroidRuntime( 3737):        at android.view.View.setEnabled(View.java:5865)
E/AndroidRuntime( 3737):        at com.android.camera.VideoUI.enableShutter(Vide
oUI.java:341)
E/AndroidRuntime( 3737):        at com.android.camera.VideoModule.onPreviewStart
ed(VideoModule.java:884)
E/AndroidRuntime( 3737):        at com.android.camera.VideoModule.startPreview(V
ideoModule.java:858)
E/AndroidRuntime( 3737):        … 3 more
W/ActivityManager(  430):   Force finishing activity com.google.android.gallery3
d/com.android.camera.VideoCamera
D/dalvikvm(  430): GC_FOR_ALLOC freed 687K, 14% free 15124K/17400K, paused 71ms,
 total 71ms
D/dalvikvm(  430): GC_FOR_ALLOC freed 49K, 12% free 15321K/17400K, paused 60ms,
total 60ms
I/dalvikvm-heap(  430): Grow heap (frag case) to 15.265MB for 251120-byte alloca
tion
D/dalvikvm(  430): GC_FOR_ALLOC freed <1K, 12% free 15566K/17648K, paused 57ms,
total 57ms
I/WindowManager(  430): Screenshot Window{4267b3d8 u0 com.google.android.gallery
3d/com.android.camera.VideoCamera} was all black! mSurfaceLayer=21025 minLayer=2
1025 maxLayer=21025
D/dalvikvm(  430): GC_FOR_ALLOC freed 519K, 15% free 15048K/17648K, paused 58ms,
 total 58ms
V/CAM_VideoModule( 3737): closeCamera
D/CAM_VideoModule( 3737): already stopped.
V/CAM_VideoModule( 3737): Releasing media recorder.
I/AwesomePlayer(  125): setDataSource_l(URL suppressed)
W/MediaPlayer( 3453): mediaplayer went away with unhandled events
W/MediaPlayer( 3453): mediaplayer went away with unhandled events
D/libgps  (  430): proxy_gps_set_position_mode()
W/libc    ( 3453): pthread_create sched_setscheduler call failed: Operation not
permitted


NOTE: Two links regarding why iOS can’t playback the low/medium quality android 3gp videos (which have AMR Narrowband audio encoding) –

http://stackoverflow.com/questions/5083958/which-audio-format-can-be-recorded-and-played-back-by-iphone-and-android

http://stackoverflow.com/questions/6758167/about-amr-audio-file-playing-issue-on-different-devices

The second link suggests it’s possible to customize the videos audio encoder to “AMR_WB” or “AAC” (which it looks like might be compatible in ios).