Galaxy Nexus pictures won't show

For help and support with PS3 Media Server in general
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply.

Galaxy Nexus pictures won't show

Postby vinnycthatwhoibe » Mon May 28, 2012 4:08 am

Recently I got a new phone (Samsung Galaxy Nexus) and it appears PS3 media server refuses to acknowledge any pictures that I take using it. It just says "no there are no images". No error, no broken icon links or anything. I can put any picture from any other camera in the same folder and it will show up just fine, so I know it's not a problem with folder depth. The pictures aren't named anything crazy, and the extensions are all ".jpg" Everything shows up fine on my computer obviously, and comparing the files via MediaInfo does not show any oddities. There are also no strange NTFS permission issues with the images that don't work (I've got an MCSA and am fairly familiar with getting all that crap setup).

The Galaxy Nexus is set to take pics at 5mp (2592x1944). I haven't yet tried a smaller size, but I guess I'll be trying that next. This is a very odd issue. Oh, and videos that I take with the phone show up fine as well, even in the same folder. And of course, yes I am selecting the correct icon on the PS3 Ribbon for picture or video depending on the media I'm trying to view.

Anybody else experience this or have any ideas? I'm really confused here.
vinnycthatwhoibe
 
Posts: 1
Joined: Mon May 28, 2012 3:57 am

Re: Galaxy Nexus pictures won't show

Postby Tattva » Wed Oct 31, 2012 10:51 pm

Anybody else experience this or have any ideas? I'm really confused here.


I'm seeing the same thing. The "Traces" tab on the GUI shows the log of the process, and it has this message for all galaxy nexus photos:

INFO 2012-10-31 08:52:57.993 [Library Scanner] The file /library/photos/2012/08_August/IMG_20120819_151347.jpg was badly parsed. It will be hidden

I edited the image (reduced its size significantly) in gimp and re-saved it, keeping the exif data, but it still had a parse error after re-scanning the shared folders. When I saved it without exif data, no error showed up in the log after re-scanning the shared folders.

Based on that test, my best guess is that there's some new exif tag or a change in format to an existing exif tag that the exif library used by the PMS chokes on.

In case someone with knowledge of the code base happens to see this thread, attached is an example failed file, some lovely cacti outside of Phoenix. This is the gimp-edited image (with exif data) that still fails to be parsed.

gnexus_parse_test.jpg
file that fails to be parsed by pms
gnexus_parse_test.jpg (190.66 KiB) Viewed 516 times
Tattva
 
Posts: 3
Joined: Wed Oct 31, 2012 10:32 pm

Re: Galaxy Nexus pictures won't show

Postby Tattva » Thu Nov 01, 2012 7:49 am

Okay, I looked through the source code to the project and I think I've found the problem. DLNAMediaInfo#parse() expects the ISO value to be a scalar, but it is a list of values in the exif data for the galaxy nexus, resulting in a string parsing error. This is the offending line:

Code: Select all
                        setIso(tf.getIntValue());


Until that line is fixed, you can work around this by fixing the data so that it is compatible with PMS.

This python script is an example of a data fix for galaxy nexus images (it removes the ISO information from a single image):

Code: Select all
#! /usr/bin/python
import pyexiv2
import sys


def _main(argv):
  image = pyexiv2.ImageMetadata(argv[1])
  image.read()
  del image['Exif.Photo.ISOSpeedRatings']
  image.write()
  print reduce(lambda coll, next: "%s\n%s=%s" % (coll, next[0], next[1].value), image.items())


if __name__ == '__main__':
  _main(sys.argv)


Looks like this isn't the only project tripped up by Android devices using a list of values as opposed to a scalar for ISOSpeedRatings: https://core.trac.wordpress.org/ticket/20807. I took a look at some IPhone photos and they use a scalar in their EXIF Data for this tag, for example.

The EXIF specification says that ISO Speed Ratings can be an array; search for "ISO Speed Ratings" and observe the "ANY" value in the "Count" column in Table 4: http://www.exif.org/Exif2-1.PDF

Obviously it isn't awesome to lose valuable metadata about your images. The real solution is to fix PMS. I'm new to the FOSS community, so I'm not familiar with how to fix FOSS software or submit defects against FOSS projects. Any advice would be appreciated.
Tattva
 
Posts: 3
Joined: Wed Oct 31, 2012 10:32 pm

Re: Galaxy Nexus pictures won't show

Postby Raptor399 » Thu Nov 01, 2012 11:13 am

Tattva wrote:The EXIF specification says that ISO Speed Ratings can be an array; search for "ISO Speed Ratings" and observe the "ANY" value in the "Count" column in Table 4: http://www.exif.org/Exif2-1.PDF

Obviously it isn't awesome to lose valuable metadata about your images. The real solution is to fix PMS. I'm new to the FOSS community, so I'm not familiar with how to fix FOSS software or submit defects against FOSS projects. Any advice would be appreciated.

Making a post like this works like a charm, thank you. :-)

Fix committed, it will be in the next release. The fix could be improved by picking the correct value instead of the first.
Raptor399
Project Member
 
Posts: 1916
Joined: Thu Mar 10, 2011 12:06 am

Re: Galaxy Nexus pictures won't show

Postby Tattva » Thu Nov 01, 2012 9:35 pm

Raptor399 wrote:Making a post like this works like a charm, thank you. :-)

Fix committed, it will be in the next release. The fix could be improved by picking the correct value instead of the first.


Thanks for the quick turnaround!

In case anyone else runs into this, below is a more complete script that scans a directory tree and creates sanitized copies of all incompatible files, leaving the original files in place. Should make it easy to later delete the sanitized versions when PMS supports the originals. The script works on my machine, but it does require a couple of third-party python modules, so it's not trivial to use as-is for newbies.

Code: Select all
#! /usr/bin/python
""" Script that creates 'sanitized' copies of Galaxy Nexus jpeg's.

The Galaxy Nexus phone's default camera app puts an array of values
into the ISO EXIF Tag, and some applications can't handle that. This
script creates copies in the same directory with the name
    <basename>_isoremoved<extension>

Requires the gflags and pyexiv2 third-party python libraries
"""

import gflags
import logging
import os.path
import pyexiv2
import shutil
import sys

gflags.DEFINE_string('search_dir', None, 'Directory of media library')
gflags.MarkFlagAsRequired('search_dir')
FLAGS = gflags.FLAGS

def _create_parsable_gnexus_copies(search_dir):
  """ Walk a directory tree, finding photos that have arrays for ISO EXIF
  data, and make ISO-free copies.
 
  Useful for the PS3 Media Server, which currently cannot parse (and
  therefore serve) files with array ISO EXIF data. """
  paths = os.walk(search_dir)
  for (dirpath, _, filenames) in paths:
    for filename in filenames:
      filepath = os.path.join(dirpath, filename)
      prefix, suffix = os.path.splitext(filepath)
      is_array = _is_array_iso(filepath)
      if is_array:
        sanitized_filepath = os.path.join(dirpath, '%s_isoremoved%s'
                                          % (prefix, suffix))
        if not os.path.exists(sanitized_filepath):
          logging.info('Sanitizing %s to %s.', filepath, sanitized_filepath)
          shutil.copy2(filepath, sanitized_filepath)
          image = pyexiv2.ImageMetadata(sanitized_filepath)
          image.read()
          del image['Exif.Photo.ISOSpeedRatings']
          image.write()


def _is_array_iso(filepath):
  """Returns a True if the photo contains an array of multiple ISO values.
  """
  try:
    image = pyexiv2.ImageMetadata(filepath)
    image.read()
    logging.debug('Photo has an ISO SPeed Ratings Tag of %s',
                 image['Exif.Photo.ISOSpeedRatings'].value)
    return len(image['Exif.Photo.ISOSpeedRatings'].value) != 1
  except Exception:
    return False


def _configure_logging():
  """Configures logging to stderr, file."""
  root = logging.getLogger('')
  handler = logging.StreamHandler(sys.stderr)
  formatter = logging.Formatter('%(asctime)s %(filename)s' +
                                ':%(lineno)d %(levelname)s %(message)s')
  handler.setFormatter(formatter)
  root.addHandler(handler)
  file_handler = logging.FileHandler('/var/tmp/fix_gnexus_exif.log')
  file_handler.setFormatter(formatter)
  root.addHandler(file_handler)
  root.setLevel(logging.INFO)


def _main(argv):
  """Main script entry point """
  try:
    argv = FLAGS(argv)  # parse flags
  except gflags.FlagsError, error:
    print '%s\nUsage: %s ARGS\n%s' % (error, sys.argv[0], FLAGS)
    sys.exit(1)
  try:
    _configure_logging()
    _create_parsable_gnexus_copies(FLAGS.search_dir)
  except Exception:
    logging.exception('An unexpected error occurred while fixing'
                      + ' Galaxy Nexus photos')
    raise

if __name__ == '__main__':
  _main(sys.argv)
Tattva
 
Posts: 3
Joined: Wed Oct 31, 2012 10:32 pm


Return to General Help and Support

Who is online

Users browsing this forum: Bing [Bot] and 13 guests