国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開發(fā) > PHP > 正文

PHP使用ffmpeg給視頻增加字幕顯示的方法

2024-05-04 21:55:15
字體:
供稿:網(wǎng)友

 這篇文章主要介紹了PHP使用ffmpeg給視頻增加字幕顯示的方法,實(shí)例分析了php操作ffmpeg給視頻增加字母的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

  

本文實(shí)例講述了PHP使用ffmpeg給視頻增加字幕顯示的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

 

代碼如下:
<?php
$dir = './'; // set to current folder
if ($handle = opendir($dir)) {
while(false!== ($file = readdir($handle))) {
if ( is_file($dir.$file) ){
if ($sub_file = str_ireplace(".avi", ".srt", $dir.$file);
$idx_file = str_ireplace(".avi", ".idx", $dir.$file);
$thumb_file = str_ireplace(".avi", ".jpg", $dir.$file);
$out_file = str_ireplace(".avi", ".mp4", $dir.$file);
flv_convert_get_thumb($dir.$file, $sub_file, $idx_file, $thumb_file, $out_file);
}
else{
continue;
}
}
}
closedir($handle);
}
//flv_convert_get_thumb('input.avi', 'input.srt', 'output.jpg', 'output.ogm');
// code provided and updated by steve of ph
psnaps ! thanks
// accepts:
// 1: the input video file
// 2: path to thumb jpg
// 3: path to transcoded mpeg?
function flv_convert_get_thumb($in, $in_sub, $in_idx, $out_thumb, $out_vid){
// get thumbnail
$cmd = 'ffmpeg -v 0 -y -i '.$in.' -vframes 1 -ss 250 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 '.$out_thumb;
$res = shell_exec($cmd);
// $res is the output of the command
// transcode video
$cmd = 'mencoder '.$in.' -o '.$out_vid.' -sub '.$in_sub.' -subfont-text-scale 3.0 -subpos 99 -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encop$
$res = shell_exec($cmd);
}
?>

 

希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 松滋市| 得荣县| 义乌市| 城口县| 乌鲁木齐市| 海宁市| 调兵山市| 南靖县| 荥经县| 普宁市| 荔浦县| 邓州市| 衡水市| 彭阳县| 句容市| 蕉岭县| 大连市| 莱阳市| 铁岭县| 高清| 苏尼特右旗| 云龙县| 雷波县| 平邑县| 客服| 泌阳县| 砚山县| 夏邑县| 嵩明县| 井冈山市| 湟中县| 肃北| 克山县| 曲阜市| 孝昌县| 望江县| 什邡市| 塘沽区| 郧西县| 望城县| 古蔺县|