Opened 11 years ago

Closed 11 years ago

#1926 closed enhancement (fixed)

EXIF metadata is not extracted

Reported by: mbradshaw Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: mjpeg metadata
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by mbradshaw)

Summary of the bug:
Checking metadata in AVFormatContext, AVStream, and AVFrame, there is no metadata. However, the image surely has EXIF metadata associated with it. I'm particularly interested in getting the Orientation tag, but all of it would be nice.

Image was taken with a Canon PowerShot A1000IS. I can provide more samples if needed. Download link for file is https://docs.google.com/uc?export=download&id=0BxWx_dIBnyRodEJsNW1FLVZ0blU (5.9MB)

How to reproduce:
Here is the ffprobe output (when using my own program, I can see metadata is clearly empty):

$ ffprobe -show_frames -show_streams -show_format -show_packets 0.jpg 
ffprobe version 1.0.git Copyright (c) 2007-2012 the FFmpeg developers
  built on Nov 17 2012 09:15:28 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration: 
  libavutil      52.  7.100 / 52.  7.100
  libavcodec     54. 71.100 / 54. 71.100
  libavformat    54. 36.100 / 54. 36.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.100 /  3. 23.100
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
[image2 @ 0x7fa0e900f200] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, image2, from '0.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj422p, 3648x2736, 25 tbr, 25 tbn, 25 tbc
[PACKET]
codec_type=video
stream_index=0
pts=0
pts_time=0.000000
dts=0
dts_time=0.000000
duration=1
duration_time=0.040000
convergence_duration=N/A
convergence_duration_time=N/A
size=5901736
pos=N/A
flags=K
[/PACKET]
[FRAME]
media_type=video
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=N/A
width=3648
height=2736
pix_fmt=yuvj422p
sample_aspect_ratio=N/A
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
reference=0
[/FRAME]
[STREAM]
index=0
codec_name=mjpeg
codec_long_name=MJPEG (Motion JPEG)
profile=unknown
codec_type=video
codec_time_base=1/25
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=3648
height=2736
has_b_frames=0
sample_aspect_ratio=0:1
display_aspect_ratio=0:1
pix_fmt=yuvj422p
level=-99
timecode=N/A
id=N/A
r_frame_rate=25/1
avg_frame_rate=0/0
time_base=1/25
start_pts=0
start_time=0.000000
duration_ts=1
duration=0.040000
bit_rate=N/A
nb_frames=N/A
nb_read_frames=1
nb_read_packets=1
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
[/STREAM]
[FORMAT]
filename=0.jpg
nb_streams=1
format_name=image2
format_long_name=image2 sequence
start_time=0.000000
duration=0.040000
size=N/A
bit_rate=N/A
[/FORMAT]

And here is the output from exiftool:

./exiftool ~/Pixio/prototype/assets/0.jpg 
ExifTool Version Number         : 9.06
File Name                       : 0.jpg
Directory                       : /Users/mjbshaw/Pixio/prototype/assets
File Size                       : 5.6 MB
File Modification Date/Time     : 2011:08:01 18:53:00-06:00
File Access Date/Time           : 2012:11:17 09:18:38-07:00
File Permissions                : rwxrwxrwx
File Type                       : JPEG
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Image Description               : 
Make                            : Canon
Camera Model Name               : Canon PowerShot A1000 IS
Orientation                     : Rotate 90 CW
X Resolution                    : 180
Y Resolution                    : 180
Resolution Unit                 : inches
Modify Date                     : 2011:08:01 17:53:01
Y Cb Cr Positioning             : Co-sited
Exposure Time                   : 1/60
F Number                        : 2.7
ISO                             : 200
Exif Version                    : 0221
Date/Time Original              : 2011:08:01 17:53:01
Create Date                     : 2011:08:01 17:53:01
Components Configuration        : Y, Cb, Cr, -
Compressed Bits Per Pixel       : 5
Shutter Speed Value             : 1/60
Aperture Value                  : 2.7
Max Aperture Value              : 2.7
Flash                           : Auto, Fired
Focal Length                    : 6.2 mm
Macro Mode                      : Normal
Self Timer                      : Off
Quality                         : Superfine
Canon Flash Mode                : Auto
Continuous Drive                : Single
Focus Mode                      : Single
Record Mode                     : JPEG
Canon Image Size                : Large
Easy Mode                       : Manual
Digital Zoom                    : None
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : 0
Camera ISO                      : Auto
Metering Mode                   : Evaluative
Focus Range                     : Auto
AF Point                        : Auto AF point selection
Canon Exposure Mode             : Program AE
Lens Type                       : Unknown (-1)
Max Focal Length                : 24.8 mm
Min Focal Length                : 6.2 mm
Focal Units                     : 1000/mm
Max Aperture                    : 2.7
Min Aperture                    : 8
Flash Bits                      : E-TTL, Built-in
Focus Continuous                : Single
AE Setting                      : Normal AE
Image Stabilization             : On
Display Aperture                : 2.7
Zoom Source Width               : 3648
Zoom Target Width               : 3648
Spot Metering Mode              : Center
Manual Flash Output             : n/a
Focal Type                      : Zoom
Focal Plane X Size              : 6.27 mm
Focal Plane Y Size              : 4.70 mm
Auto ISO                        : 200
Base ISO                        : 100
Measured EV                     : 6.22
Target Aperture                 : 2.7
Target Exposure Time            : 1/60
Exposure Compensation           : 0
White Balance                   : Cloudy
Slow Shutter                    : Off
Shot Number In Continuous Burst : 0
Optical Zoom Code               : 0
Flash Guide Number              : 5.28125
Flash Exposure Compensation     : 0
Auto Exposure Bracketing        : Off
AEB Bracket Value               : 0
Control Mode                    : Camera Local Control
Focus Distance Upper            : 2.63 m
Focus Distance Lower            : 0 m
Bulb Duration                   : 0
Camera Type                     : Compact
Auto Rotate                     : Rotate 90 CW
ND Filter                       : Off
Self Timer 2                    : 0
Flash Output                    : 77
Canon Image Type                : IMG:PowerShot A1000 IS JPEG
Canon Firmware Version          : Firmware Version 1.00
File Number                     : 260-0864
Owner Name                      : 
Rotation                        : 90
Camera Temperature              : 25 C
Canon Model ID                  : PowerShot A1000 IS
AF Area Mode                    : Multi-point AF or AI AF
Num AF Points                   : 9
Valid AF Points                 : 9
Canon Image Width               : 3648
Canon Image Height              : 2736
AF Image Width                  : 100
AF Image Height                 : 100
AF Area Widths                  : 18 18 18 18 18 18 18 18 18
AF Area Heights                 : 18 18 18 18 18 18 18 18 18
AF Area X Positions             : -18 0 18 -18 0 18 -18 0 18
AF Area Y Positions             : -18 -18 -18 0 0 0 18 18 18
AF Points In Focus              : 4,5
Primary AF Point                : 4
Thumbnail Image Valid Area      : 0 0 0 0
Date Stamp Mode                 : Off
My Color Mode                   : Vivid
Firmware Revision               : 1.00 rev 2.00
Categories                      : (none)
Intelligent Contrast            : n/a
Image Unique ID                 : 1c1b916506dd6a144dfbaabc4abb85c4
VRD Offset                      : 0
User Comment                    : 
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 3648
Exif Image Height               : 2736
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Related Image Width             : 3648
Related Image Height            : 2736
Focal Plane X Resolution        : 15136.92946
Focal Plane Y Resolution        : 15116.0221
Focal Plane Resolution Unit     : inches
Sensing Method                  : One-chip color area
File Source                     : Digital Camera
Custom Rendered                 : Normal
Exposure Mode                   : Auto
Digital Zoom Ratio              : 1
Scene Capture Type              : Standard
Compression                     : JPEG (old-style)
Thumbnail Offset                : 5120
Thumbnail Length                : 5992
Image Width                     : 3648
Image Height                    : 2736
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Aperture                        : 2.7
Flash Exposure Compensation     : 0
Drive Mode                      : Single-frame Shooting
Flash Type                      : Built-In Flash
Image Size                      : 3648x2736
Lens                            : 6.2 - 24.8 mm
Lens ID                         : Unknown 6-24mm
Red Eye Reduction               : Off
Scale Factor To 35 mm Equivalent: 5.5
Shooting Mode                   : Program AE
Shutter Curtain Sync            : 1st-curtain sync
Shutter Speed                   : 1/60
Thumbnail Image                 : (Binary data 5992 bytes, use -b option to extract)
Circle Of Confusion             : 0.005 mm
Field Of View                   : 55.5 deg
Focal Length                    : 6.2 mm (35 mm equivalent: 34.2 mm)
Hyperfocal Distance             : 2.62 m
Lens                            : 6.2 - 24.8 mm (35 mm equivalent: 34.2 - 136.9 mm)
Light Value                     : 7.8

Attachments (1)

jpeg_orientaton.zip (61.2 KB ) - added by DonMoir 11 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by mbradshaw, 11 years ago

Description: modified (diff)

comment:2 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavcodec
Keywords: mjpeg metadata added
Priority: normalwish
Reproduced by developer: set
Status: newopen
Type: defectenhancement

comment:3 by DonMoir, 11 years ago

I attached 8 sample jpegs in jpeg_orientaton.zip that represent flipped x, y and rotated.

Pictures taken with camera in landscape mode or however can be flipped or rotated and becoming more common.

I cannot use ffmpeg for jpegs because of this and some jpegs are not decoded right in ffmpeg last I checked. I see some work is being done for jpegs and will recheck when I get the chance.

Just need the metadata and no need for ffmpeg to flip or rotate.

Last edited 11 years ago by DonMoir (previous) (diff)

by DonMoir, 11 years ago

Attachment: jpeg_orientaton.zip added

comment:4 by Elon Musk, 11 years ago

Resolution: fixed
Status: openclosed

This appears to be fixed in bb4e1b4cf910af0de2bc884c75544603c40010cc.

Note: See TracTickets for help on using tickets.