Store value in file entity field using a form
I posted this on drupal.org (https://drupal.org/node/1820706) and got an answer that works. I have to replace
$image->field_caption[0]['value'] = $caption; with $image->field_caption[LANGUAGE_NONE][0]['value'] = $caption;