Transform a Video into WEBM Format in Ruby

gem 'cloudmersive-video-api-client', '~> 2.0', '>= 2.0.5'
# load the gem
require 'cloudmersive-video-api-client'
# setup authorization
CloudmersiveVideoApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end
api_instance = CloudmersiveVideoApiClient::VideoApi.newopts = {
input_file: File.new('/path/to/inputfile'), # File | Input file to perform the operation on.
file_url: 'file_url_example', # String | Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
max_width: 56, # Integer | Optional; Maximum width of the output video, up to the original video width. Defaults to original video width.
max_height: 56, # Integer | Optional; Maximum height of the output video, up to the original video width. Defaults to original video height.
preserve_aspect_ratio: true, # BOOLEAN | Optional; If false, the original video's aspect ratio will not be preserved, allowing customization of the aspect ratio using maxWidth and maxHeight, potentially skewing the video. Default is true.
frame_rate: 56, # Integer | Optional; Specify the frame rate of the output video. Defaults to original video frame rate.
quality: 56 # Integer | Optional; Specify the quality of the output video, where 100 is lossless and 1 is the lowest possible quality with highest compression. Default is 50.
}
begin
#Convert Video to WEBM format.
result = api_instance.video_convert_to_webm(opts)
p result
rescue CloudmersiveVideoApiClient::ApiError => e
puts "Exception when calling VideoApi->video_convert_to_webm: #{e}"
end

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Invoking a AWS Lambda function directly from a Flutter app(with response) without using API Gateway

Going Serverless Series

Email Archiving: 5 Must-Have Software Features

The “Baked Data” architecture pattern

Flutter performance Windows vs Ubuntu

A practical guide to containers on FreeNAS for a depraved psychopath.

Transaction analysis for the Starbucks mobile app

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Check if IP address is a Known Threat in Node.js

How the Carla car simulator helped us level up the static analysis of Unreal Engine 4 projects

Disaster Recovery with a CDK managed database

2021.12.27 Weekly notes