24

I am working on a video sharing project and wonder what if there's a video format that is compatible with most players on Web, Android & iOS.

The app will work like this:

  1. users can take videos from mobile devices (iOS and Android)
  2. other users can play videos on mobile devices (iOS and Android) and web browsers.

I am not familiar with different video formats. I noticed that .mov and .mp4 are used in iOS. But I assume .mov cannot be played on Android and web browsers except Safari? Could anyone give a hint?

0

2 Answers 2

46

From Android Developer - Supported media formats,

Type  | Format /  | Supported File Type(s) /
      | Codec     | Container Formats
------+-----------+----------------------------------------------------------
Video | H.263     | 3GPP     (.3gp)
      |           | MPEG-4   (.mp4)
      +-----------+----------------------------------------------------------
      | H.264 AVC | 3GPP     (.3gp)
      |           | MPEG-4   (.mp4)
      |           | MPEG-TS  (.ts, AAC audio only, not seekable, Android 3.0+)
      +-----------+----------------------------------------------------------
      | H.265 HEVC| MPEG-4   (.mp4, Android 5.0+)
      +-----------+------------------------------------------------------
      | MPEG-4 SP | 3GPP     (.3gp)
      +-----------+----------------------------------------------------------
      | VP8       | WebM     (.webm)
      |           | Matroska (.mkv, Android 4.0+)
      +-----------+----------------------------------------------------------
      | VP9       | WebM     (.webm)
      |           | Matroska (.mkv, Android 4.0+)

On the other hand, from iOS Developer Library - Media Layer,

iOS supports many industry-standard video formats and compression standards, including the following:

  • H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats

  • H.264 video, up to 768 Kbps, 320 by 240 pixels, 30 frames per second, Baseline Profile up to Level 1.3 with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats

  • MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48 kHz, stereo audio in .m4v, .mp4, and .mov file formats

  • Numerous audio formats, including the ones listed in Audio Technologies

Also, from MDN - Media formats supported by the HTML audio and video elements (<video> tag in HTML5),

  • <video>: VP8 and Vorbis in WebM
  • <video>: VP9 and Opus in WebM
  • <video>: Streaming WebM via MSE
  • <video>: Theora and Vorbis in Ogg
  • <video>: H.264 and MP3 in MP4
  • <video>: H.264 and AAC in MP4
  • <video>: FLAC in MP4

From all data, it seems that .mp4 (to be exact, H.264 video, AAC audio, in MPEG-4) is the choice here, since it's supported in all platforms (iOS, Android, web browser). However, take note that you still have to check for compatibility issues on each platform (different version of Android, different web browser), which is explained on each site.

1
  • hi.. i suppose there is no encoder available for HEVC on Android as of now. So that means one cannot encode using HEVC. Only a decoder is available. Please correct me if I am wrong @Andrew T Mar 31, 2016 at 16:59
1

Adding more info from Andrew T.'s answer.

To set the parameters from Andrew's conclusion:

// To Set Audio Encoder: AAC
mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);

// To set Video Encoder: H264
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);

// To set Output Video format: mp4
mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);

Hope it helps...!!!

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.