Filestack\FilestackClient::convertVideo
Convert a video file from url or filelink handle to another video format.
IMPORTANT: To use this function, you must setup webhooks to notify you when the transcoding has completed. See our online docs for more details: https://www.filestack.com/docs/video-transformations
Signature
public function convertVideo(string
$resource,
string
$format,
[array
$options = ,
[boolean
$force = false]] )
Parameters
$resource
— string- url or file handle
$format
— string- The format to which you would like to
convert to. e.g (aac, h264, h264.hi,
hls.variant, hls.variant.audio, m4a, mp3,
oga, ogg, ogg.hi, webm, webm.hi) $options
— array- Array of options.
access: public or private
Indicates that the file should be stored in
a way that allows public access going directly
to the underlying file store. For instance,
if the file is stored on S3, this will allow
the S3 url to be used directly. This has no
impact on the ability of users to read from
the Filestack file URL. Defaults to 'private'.
aspect_mode: set the aspect mode (default: letterbox)
'preserve` - Original size and ratio is preserved.
'constrain' - Aspect ratio is maintained,
No black bars are added to the output.
'crop' - Fills frame size and crops the rest
'letterbox' - Adds black bars to defined height
'pad' - Adds black bars to output to match
defined frame size
audio_bitrate: Sets the audio bitrate for the
audio file that is generated by the transcoding
process. Must be an integer between 0 and 999.
audio_channels: Set the number of audio channels
for the audio file that is generated by the
transcoding process. Can be an integer between
1 and 12. Default is same as source audio.
audio_sample_rate: Set the audio sample rate
for the audio file that is generated by the
transcoding process. Can be an integer between
0 and 99999. Default is 44100.
clip_length: Set the length of the video file
that is generated by the transcoding process.
Format is hours:minutes:seconds e.g. (00:00:20)
clip_offset: Set the point to begin the video
clip from. For example, clip_offset:00:00:10
will start the audio transcode 10 seconds
into the source audio file. Format is
hours:minutes:seconds, e.g. (00:00:10)
container: The bucket or container in the specified
file store where the file should end up.
extname: Set the file extension for the audio
file that is generated by the transcoding
process, e.g. ('.mp4', '.webm')
fps: Specify the frames per second of the video
that is generated by the transcoding process.
Must be an integer between 1 and 300 Default
is to copy the original fps of the source file.
filename: Set the filename of the audio file
that is generated by the transcoding process.
keyframe_interval: Adds a key frame every 250
frames to the video that is generated by the
transcoding process. Default is 250.
location: The custom storage service to store
the converted file to, options incude 'S3',
'azure', 'gcs', 'rackspace', and 'dropbox'
path: The path to store the file at within the
specified file store. For S3, this is the
key where the file will be stored at. By
default, Filestack stores the file at the
root at a unique id, followed by an underscore,
followed by the filename, for example
"3AB239102DB_myaudio.mp3"
title: Set the title in the file metadata.
two_pass: Specify that the transcoding process
should do two passes to improve video quality.
Defaults to false.
width: Set the width in pixels of the video
that is generated by the transcoding process.
height: Set the height in pixels of the video
that is generated by the transcoding process.
upscale: Upscale the video resolution to match
your profile. Defaults to true.
video_bitrate: Specify the video bitrate for
the video that is generated by the transcoding
process. Must be an integer between 1 and 5000.
watermark_bottom: The distance from the bottom
of the video frame to place the watermark
on the video. (0 to 9999)
watermark_left: The distance from the left side
of the video frame to place the watermark
on the video. (0 to 9999)
watermark_right: The distance from the left side
of the video frame to place the watermark
on the video. (0 to 9999)
watermark_left: The distance from the top * of the video frame to place the watermark
on the video. (0 to 9999)
watermark_width: Resize the width of the watermark
watermark_height: Resize the height of the watermark
watermark_url: The Filestack handle or URL of
the image file to use as a watermark on the
transcoded video. $force
— boolean- set to true to restart completed
or pending audio encoding if a transcoding
fails, and you make the same request again
Returns
- string
- (uuid of conversion task)
Errors/Exceptions
-
FilestackException
- if API call fails, e.g 404 file not found
Test Coverage
Information
- Coverage: / Lines (%)
- Tests: 0
- Passed: 0 (0%)