Problem with FFmpeg video format for PHP

i compiled a new version of FFMPEG, and the fill commands are out of date.
Since I'm trying to get acquainted with the new -vf pad = commands, I want to ask how I can convert a video without changing its format.

I checked many solutions from stackoverflow, nothing worked.
Can someone please write a working PHP example or cmd line. I would be very happy.

Please note that the video in question may be 4: 3, as well as 16: 9

Say I'm converting a 16: 9 format to 640x480. This will require some bars on the
top and bottom. This is what I want to do.

thank

+3
source share
2 answers

Thanks for sharing this code.

I had to make a variation:

//keep always the same video size 
//we need to add padding and then crop the same size to keep vieos with same WxH sizes    
$command = FLV_LITE_FFMPEG_PATH . ' -i ' . $original_video;
$command .= ' -s '.FLV_LITE_VIDEO_WIDTH . 'x' .FLV_LITE_VIDEO_HEIGHT;
$command .= ' -croptop ' . $pad_top;
$command .= ' -cropbottom ' . $pad_bottom;
$command .= ' -cropleft ' . $pad_left;
$command .= ' -cropright ' . $pad_right;
$command .= ' -padtop ' . $pad_top;
$command .= ' -padbottom ' . $pad_bottom;
$command .= ' -padleft ' . $pad_left;
$command .= ' -padright ' . $pad_right;
$command .= ' -padcolor 0x000000';
$command .= ' -ab 32 -f flv -ar 22050 -b 256 -r 24 -y';   
$command .= ' ' . $converted_video; 

exec($command, $output, $status);
+2
source

It is not possible to verify which image format you want to convert:

ffmpeg -i input.file

Then set this in -aspectthe ffmpeg command flag ?

0
source

Source: https://habr.com/ru/post/1770732/


All Articles