예제 #1
0
파일: update.php 프로젝트: h3len/Project
$rename = @rename($mp4, $source_file);
if (!$rename) {
    error_output('005', '视频权限限制,无法编辑视频');
}
$mediainfo = new mediainfo($source_file);
$source_file_data = $mediainfo->getMeidaInfo();
$source = array();
foreach ($svodid as $k => $vid) {
    $video_dir = hg_num2dir($vid);
    $targerdir = TARGET_DIR . $video_dir . $vid . '.ssm/';
    if ($vid == $vodid) {
        $sourcef = $source_file;
        $data = $source_file_data;
    } else {
        $sourcef = $targerdir . $vid . '.mp4';
        if (!is_file($sourcef)) {
            error_output('006', '指定片段视频不存在');
        }
        $mediainfo->setFile($sourcef);
        $data = $mediainfo->getMeidaInfo();
    }
    $source[] = array('source' => $sourcef, 'start' => intval($start[$k]), 'duration' => intval($duration[$k]), 'mediainfo' => $data);
}
$curl = new curl($gVodApi['host'], $gVodApi['dir'], $gVodApi['token']);
$curl->initPostData();
$conf = $curl->request('vod_config.php');
$gTransApi['filename'] = 'getVideoInfo.php';
$trans_info = array('sourceFile' => $source, 'id' => $video_id, 'vodid' => $vodid, 'targetDir' => $targerdir, 'config' => $conf[0], 'callback' => $gTransApi);
hg_file_write(UPLOAD_DIR . FILE_QUEUE . $vodid, json_encode($trans_info));
$data = array('id' => $video_id, 'vodid' => $vodid, 'trans_info' => $trans_info);
output($data);
예제 #2
0
if (!in_array($_INPUT['auth'], $gToken)) {
    error_output('009', '通信令牌错误');
}
$content = @file_get_contents(TRANSCODE_STAT);
$info = json_decode($content, true);
if ($info['files']) {
    $script = explode('/', TRANSCODE_SCRIPT);
    $cmd = PSCMD . $script[count($script) - 1];
    exec($cmd, $out, $t);
    $pid = intval($out[0]);
    if (!$pid) {
        include ROOT_DIR . 'lib/mediainfo.class.php';
        $mediainfo = new mediainfo();
        foreach ($info['files'] as $filepath) {
            if (!is_file(UPLOAD_DIR . $filepath)) {
                continue;
            }
            $mediainfo->setFile(UPLOAD_DIR . $filepath);
            $data = $mediainfo->getMeidaInfo();
            if (!$data) {
                continue;
            }
            $id = explode('/', $filepath);
            $id = $id[count($id) - 1];
            $id = explode('.', $id);
            $id = $id[0];
            hg_file_write(UPLOAD_DIR . FILE_QUEUE . $id, $filepath);
        }
    }
}
output(array('sucess' => 1));
예제 #3
0
if (!is_array($svodid)) {
    $svodid = array($svodid);
    $start = array($start);
    $duration = array($duration);
}
if (count($svodid) != count($start) || count($svodid) != count($duration)) {
    error_output('003', '视频信息不匹配');
}
include ROOT_DIR . 'lib/mediainfo.class.php';
$mediainfo = new mediainfo();
$source = array();
foreach ($svodid as $k => $sid) {
    $video_dir = hg_num2dir($sid);
    $targerdir = TARGET_DIR . $video_dir . $sid . '.ssm/';
    $mp4 = $targerdir . $sid . '.mp4';
    $mediainfo->setFile($mp4);
    $data = $mediainfo->getMeidaInfo();
    $source[] = array('source' => $mp4, 'start' => intval($start[$k]), 'duration' => intval($duration[$k]), 'mediainfo' => $data);
}
$file_id = $_INPUT['vodid'];
if (!$file_id) {
    $file_id = hg_get_video_id();
}
$dir = hg_num2dir($file_id);
$video_dir = hg_num2dir($file_id);
$targerdir = TARGET_DIR . $video_dir . $file_id . '.ssm/';
hg_mkdir($targerdir);
$curl = new curl($gVodApi['host'], $gVodApi['dir'], $gVodApi['token']);
$curl->initPostData();
$conf = $curl->request('vod_config.php');
$gTransApi['filename'] = 'getVideoInfo.php';