title: Reading JPEG in ffmpeg
body: <p>I'm trying to get ffmpeg to encode several individual JPEG images into a video on Android. I've successfully built it for Android (see the configuration string at the end of this post).</p>
  
  <p>I can encode an h.263+ video with randomly generated frame content, and ffmpeg otherwise appears to work well.</p>
  
  <p><a href="https://stackoverflow.com/questions/3527584/ffmpeg-jpeg-file-to-avframe">A similar question</a> suggests that the following code should be sufficient to load an image into an <code>AvFrame</code>:</p>
  
  <pre><code>// Make sure we have the codecs
  av_register_all();
  
  AVFormatContext *pFormatCtx;
  int ret = av_open_input_file(&amp;pFormatCtx, imageFileName, NULL, 0, NULL);
  
  if (ret != 0) {
      printf("Can't open image file '%s': code %d, %s",
          imageFileName, ret, strerror(AVERROR(ret)));
  }
  </code></pre>
  
  <p>The above returns the correct absolute file path and error:</p>
  
  <blockquote>
    <p>Failed '/sdcard/DCIM/Camera/IMG083.jpg': code -1094995529, Unknown error: 1094995529</p>
  </blockquote>
  
  <p>Incidentally, if I omit <code>av_register_all()</code>, it returns with error <strong>2</strong>.</p>
  
  <p>I've compiled ffmpeg with the following arguments:</p>
  
  <blockquote>
    <blockquote>
      <p>./configure --target-os=linux 
          --prefix=$PREFIX 
          --enable-cross-compile 
          --extra-libs="-lgcc" 
          --arch=arm 
          --cc=$PREBUILT/bin/arm-linux-androideabi-gcc 
          --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- 
          --nm=$PREBUILT/bin/arm-linux-androideabi-nm 
          --sysroot=$PLATFORM 
          --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums  -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " 
          --enable-shared 
          --enable-static 
          --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -nostdlib -lc -lm -ldl -llog" 
          --disable-everything 
          --enable-demuxer=mov 
          --enable-demuxer=h264 
          --disable-ffplay 
          --enable-protocol=file 
          --enable-avformat 
          --enable-avcodec 
          --enable-decoder=mjpeg 
          --enable-decoder=png 
          --enable-parser=h264 
          --enable-encoder=h263 
          --enable-encoder=h263p 
          --disable-network 
          --enable-zlib 
          --disable-avfilter 
          --disable-avdevice</p>
    </blockquote>
  </blockquote>
  
  <p>Any suggestions would be most welcome!</p>