/**
  * Read FFMPEG metadata from the object if it exists
  *
  * @param object: The object to extract data from
  */
 private void readMetadata(DigitalObject object) {
   Set<String> pids = object.getPayloadIdList();
   if (pids.contains(METADATA_PAYLOAD)) {
     try {
       Payload payload = object.getPayload(METADATA_PAYLOAD);
       JsonConfigHelper data = new JsonConfigHelper(payload.open());
       payload.close();
       oldMetadata = data.getJsonMap("outputs");
       // for (String k : oldMetadata.keySet()) {
       // log.debug("\n====\n{}\n===\n{}", k, oldMetadata.get(k));
       // }
     } catch (IOException ex) {
       log.error("Error parsing metadata JSON: ", ex);
     } catch (StorageException ex) {
       log.error("Error accessing metadata payload: ", ex);
     }
   }
 }
 /**
  * Stream data from specified payload into a file in our temp cache.
  *
  * @param object: The digital object to use
  * @param pid: The payload ID to extract
  * @return File: The cached File
  * @throws FileNotFoundException: If accessing the cache fails
  * @throws StorageException: If accessing the object in storage fails
  * @throws IOException: If the data copy fails
  */
 private File cacheFile(DigitalObject object, String pid)
     throws FileNotFoundException, StorageException, IOException {
   // Get our cache location
   File file = new File(outputDir, pid);
   FileOutputStream tempFileOut = new FileOutputStream(file);
   // Get payload from storage
   Payload payload = object.getPayload(pid);
   try {
     // Copy to cache
     IOUtils.copy(payload.open(), tempFileOut);
   } catch (IOException ex) {
     payload.close();
     throw ex;
   }
   // Close and return
   payload.close();
   tempFileOut.close();
   return file;
 }