2

I had the same problem as here which I thought was because the files (recorded on iOS) were encoded as .mov instead of .mp4.

I then changed the encoding mechanism on my iOS app to encode them as mp4, and I'm still seeing the same problem.

When I load the file with

File videoFile = ...;
videoView.setVideoPath(videoFile.getAbsolutePath());
videoView.start();

I get E/MediaPlayer(2069): error (1, -2147483648).

When I load the file with the following (from the link above).

Uri uri = Uri.parse(VideoProvider.CONTENT_URI_BASE + Uri.encode(videoFile.getAbsolutePath()));
videoView.setVideoURL(url);
videoView.start();

I get this in logcat

07-17 08:05:58.283: W/VideoView(2276): Unable to open content: content://com.companyname.VideoProvider.files.files/%2Fdata%2Fdata%2Fcom.companyname.myappname%2Fcache%2FiX0mXVPxih.mp4
07-17 08:05:58.283: W/VideoView(2276): java.io.IOException: setDataSource failed.: status=0x80000000

ffmpeg tells me the following about the media file:

ffmpeg -i media.mp4
ffmpeg version 2.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 26 2014 15:29:01 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libavresample   1.  2.  0 /  1.  2.  0
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'media.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp41mp42isom
    creation_time   : 2014-07-17 08:59:24
  Duration: 00:00:08.14, start: 0.000000, bitrate: 1084 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 360x480, 1027 kb/s, 24.46 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2014-07-17 08:59:24
      handler_name    : Core Media Video
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 62 kb/s (default)
      Metadata:
        creation_time   : 2014-07-17 08:59:24
        handler_name    : Core Media Audio

Any idea why this file might be failing to load?

EDIT: Seems that this is mostly an issue when running in the emulator, but on a device I seem to have succeeded it getting it to work if I use a SurfaceView and MediaPlayer instead of VideoView.

Community
  • 1
  • 1
Liron
  • 2,012
  • 19
  • 39
  • Download that file & add it in assets folder. Try to access it & play it using asset manager. Check whether it works, if no then you will get to know issue. – VVB Jul 17 '14 at 12:37
  • look at this http://stackoverflow.com/q/4795104/1056359 – thepoosh Jul 17 '14 at 13:08
  • @thepoosh I'm trying to figure out what's wrong with my file format? I thought the issue was that it was a .mov instead of .mp4, but when I hanged my encoding on iOS to be .mp4 I still get the same problem. – Liron Jul 17 '14 at 13:19
  • Based on some other links, I'm wondering if the issue is that the h264 profile is "Main" and not Baseline. – Liron Jul 17 '14 at 13:32

1 Answers1

0

Are your sure that the file is actually found on the device? Could u try the following if you have not already:

File videoFile = ...;
if(videoFile.exists){
   videoView.setVideoPath(videoFile.getAbsolutePath());
   videoView.start();
}else{
   Log.e("Video file not found :(!");
}
Julian Pieles
  • 3,880
  • 2
  • 23
  • 33
  • Yes, I'm sure it's there. I see it in the DDMS, and I'm using that code to check whether or not to download the video from the server anyway. – Liron Jul 17 '14 at 13:04
  • Okay. I don't know which android version you are using. Make sure the android version is compatible with your media encoding: http://developer.android.com/guide/appendix/media-formats.html – Julian Pieles Jul 17 '14 at 16:33