Blog

Home  /  Coding   /  How to Convert Videos on Server in Any Server-Side Language | AV CODING

How to Convert Videos on Server in Any Server-Side Language | AV CODING

Hey guys welcome to AV Coding

Today we will learn how to convert videos on server in any server-side language using open source tool ffmpeg.

The complete code is explained in the video below and the source code is provided below.

ffmpeg Download:- https://www.ffmpeg.org/download.html

ffmpeg Documentation:- https://www.ffmpeg.org/ffmpeg.html

ffmpeg-npm :- https://www.npmjs.com/package/ffmpeg

ffmpeg-python:- https://pypi.org/project/ffmpeg-python/

# For Php

$file = $_FILES["fileToUpload"]["tmp_name"];
exec("./ffmpeg.exe");
exec("ffmpeg -i ".$file." ./output/".explode(".",$file)[0].".mp4");

# For Node Js

const { exec } = require('child_process');
exec('ffmpeg.exe', (err, stdout, stderr) => {});
exec("ffmpeg -i ./path/to/input_file_name.input_extension ./path/to/output_file_name.output_extension", (err, stdout, stderr) => {});

# For Python

import os
os.system('ffmpeg.exe')
os.system('ffmpeg -i ./path/to/input_file_name.input_extension ./path/to/output_file_name.output_extension')

Hope You Liked This Blog. Share, Comment, Subscribe And Press The Bell Icon In The Bottom Right Side For More Code Feeds.