title: Converting Video for Android using FFMPEG
body: <p>What i am trying to do is convert video into mp4 format that will play in Android.</p>
  
  <p>I've gone through <a href="http://developer.android.com/guide/appendix/media-formats.html" rel="noreferrer">http://developer.android.com/guide/appendix/media-formats.html</a></p>
  
  <p>I am setting the following options</p>
  
  <pre><code>-vcodec libx264 -vprofile baseline -acodec libfaac -ar 44100 -ac 1 -ab 128k 
  </code></pre>
  
  <p>yet I get the error message "Sorry, This Video is not valid for streaming to this device"</p>
  
  <p>I Played the video in android browser using videoJS <a href="http://video-js.zencoder.com/oceans-clip.mp4" rel="noreferrer">http://video-js.zencoder.com/oceans-clip.mp4</a> and it WORKS fine.</p>
  
  <p>I download the video oceans-clip.mp4 and tried to convert using minimalist options </p>
  
  <pre><code>-y -i working.mp4 -vprofile baseline pleasework.mp4
  </code></pre>
  
  <p>yet I get the same error message.</p>
  
  <p>The following is the FFMPEG info dump of the video files</p>
  
  <p><strong>Working.mp4</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; ffmpeg version N-40229-g24e3f44-syslint Copyright (c) 2000-2012 the FFmpeg developers
      [1] =&gt;   built on Apr 29 2012 22:01:41 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
      [2] =&gt;   configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint
      [3] =&gt;   libavutil      51. 48.100 / 51. 48.100
      [4] =&gt;   libavcodec     54. 17.101 / 54. 17.101
      [5] =&gt;   libavformat    54.  3.100 / 54.  3.100
      [6] =&gt;   libavdevice    53.  4.100 / 53.  4.100
      [7] =&gt;   libavfilter     2. 72.100 /  2. 72.100
      [8] =&gt;   libswscale      2.  1.100 /  2.  1.100
      [9] =&gt;   libswresample   0. 11.100 /  0. 11.100
      [10] =&gt;   libpostproc    52.  0.100 / 52.  0.100
      [11] =&gt; Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'working.mp4':
      [12] =&gt;   Metadata:
      [13] =&gt;     major_brand     : isom
      [14] =&gt;     minor_version   : 1
      [15] =&gt;     compatible_brands: isomavc1
      [16] =&gt;     creation_time   : 2010-05-18 04:24:00
      [17] =&gt;   Duration: 00:00:46.54, start: 0.000000, bitrate: 3342 kb/s
      [18] =&gt;     Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x264 [SAR 132:133 DAR 320:133], 3195 kb/s, SAR 127:128 DAR 635:264, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
      [19] =&gt;     Metadata:
      [20] =&gt;       creation_time   : 2010-05-18 04:24:00
      [21] =&gt;       handler_name    : GPAC ISO Video Handler
      [22] =&gt;     Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 144 kb/s
      [23] =&gt;     Metadata:
      [24] =&gt;       creation_time   : 2010-05-18 04:24:01
      [25] =&gt;       handler_name    : GPAC ISO Audio Handler
      [26] =&gt; At least one output file must be specified
  )
  </code></pre>
  
  <p><strong>Not Working.mp4</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; ffmpeg version N-40229-g24e3f44-syslint Copyright (c) 2000-2012 the FFmpeg developers
      [1] =&gt;   built on Apr 29 2012 22:01:41 with gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
      [2] =&gt;   configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint
      [3] =&gt;   libavutil      51. 48.100 / 51. 48.100
      [4] =&gt;   libavcodec     54. 17.101 / 54. 17.101
      [5] =&gt;   libavformat    54.  3.100 / 54.  3.100
      [6] =&gt;   libavdevice    53.  4.100 / 53.  4.100
      [7] =&gt;   libavfilter     2. 72.100 /  2. 72.100
      [8] =&gt;   libswscale      2.  1.100 /  2.  1.100
      [9] =&gt;   libswresample   0. 11.100 /  0. 11.100
      [10] =&gt;   libpostproc    52.  0.100 / 52.  0.100
      [11] =&gt; Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pleasework.mp4':
      [12] =&gt;   Metadata:
      [13] =&gt;     major_brand     : isom
      [14] =&gt;     minor_version   : 512
      [15] =&gt;     compatible_brands: isomiso2avc1mp41
      [16] =&gt;     creation_time   : 2010-05-18 04:24:00
      [17] =&gt;     encoder         : Lavf54.3.100
      [18] =&gt;   Duration: 00:00:46.54, start: 0.000000, bitrate: 1843 kb/s
      [19] =&gt;     Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x264 [SAR 127:128 DAR 635:264], 1715 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
      [20] =&gt;     Metadata:
      [21] =&gt;       creation_time   : 2010-05-18 04:24:00
      [22] =&gt;       handler_name    : VideoHandler
      [23] =&gt;     Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 124 kb/s
      [24] =&gt;     Metadata:
      [25] =&gt;       creation_time   : 2010-05-18 04:24:00
      [26] =&gt;       handler_name    : SoundHandler
      [27] =&gt; At least one output file must be specified
  )
  </code></pre>
  
  <p>The metadata looks almost the same yet it doesn't seem to play in android. Any help appreciated.</p>