Quantcast
Channel: MediaSPIP
Viewing all articles
Browse latest Browse all 118079

Transcode video with php ffmpeg library

$
0
0

I need to upload video in 3 formate/resolution as 360p, 480p, 720p.

After some research i got to know that some paid service are there like Amazone Elastic Transcoder . But i want to do with open source so i found FFMPEG.

Also i want to upload video on Amazon s3 after transcode and video are in big size like video may contain 1GB size.

I got php library for FFMPEGLibrary Link

I have installed ffmpeg and it successfully generate new video. But i cannot figure out that how can i generate different formate/resolution as 360p, 480p, 720p.

My sample Code is

 error_reporting(E_ALL); ini_set('display_errors', 1); require 'vendor/autoload.php'; //$ffmpeg = FFMpeg\FFMpeg::create(); $video = $ffmpeg->open('assets/small.mp4'); $video ->filters() ->resize(new FFMpeg\Coordinate\Dimension(320, 240)) ->synchronize(); $video ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(2)) ->save('assets/frame.jpg'); $format = new FFMpeg\Format\Video\X264(); $format->setAudioCodec("libmp3lame"); $video->save($format, 'assets/new.mp4');

Can anyone suggest me any way that how can i achieve this ??

-- Library Link

Viewing all articles
Browse latest Browse all 118079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>