Mitrahsoft
  • SERVICES
    • OUR SERVICES
      • SOFTWARE DEVELOPMENT
      • MOBILE DEVELOPMENT
      • BLOCKCHAIN DEVELOPMENT
      • SOFTWARE TESTING
      • CLOUD & DEVOPS SERVICES
      • PRODUCT DEVELOPMENT
      • OFFSHORE DEVELOPMENT
      • SOCIAL MEDIA MARKETING
      TECHNOLOGIES
      • COLDFUSION DEVELOPMENT
      • REACTJS DEVELOPMENT
      • VUEJS DEVELOPMENT
      • ANGULAR DEVELOPMENT
      • NODEJS DEVELOPMENT
      • PYTHON DEVELOPMENT
      • GOLANG DEVELOPMENT
      • GOLANG CORPORATE TRAINING
      COLDFUSION EXPERTISE
      • MURACMS EXPERTISE
      • COLDFUSION APP MIGRATION
      • COLDFUSION HOSTING & SUPPORT
      • CF LEGACY APP MAINTENANCE
      • COLDFUSION REST API
      • ECOMMERCE / SHOPPING CART SOLUTIONS
      • PRESIDECMS EXPERTISE
      MOBILE DEVELOPMENT
      • REACT NATIVE DEVELOPMENT
      • FLUTTER DEVELOPMENT
      • IONIC DEVELOPMENT
      • PHONEGAP DEVELOPMENT
  • ABOUT US
    • ABOUT MITRAHSOFT
    • OUR CLIENTS
    • TESTIMONIALS
    • PORTFOLIO
    • CAREERS
  • CONTACT US
  • BLOG
Adobe Solution PartnerLucee Solution Partner
Adobe Solution PartnerLucee Solution Partner
Adobe Solution PartnerLucee Solution Partner
  • OUR SERVICESSOFTWARE DEVELOPMENTMOBILE DEVELOPMENTBLOCKCHAIN DEVELOPMENTSOFTWARE TESTINGCLOUD & DEVOPS SERVICESPRODUCT DEVELOPMENTOFFSHORE DEVELOPMENTSOCIAL MEDIA MARKETING
    TECHNOLOGIESCOLDFUSION DEVELOPMENTREACTJS DEVELOPMENTVUEJS DEVELOPMENTANGULAR DEVELOPMENTNODEJS DEVELOPMENTPYTHON DEVELOPMENTGOLANG DEVELOPMENTGOLANG CORPORATE TRAINING
    COLDFUSION EXPERTISEMURACMS EXPERTISECOLDFUSION APP MIGRATIONCOLDFUSION HOSTING & SUPPORTCF LEGACY APP MAINTENANCECOLDFUSION REST API ECOMMERCE / SHOPPING CART SOLUTIONSPRESIDECMS EXPERTISE
    MOBILE DEVELOPMENTREACT NATIVE DEVELOPMENTFLUTTER DEVELOPMENTIONIC DEVELOPMENTPHONEGAP DEVELOPMENT
  • ABOUT MITRAHSOFTOUR CLIENTSTESTIMONIALSPORTFOLIOCAREERS
  • CONTACT US
  • BLOG

Video Compression Using FFmpeg On ColdFusion

HomeBlogVideo Compression Using FFmpeg On ColdFusion
ColdFusionFFmpeg

Video Compression Using FFmpeg On ColdFusion

M
Post by MitrahsoftPublished: Feb 20, 2019

Nobody want to store large video / audio files into their server hard disk or s3 buckets. So while uploading, they are all expecting to compress the video or audio files without losing originality, when we upload a video or an audio files in to their application. We do have functions & tag to manipulate image files in ColdFusion, but We don't have any ColdFusion build in option (tag / function) to manipulate audio / video files. You might heard of ffmpeg and it's wide usability. it is mostly in videos & audios sites such as YouTube/soundcloud or any other similar site. ffmpeg is very simple to learn. On ColdFusion, we can able to compress the video or audio files using FFmpeg utility. it is a free open source command line utility compatiable with all major operating systems (Windowns, Linunx & Mac). As We are going to demonstrate this process in Windows operating system, so we will be using FFmpeg .exe files. ColdFusion has the facility to run the executable ( .exe, .bin, .bat, .sh ) files using cfexecute tag. Other than, video compression, ffmpeg can be used to know the duration of the movie/audio in seconds to retrieving the bitrate of the movie/audio file. This can be very helpful when you are developing application that has to do with uploading videos because you can know a lot of information about it.

Video Compression Using Ffmpeg on Coldfusion

 

Here, We will explain, how to do the video compression process in ColdFusion using FFmpeg. Using FFmpeg, we can able to compress the video without losing quality and can able to get the informations about video or audio files.

Introduction about FFmpeg

FFmpeg is the leading free open source multimedia command line utility. Using this utility, we can able to do the following things,

  • decode
  • encode
  • transcode
  • mux
  • demux
  • stream
  • filter and play

FFmpeg can run in Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. operating systems. There are three types of tools coming on FFmpeg bundle,

  • ffmpeg
  • ffplay
  • ffprobe

We can able to compress video or audio files and then will stored into particular folder using ffmpeg tool. And using ffprobe tool, can able to get the video or audio file's meta information.

Prerequisites

  1. Need to download the ffmpeg binary files based upon your OS. They are providing binaries for multiple OS such as Linux, Mac & Windows.
  2. Need to unZip this in any one folder. After UnZipping the downloaded windows binary file, we can able to see the three .exe extension files on ffmpeg\bin path. These are the core files. Using these files, we can able to do the video compression and some other operations on video/audio files.

FFmpeg Tool

ffmpeg is a very fast converter used to compress the offline & live video and audio files. The below diagram will explain the ffmpeg transcoding process. Ffmpeg ProcessVideo Compression Command Line : ffmpeg -i [input file] -vcodec libx264 -crf 20 [output file]

ColdFusion has a facility to run the .exe extension files using cfexecute tag. While using this tag, we need to pass the necessary parameters to run .exe file. Please see the below code snippet.

cfml
<cfscript>
cfexecute(
    name = "\ffmpeg\bin\ffmpeg.exe", // ffmpeg.exe file path
    arguments = "-i [input video path] -vcodec libx264 -preset faster -crf 30 [Output video file path]",
    timeout = "5000"
);
</cfscript>

FFprobe Tool

ffprobe utility is mainly used to get meta information about multimedia streams ( video & audio ) and prints it in human readable format. You can able to get all kinds of information about an input including duration, frame rate, frame size, etc.

Command Line : ffprobe [OPTIONS] [INPUT_FILE]

ffprobe has two parameters,

ParametersDescription
-show_formatThis parameter is used to display all information about input video or audio file such as video width, height, display_aspect_ratio, duration, filename, size, bit_rate and etc...
-show_entriesThis parameter is mainly used to get particular information about video or audio. For example, if we need only video duration means, need to use below syntax. Command Line : ffprobe -i [input file] -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal [output file]

Example with -show_format parameter

cfml
<cfexecute
    name = "#currentPath#\ffmpeg\bin\ffprobe.exe"
    arguments = '-i [input file] -v quiet -print_format json -show_format -show_streams'
    outputfile = "[output file path]" // In this file, we can able to show all the information about input file.
    timeout = "100"
/>

In the above code, I have passed the needed parameters to the ffprobe.exe file. In the arguments passed, I have used -print_format json, this is used to print the output in the JSON format. After running this code, you can able to see the below output in the mentioned output file.

Output

cfml
{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "Main",
            "codec_type": "video",
            "codec_time_base": "1001/60000",
            "codec_tag_string": "avc1",
            "codec_tag": "0x31637661",
            "width": 1280,
            "height": 720,
            "coded_width": 1280,
            "coded_height": 720,
            "has_b_frames": 1,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 31,
            "color_range": "tv",
            "color_space": "bt709",
            "color_transfer": "bt709",
            "color_primaries": "bt709",
            "chroma_location": "left",
            "refs": 1,
            "is_avc": "true",
            "nal_length_size": "4",
            "r_frame_rate": "30000/1001",
            "avg_frame_rate": "30000/1001",
            "time_base": "1/90000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 16060044,
            "duration": "178.444933",
            "bit_rate": "492899",
            "bits_per_raw_sample": "8",
            "nb_frames": "5348",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            },
            "tags": {
                "creation_time": "2018-10-23T22:04:01.000000Z",
                "language": "und",
                "handler_name": "ISO Media file produced by Google Inc. Created on: 10/23/2018."
            }
        },
        {
            "index": 1,
            "codec_name": "aac",
            "codec_long_name": "AAC (Advanced Audio Coding)",
            "profile": "LC",
            "codec_type": "audio",
            "codec_time_base": "1/44100",
            "codec_tag_string": "mp4a",
            "codec_tag": "0x6134706d",
            "sample_fmt": "fltp",
            "sample_rate": "44100",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/44100",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 7869440,
            "duration": "178.445351",
            "bit_rate": "125602",
            "nb_frames": "7685",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            },
            "tags": {
                "creation_time": "2018-10-23T22:04:01.000000Z",
                "language": "eng",
                "handler_name": "ISO Media file produced by Google Inc. Created on: 10/23/2018."
            }
        }
    ],
    "format": {
        "filename": "Tom_Jerry.mp4",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "178.445344",
        "size": "13877973",
        "bit_rate": "622172",
        "probe_score": 100,
        "tags": {
            "major_brand": "mp42",
            "minor_version": "0",
            "compatible_brands": "isommp42",
            "creation_time": "2018-10-23T22:04:01.000000Z"
        }
    }
}

Example with -show_entries parameter

In this example, will see how to get the input file Duration only.

cfml
<cfexecute
    name = "ffmpeg\bin\ffprobe.exe"
    arguments = '-i [input file] -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal'
    outputfile = "[output file path]" // In this file, we can able to show the duration of the input file.
    timeout = "100"
/>
text
show_entries format=duration: This means, get the duration only from the input video.
-sexagesimal: -sexagesimal option will use the HOURS:MM:SS.MICROSECONDS time unit format.

Output

Video time duration - 0:00:30.024000

Tags

ADYENAMAZON-SESANDROIDAPACHEAPACHE-JMETERAWSBARCODE-SCANNERCOLDBOXCOLDFUSIONCOLDFUSION-API-INTEGRATIONCOLDFUSIONBUILDERECHARTSEVENT-GATEWAYFFMPEGFW1JQUERYJSOUPLUCEEMURACMSMURACMS-THEMENODEJSONESIGNALOSSPAYFLOW-PROPAYMENT-GATEWAYPAYPALPRESIDECMSPUPPETEERRAILORAZUNAREACTJSREACTNATIVERESTSASS-COMPILATIONSEMANTIC-UISUBLIMETEXTTINYMCETWILIOYUI-LIBRARY

Archives

JAN 20DEC 19AUG 19JUL 19JUN 19MAY 19APR 19MAR 19FEB 19JAN 19DEC 18NOV 18OCT 18MAR 16NOV 15SEP 15MAY 15MAY 14OCT 13JUN 13MAY 13APR 13MAR 13FEB 13JAN 13

Follow us

Mitrahsoft
United StatesUnited States

Hurst, Texas, United States

+1 (817) 606-8684usa-sales@mitrahsoft.com

IndiaIndia

Head Office

126G2/5, Thiru malai nagaram,
Kovilpatti - 628 501

Madurai

1/B, 2nd & 3rd floor, GV Complex,

Bye Pass Road, SS Colony,

Madurai - 625 016

Coimbatore

2nd Floor, Sri Narmadha Towers,

Murugan Nagar Rd, Thoppampatti Pirivu,

 K. Vadamadurai, Coimbatore - 641 017

+91 9092480924

business@mitrahsoft.com

ColdFusion
  • eCommerce / Shopping Cart Solutions
  • Payment Gateway Integrations
  • Shipping API Integrations
  • ColdFusion Development Services
  • REST API Development
  • MuraCMS Plugin Creation & Personalization
Technology Services
  • ReactJS Development
  • VueJS Development
  • AngularJS Development
  • NodeJS API Development
  • Python Development
  • Golang Development
  • React Native Development
  • D3.JS data Visualization
Other Services
  • Software Development
  • Mobile Development
  • Blockchain Development
  • Cloud & Devops Services

Connect with MitrahSoft

Please fill out this field
Please fill out this field
Please fill out this field
Please fill out this field
Please fill out this field
Please fill out this field

© 2026 All Rights Reserved. MitrahSoft Solutions Pvt Ltd

Home|About Us|Careers