Transloadit

Metadata

Many files contain interesting information about their contents. This is called "metadata". Transloadit automatically extracts this metadata for all uploaded, imported, and processed files.

At the very minimum, each file will have the information such as:

{
  "id": "ae52b7f8c1b3426e8c29ea0a9daf8306",
  "name": "straw-apple.jpg",
  "basename": "straw-apple",
  "ext": "jpg",
  "size": 92230,
  "mime": "image/jpeg",
  "type": "image",
  "field": "test_file",
  "url": "http://tmp.maynard.transloadit.com/upload/1324a798a99fce7f5f8289a95a74f02b.jpg",
  "original_id": "4af24fb2595f44809f3adc2f77bc9bfa",
  "meta": {
    // …
  }
}

The information we can extract depends on the media file, its type, but also who produced it. If it was an iPhone, there's probably latitude in there for geo-positioning. More common keys include height, and duration.

To see what information we can extract from files that you will throw at us, you could try one of our demos and inspect our response after uploading a file there.

id

A random and unique ID used internally by Transloadit to track the file.

name

The name of the file. Transloadit will change the extension used for this field if the file undergoes processing into a different format.

basename

The name of the file without the extension.

ext

The extension of the file.

size

The size of the file, in bytes.

mime

The determined MIME type for this file.

type

An abstract type describing the file, which can currently be "image", "video", "audio", or null.

field

The name of the form field used to submit this file.

url

The URL at which this file can be accessed. This is either a URL in your S3 bucket, or a temporary URL on our servers. Since temporary URLs expire after a few hours, you should make sure to move your files elsewhere unless you are using a storage robot.

original_id

The unique ID of the original upload file from which this file was generated. This is useful to determine which file of a multi-file upload was used to generate a given file, after several Steps of processing.

meta

An object containing additional metadata extracted from the file, as shown below.

Image Metadata

Although it depends on the file at hand, files whose mime type is image can typically contain data such as the following inside the meta property:

width

The width of the input image, in pixels.

height

The height of the input image, in pixels.

aspect_ratio

The aspect ratio of the image, which is its width divided by its height. Will be 0 if for some reason the image height is 0.

date_recorded

The date and time at which this image was taken, in the format YYYY/MM/DD HH:MM:SS TZ, such as "2010/06/30 22:16:06 GMT".

date_file_created

The creation time for the file system.

date_file_modified

The modification time for the file system.

title

The title of this image, such as "Tree".

keywords

An array of keywords for this image, such as ["tree", "nature"].

description

A description of this image, such as "This tree is very old.".

location

The location at which this image was taken, which is usually the street, such as "Zingster Str. 32".

creator

The creator that took the image.

author

The author that took the image. Some cameras populate this field as opposed to creator.

copyright

The copyright metadata field.

copyright_notice

The copyright notice metadata field.

city

The city in which this image was taken, such as "Berlin".

state

The state in which this image was taken, such as "Berlin".

country

The country in which this image was taken, such as "Germany".

country_code

The country code of the country in which this image was taken, such as "de".

aperture

The aperture setting for this image, such as 5.7.

exposure_compensation

The exposure compensation for this image, such as "+4/3".

exposure_mode

The exposure mode for this image, such as "Auto".

exposure_time

The exposure time for this image, such as "1/30".

flash

The flash settings for this image, such as "Off, Did not fire".

focal_length

The focal length for this image, such as "55.0 mm".

f_number

The f-number for this image, such as 5.6.

iso

The ISO value for this image, such as 800.

light_value

The light value for this image, such as 6.9.

metering_mode

The metering mode for this image, such as "Multi-segment".

shutter_speed

The shutter speed for this image, such as "1/32".

white_balance

The white balance setting for this image, such as "Manual".

device_name

The device name of the camera, such as "iPhone 3GS".

device_vendor

The camera manufacturer, such as "Apple".

device_software

The version of the device software for the camera, such as "3.1.2".

latitude

The latitude at which this image was taken, such as 52.5374.

longitude

The longitude at which this image was taken, such as 13.4034.

thumb_index

The index of the current thumbnail starting at 0. This key is only present for results of 🤖/video/thumbs.

thumb_offset

The offset for the current thumbnail, in seconds. This key is only present for results of 🤖/video/thumbs.

frame_count

The number of frames in an animated GIF file. This is 1 by default for all other image types.

colorspace

The colorspace of the image. This could be "sRGB" or "Gray" for instance. In Transloadit's first ImageMagick stack version, there's a bug which would make the colors used in an image determine its colorspace, and a grayscale colored image would report "Gray", even if saved as "RGB".

has_clipping_path

Is 1 if the image contains a clipping path, 0 otherwise.

average_color

Not to be confused with dominant color, that counts a single most occurring pixel color and has limited use cases. The average color is calculated by first scaling the input image to 1 pixel.

has_transparency

Returns true for images that have transparent areas. This key is only returned if you set output_meta.has_transparency to true.

dominant_colors

Returns an array of the 20 most used colors for images. This key is only returned if you set output_meta.dominant_colors to true.

Video Metadata

Although it depends on the file at hand, files whose mime type is video can typically contain data such as the following inside the meta property:

width

The width of the video, in pixels. If the video was meant to be displayed with a different display ratio than the pixel ratio, this indicates the width at which the video is to be displayed.

height

The height of the video, in pixels.

framerate

The frame rate of the video, such as 29.5.

video_bitrate

The video bit rate of the video, such as 500000.

video_codec

The video codec of the video, such as "ffh264".

audio_bitrate

The audio bit rate of the video, such as 128000.

audio_samplerate

The audio sample rate of the video, such as 44100.

audio_channels

The number of audio channels in the video, such as 2.

audio_codec

The audio codec of the video, such as "faad".

seekable

Whether the format of the video supports seeking, such as true.

colorspace

The colorspace of the video. This could be "sRGB" or "Gray" for instance. This key is only returned if you set output_meta.colorspace to true.

date_recorded

For details, see the description for image metadata.

date_file_created

For details, see the description for image metadata.

date_file_modified

For details, see the description for image metadata.

device_name

For details, see the description for image metadata.

device_vendor

For details, see the description for image metadata.

device_software

For details, see the description for image metadata.

latitude

For details, see the description for image metadata.

longitude

For details, see the description for image metadata.

Audio Metadata

Although it depends on the file at hand, files whose mime type is audio can typically contain data such as the following inside the meta property:

duration

The length of the audio file in seconds.

audio_bitrate

Bits per second (for all channels combined).

audio_samplerate

The audio sample rate in Hertz, such as 44100, for a CD.

audio_channels

Number of channels. Typically 2, for stereo.

audio_codec

The Audio codec used. Here's a list of all audio codecs that Transloadit supports.

artist

Many applications that produce audio write additional information into the audio file such as artist, year, album, genre.

mean_volume

The mean volume of the audio file. This key is only returned if you set output_meta.mean_volume to true.