Extract Video Metadata API

ApyHub
ApyHub
verified icon
250 atoms
Premium tier

About

This API extracts metadata from video files of various formats, including WebM, MP4, and 3GP.
This API is Ideal for applications that require detailed information about the video files, including video editing tools, content management systems (CMS) as well as media analysis tools.
Try out the Video Metadata API in the API playground for free, improve your workflow, and reduce metadata extraction errors with a simple API call.
Select API Endpoints
Input

API Playground

API Documentation

input file: output json
POST
https://api.apyhub.com/video/metadata/file

Request example

1
curl --location --request POST 'https://api.apyhub.com/video/metadata/file' \
2
--header 'apy-token: {{token}}' \
3
--form 'video=@"sample.mp4"'
Method: POST
Content Type: multipart/form-data
Request Body
AttributeTypeMandatoryDescription
videoFileYesthe source video file in any of supported formats (mp4,webm,flv,avi,mkv,mov,3gp)
Response
KeyTypeDescription
audio.codec_informationObjectInformation about the audio codec
audio.codec_information.channel_layoutStringAudio channel layout
audio.codec_information.codec_long_nameStringLong name of the audio codec
audio.codec_information.codec_nameStringName of the audio codec
audio.codec_information.codec_tagStringAudio codec tag
audio.codec_information.codec_tag_stringStringAudio codec tag string
audio.codec_information.codec_typeStringType of the audio codec (audio)
audio.general_audioObjectGeneral information about audio
audio.general_audio.audio_bits_per_sampleIntegerAudio bits per sample
audio.general_audio.audio_channelsIntegerNumber of audio channels
audio.general_audio.audio_formatStringAudio format
audio.general_audio.audio_sample_rateIntegerAudio sample rate
audio.general_audio.average_bitrateStringAverage bitrate
audio.general_audio.avg_bitrateStringAverage bitrate
audio.general_audio.balanceIntegerAudio balance
audio.general_audio.bit_depthIntegerAudio bit depth
audio.general_audio.buffer_sizeStringAudio buffer size
audio.time_baseObjectTime base information for audio
audio.time_base.time_baseStringTime base for audio
file.file_informationObjectInformation about the file
file.file_information.encoderStringFile encoder
file.file_information.file_access_dateStringFile access date
file.file_information.file_inode_change_dateStringFile inode change date
file.file_information.file_modify_dateStringFile modify date
file.file_information.file_nameStringFile name
file.file_information.file_permissionsStringFile permissions
file.file_information.file_sizeStringFile size
file.file_information.file_typeStringFile type
file.file_information.file_type_extensionStringFile type extension
file.file_information.graphics_modeStringGraphics mode
file.file_information.handler_descriptionStringHandler description
file.file_information.handler_typeStringHandler type
file.file_information.handler_vendor_idStringHandler vendor ID
file.media_informationObjectInformation about the media
file.media_information.matrix_coefficientsStringMatrix coefficients
file.media_information.matrix_structureStringMatrix structure
file.media_information.max_bitrateStringMaximum bitrate
file.media_information.media_create_dateStringMedia create date
file.media_information.media_data_offsetIntegerMedia data offset
file.media_information.media_data_sizeIntegerMedia data size
file.media_information.media_header_versionIntegerMedia header version
file.media_information.media_language_codeStringMedia language code
file.media_information.media_modify_dateStringMedia modify date
file.media_information.media_time_scaleIntegerMedia time scale
file.media_information.megapixelsFloatMegapixels
file.media_information.minor_versionStringMinor version
file.media_information.movie_header_versionIntegerMovie header version
file.media_information.next_track_idIntegerNext track ID
file.media_information.pixel_aspect_ratioStringPixel aspect ratio
file.media_information.poster_timeStringPoster time
file.media_information.preferred_rateIntegerPreferred rate
file.media_information.preferred_volumeStringPreferred volume
file.media_information.preview_durationStringPreview duration
file.media_information.preview_timeStringPreview time
file.media_information.rotationIntegerRotation
file.media_information.time_scaleIntegerTime scale
file.media_information.track_header_versionIntegerTrack header version
file.media_information.track_idIntegerTrack ID
file.media_information.track_layerIntegerTrack layer
file.media_information.track_modify_dateStringTrack modify date
file.media_information.track_volumeStringTrack volume
file.media_information.transfer_characteristicsStringTransfer characteristics
video.additional_video_featuresObjectAdditional video features
video.additional_video_features.attached_picIntegerAttached picture
video.additional_video_features.captionsIntegerCaptions
video.additional_video_features.clean_effectsIntegerClean effects
video.additional_video_features.commentIntegerComment
video.additional_video_features.defaultIntegerDefault
video.additional_video_features.dependentIntegerDependent
video.additional_video_features.descriptionsIntegerDescriptions
video.additional_video_features.dubIntegerDub
video.additional_video_features.forcedIntegerForced
video.additional_video_features.hearing_impairedIntegerHearing impaired
video.additional_video_features.karaokeIntegerKaraoke
video.additional_video_features.lyricsIntegerLyrics
video.additional_video_features.metadataIntegerMetadata
video.codec_informationObjectInformation about the video codec
video.codec_information.avg_frame_rateStringAverage frame rate
video.codec_information.bits_per_sampleStringBits per sample
video.codec_information.chroma_locationStringChroma location
video.codec_information.closed_captionsIntegerClosed captions
video.codec_information.codec_long_nameStringLong name of the video codec
video.codec_information.codec_nameStringName of the video codec
video.codec_information.codec_tagStringVideo codec tag
video.codec_information.codec_tag_stringStringVideo codec tag string
video.codec_information.codec_typeStringType of the video codec (video)
video.codec_information.compatible_brandsArray of StringsCompatible brands
video.codec_information.major_brandStringMajor brand
video.codec_information.mime_typeStringMIME type
video.codec_information.minor_versionStringMinor version
video.color_informationObjectColor information for the video
video.color_information.color_primariesStringColor primaries
video.color_information.color_rangeStringColor range
video.color_information.color_spaceStringColor space
video.color_information.color_transferStringColor transfer
video.color_information.display_aspect_ratioStringDisplay aspect ratio
video.color_information.opcolorStringOpcolor
video.duration_and_timingObjectDuration and timing information for the video
video.duration_and_timing.create_dateStringCreate date
video.duration_and_timing.current_timeStringCurrent time
video.duration_and_timing.durationStringDuration
video.duration_and_timing.selection_durationStringSelection duration
video.duration_and_timing.selection_timeStringSelection time
video.duration_and_timing.start_timeStringStart time
video.duration_and_timing.track_create_dateStringTrack create date
video.duration_and_timing.track_durationStringTrack duration
video.language_and_handlerObjectLanguage and handler information for the video
video.language_and_handler.handler_nameStringHandler name
video.language_and_handler.languageStringLanguage
video.language_and_handler.vendor_idStringVendor ID
video.resolution_and_sizeObjectResolution and size information for the video
video.resolution_and_size.coded_heightIntegerCoded height
video.resolution_and_size.coded_widthIntegerCoded width
video.resolution_and_size.heightIntegerHeight
video.resolution_and_size.sizeStringSize (formatted as "width x height")
video.resolution_and_size.widthIntegerWidth
video.technical_video_detailsObjectTechnical details about the video
video.technical_video_details.field_orderStringField order
video.technical_video_details.film_grainIntegerFilm grain
video.technical_video_details.has_b_framesIntegerHas B frames
video.technical_video_details.is_avcStringIs AVC
video.technical_video_details.levelIntegerLevel
video.technical_video_details.nal_length_sizeStringNAL length size
video.technical_video_details.nb_framesStringNumber of frames
video.technical_video_details.pix_fmtStringPixel format
video.technical_video_details.refsIntegerReferences
video.time_baseObjectTime base information for the video
video.time_base.time_baseStringTime base for video
video.video_informationObjectInformation about the video
video.video_information.bit_rateStringVideo bitrate
video.video_information.format_long_nameStringLong name of the video format
video.video_information.format_nameStringName of the video format
video.video_information.nb_programsIntegerNumber of programs
video.video_information.nb_streamsIntegerNumber of streams
video.video_information.probe_scoreIntegerProbe score
Sample Response
1
{
2
"audio": {
3
"codec_information": {
4
"channel_layout": "5.1",
5
"codec_long_name": "AAC (Advanced Audio Coding)",
6
"codec_name": "aac",
7
"codec_tag": "0x6134706d",
8
"codec_tag_string": "mp4a",
9
"codec_type": "audio"
10
},
11
"general_audio": {
12
"audio_bits_per_sample": 16,
13
"audio_channels": 2,
14
"audio_format": "mp4a",
15
"audio_sample_rate": 48000,
16
"average_bitrate": null,
17
"avg_bitrate": "1.58 Mbps",
18
"balance": 0,
19
"bit_depth": 24,
20
"buffer_size": null
21
},
22
"time_base": {
23
"time_base": "1/48000"
24
}
25
},
26
"file": {
27
"file_information": {
28
"encoder": "Lavf53.24.2",
29
"file_access_date": "2023:12:05 10:57:14+00:00",
30
"file_inode_change_date": "2023:12:05 10:57:14+00:00",
31
"file_modify_date": "2023:12:05 10:57:14+00:00",
32
"file_name": "https://assets.apyhub.com/samples/sample.mp4",
33
"file_permissions": "-rw-r--r--",
34
"file_size": "1056 kB",
35
"file_type": "MP4",
36
"file_type_extension": "mp4",
37
"graphics_mode": "srcCopy",
38
"handler_description": "SoundHandler",
39
"handler_type": "Metadata",
40
"handler_vendor_id": "Apple"
41
},
42
"media_information": {
43
"matrix_coefficients": null,
44
"matrix_structure": "1 0 0 0 1 0 0 0 1",
45
"max_bitrate": null,
46
"media_create_date": "0000:00:00 00:00:00",
47
"media_data_offset": 1051515,
48
"media_data_size": 0,
49
"media_header_version": 0,
50
"media_language_code": "und",
51
"media_modify_date": "0000:00:00 00:00:00",
52
"media_time_scale": 48000,
53
"megapixels": 0.922,
54
"minor_version": "0.2.0",
55
"movie_header_version": 0,
56
"next_track_id": 3,
57
"pixel_aspect_ratio": null,
58
"poster_time": "0 s",
59
"preferred_rate": 1,
60
"preferred_volume": "100.00%",
61
"preview_duration": "0 s",
62
"preview_time": "0 s",
63
"rotation": 0,
64
"time_scale": 1000,
65
"track_header_version": 0,
66
"track_id": 1,
67
"track_layer": 0,
68
"track_modify_date": "0000:00:00 00:00:00",
69
"track_volume": "0.00%",
70
"transfer_characteristics": null
71
}
72
},
73
"video": {
74
"additional_video_features": {
75
"attached_pic": 0,
76
"captions": 0,
77
"clean_effects": 0,
78
"comment": 0,
79
"default": 1,
80
"dependent": 0,
81
"descriptions": 0,
82
"dub": 0,
83
"forced": 0,
84
"hearing_impaired": 0,
85
"karaoke": 0,
86
"lyrics": 0,
87
"metadata": 0
88
},
89
"codec_information": {
90
"avg_frame_rate": "25/1",
91
"bits_per_sample": null,
92
"chroma_location": "left",
93
"closed_captions": 0,
94
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
95
"codec_name": "h264",
96
"codec_tag": "0x31637661",
97
"codec_tag_string": "avc1",
98
"codec_type": "video",
99
"compatible_brands": [
100
"isom",
101
"iso2",
102
"avc1",
103
"mp41"
104
],
105
"major_brand": "MP4 Base Media v1 [IS0 14496-12:2003]",
106
"mime_type": "video/mp4",
107
"minor_version": "512"
108
},
109
"color_information": {
110
"color_primaries": null,
111
"color_range": null,
112
"color_space": null,
113
"color_transfer": null,
114
"display_aspect_ratio": "16:9",
115
"opcolor": "0 0 0"
116
},
117
"duration_and_timing": {
118
"create_date": "0000:00:00 00:00:00",
119
"current_time": "0 s",
120
"duration": "5.312000",
121
"selection_duration": "0 s",
122
"selection_time": "0 s",
123
"start_time": "0.000000",
124
"track_create_date": "0000:00:00 00:00:00",
125
"track_duration": "5.28 s"
126
},
127
"language_and_handler": {
128
"handler_name": "VideoHandler",
129
"language": "und",
130
"vendor_id": "[0][0][0][0]"
131
},
132
"resolution_and_size": {
133
"coded_height": 720,
134
"coded_width": 1280,
135
"height": 720,
136
"size": "1280x720",
137
"width": 1280
138
},
139
"technical_video_details": {
140
"field_order": "progressive",
141
"film_grain": 0,
142
"has_b_frames": 0,
143
"is_avc": "true",
144
"level": 31,
145
"nal_length_size": "4",
146
"nb_frames": "132",
147
"pix_fmt": "yuv420p",
148
"refs": 1
149
},
150
"time_base": {
151
"time_base": "1/12800"
152
},
153
"video_information": {
154
"bit_rate": "1589963",
155
"format_long_name": "QuickTime / MOV",
156
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
157
"nb_programs": 0,
158
"nb_streams": 2,
159
"probe_score": 100
160
}
161
}
162
}

HTTP Response Codes

The method may return one of the following HTTP status codes:
Status CodeDescription
200The request was successful.
401Required authentication information is either missing or not valid for the resource.
400Invalid input - the provided files are corrupt or the supported inputs are not provided.
500If any unexpected error occurs while processing the request.

Authentication

All API requests to ApyHub services need to be authenticated. Currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from your workspace settings (on the left side of the navbar) and go to “API Keys".
Points to note:
  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

1
{
2
"error": {
3
"code": 105,
4
"message": "Invalid URL"
5
}
6
}
To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.
Table of contents
AboutAPI PlaygroundAPI DocumentationAuthenticationError codesRelated Utility APIsRelated Articles