Here I am going to get details related to FFMPEG including orientation, duration.
Step to get details related to FFMPEGincluding orientation, duration.
1. Get Video duration:
$ffmpeg_path = “/usr/bin/ffmpeg”; //Path to your FFMPEG
$video_path = “/vidoes/myvideo.mov”; // Path to your Video
$command = $ffmpeg_path . ‘ -i “‘ . $video_path . ‘” -vstats 2>&1’;
$output = shell_exec($command);
$regex_duration = “/Duration: ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}).([0-9]{1,2})/”;
if (preg_match($regex_duration, $output, $regs)) {
$hours = $regs [1] ? $regs [1] : null;
$mins = $regs [2] ? $regs [2] : null;
$secs = $regs [3] ? $regs [3] : null;
}
$video_Length = $hours . “:” . $mins . “:” . $secs;
2. Get Video thumbnail:
$save_video_thumbnail = ‘thumbnails/myvideo_thumbnail’;
$cmd = “$ffmpeg_path -i $video_path -ss 00:00:03 -s 404×694 -vframes 1 $save_video_thumbnail”;
$output = shell_exec($command);
Notes: In Above 00:00:03 is duration when thumbnail is generated. We can set this as per requirement.
3. Get Video Orientation:
$ffmpeg_path = “/usr/bin/ffmpeg”; //Path to your FFMPEG
$video_path = “/vidoes/myvideo.mov”; // Path to your Video
$command = $ffmpeg_path . ‘ -i “‘ . $video_path . ‘” -vstats 2>&1’;
$output = shell_exec($command);
$out_arr = explode(“n”, $output);
foreach($out_arr as $line) {
if( preg_match(‘/^Stream.*Video:/’, trim($line)) ) {
/* match line: Stream #0.0(und): Video: h264 (High), yuv420p, 640×360 [PAR 1:1 DAR 16:9], 597 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc */
$line_arr = explode(‘,’, $line);
// get field: 640×360 [PAR 1:1 DAR 16:9]
$target_arr = explode(‘ ‘, $line_arr[3]);
// get parts: 640×360
$dims = explode(‘x’, $target_arr[1]);
$res_x = $dims[0];
$res_y = $dims[1];
}
}
$orientation = (intval($res_x) > intval($res_y)) ? ‘Portrait’ :’Landscape’;
You can
drop message for any questions or feedback. Will get back to you soon.
DennisRuith at 12:52 pm, September 17, 2023
purple pharmacy mexico price list: mexican border pharmacies shipping to usa – mexican pharmaceuticals online
DennisRuith at 12:38 pm, September 18, 2023
mexican online pharmacies prescription drugs: medicine in mexico pharmacies – purple pharmacy mexico price list
Jefferytwefs at 11:18 am, September 19, 2023
buy medications online no prescription certified canadian international pharmacy approved canadian pharmacies
ArchieGah at 12:40 pm, September 24, 2023
http://farmaciaonline.men/# farmacia online piГ№ conveniente
Thomasknine at 10:23 pm, September 24, 2023
farmacia online senza ricetta acquisto farmaci con ricetta farmacie online autorizzate elenco
ArchieGah at 1:53 pm, September 25, 2023
https://pharmacieenligne.icu/# Pharmacie en ligne livraison 24h
ArchieGah at 2:01 pm, September 26, 2023
https://farmaciabarata.pro/# farmacia envГos internacionales
RickeyHaure at 8:35 pm, September 27, 2023
farmacie on line spedizione gratuita: Cialis senza ricetta in farmacia – comprare farmaci online all’estero
BillyGof at 9:05 am, September 28, 2023
http://edpharmacie.pro/# Pharmacies en ligne certifiГ©es