欧美国产另类久热|951超碰伊人久久|伊人影视久久久久|色婷婷亚洲小电影|色东京热69XX|婷婷玖玖深爱网|加勒比东京热网站|无码A级毛片在线观看|一级a毛一级a看|中文字幕人妻欧美

PHP使用ffmpeg給視頻增加字幕顯示的方法
來源:易賢網(wǎng) 閱讀:1365 次 日期:2015-03-16 11:54:46
溫馨提示:易賢網(wǎng)小編為您整理了“PHP使用ffmpeg給視頻增加字幕顯示的方法”,方便廣大網(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 (preg_match("'\.(avi)$'", $file) ){

$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 phpsnaps ! 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ì)有所幫助。

更多信息請(qǐng)查看IT技術(shù)專欄

更多信息請(qǐng)查看網(wǎng)絡(luò)編程
易賢網(wǎng)手機(jī)網(wǎng)站地址:PHP使用ffmpeg給視頻增加字幕顯示的方法
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn)

版權(quán)所有:易賢網(wǎng)