当前位置: 首页 > news >正文

安阳日报电子版欧美seo查询

安阳日报电子版,欧美seo查询,济宁网站建设平台,商洛网站开发关于环境配置ffmpeg安装使用的看之前文章 哔哩哔哩缓存转码|FFmpeg将m4s文件转为mp4|PHP自动批量转码B站视频 <?php date_default_timezone_set("PRC"); header("Content-type: text/html; charsetutf-8"); set_time_limit(0);// 遍历获取文件 functi…

关于环境配置ffmpeg安装使用的看之前文章 哔哩哔哩缓存转码|FFmpeg将m4s文件转为mp4|PHP自动批量转码B站视频

<?php
date_default_timezone_set("PRC");
header("Content-type: text/html; charset=utf-8");
set_time_limit(0);// 遍历获取文件
function getDirFile($path = null, $deep = true)
{if (empty($path)) {return [];}$files = scandir($path);$fileItem = [];foreach ($files as $v) {$newPath = $path . DIRECTORY_SEPARATOR . $v;if ($deep && is_dir($newPath) && $v != '.' && $v != '..') {if (is_numeric($deep)) {$deep--;}$fileItem = array_merge($fileItem, getDirFile($newPath, $deep));} else if (is_file($newPath)) {$fileItem[] = $newPath;}}return $fileItem;
}// 遍历获取文件夹
function getDir($path = null, $deep = true)
{if (empty($path)) {return [];}$files = scandir($path);$dirList = [];foreach ($files as $v) {$newPath = $path . DIRECTORY_SEPARATOR . $v;if (is_dir($newPath) && $v != '.' && $v != '..') {$dirList[] = $newPath;if ($deep) {if (is_numeric($deep)) {$deep--;}$dirList = array_merge($dirList, getDir($newPath, $deep));}}}return $dirList;
}//判断文件夹是否存在,没有则新建。
if (!function_exists('mkdirs')) {function mkdirs($dir, $mode = 0777){if (is_dir($dir) || @mkdir($dir, $mode)) {return true;}if (!mkdirs(dirname($dir), $mode)) {return false;}return @mkdir($dir, $mode);}
}// 删除指定文件
function deleteFile($filename)
{// 检查文件是否存在if (file_exists($filename)) {// 尝试删除文件if (unlink($filename)) {return null;} else {return "文件删除失败";}} else {return "文件不存在";}
}/*** 操作文件夹* addtime 2020年7月17日* @param [type] $dirname 文件夹路径* @param boolean $self  是否删除文件夹本身[true是 false否] 具体看需求* @return void*/
function do_rmdir($dirname, $self = false)
{# 检查文件或目录是否存在if (!file_exists($dirname)) {return false;}# 是文件进行删除if (is_file($dirname) || is_link($dirname)) {return unlink($dirname);}# 开始读取目录$dir = dir($dirname);if ($dir) {while (false !== $entry = $dir->read()) {if ($entry == '.' || $entry == '..') {continue;}# 进行文件删除do_rmdir($dirname . '/' . $entry);}}# 关闭目录$dir->close();# 是否删除本身文件夹$self && rmdir($dirname);# 成功返回return ['code' => 200];
}// 命令参数字段映射
$cmdFiledMap = array('P' => 'path','D' => 'debug','H' => 'help',
);
// 命令行参数变量
$console = array();
if (preg_match_all('/--(\w+)(=(.*?)(?=\s--|$))?/u', implode(' ', array_slice($_SERVER['argv']/*获取命令行参数的完整字符串*/, 1)), $matches)) {$console = [];for ($i = 0; $i < count($matches[0]); $i++) {$key = $matches[1][$i];$value = $matches[3][$i];$console[$key] = $value;}foreach ($cmdFiledMap as $key => $item) {if (isset($console[$key])) {if (empty($console[$item]) && !empty($console[$key])) {$console[$item] = $console[$key];}unset($console[$key]);}}
}
// 判断是否要获取使用方法
if (empty($console) || isset($console['help']) || empty($console['path'])) {$errMsg = array('help:','  as => php index.php --path=your_resource_path --debug=0','OR','  as => php index.php --F=your_resource_path --D=1','','',);die(implode(PHP_EOL . PHP_EOL, $errMsg));
}$outputDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $console['path'] . 'Mp4';
do_rmdir($outputDir, true);
mkdirs($outputDir);
$isDebug = !empty($console['debug']);$list = getDir($console['path'], false);
if (empty($list)) {die(PHP_EOL . '空文件夹。。。');
}
$startTime = time();
foreach ($list as $key => $item) {$itemDirName = basename($item); // 目录名$fileList = getDirFile($item);$listText = array();foreach ($fileList as $keyx => $itemx) {$itemxInfo = pathinfo($itemx);$midifyTime = filemtime($itemx); // 最后一次修改时间$ext = $itemxInfo['extension'];if ($ext == 'mp4') {$listText[$midifyTime] = "file '" . basename($itemx) . "'";}}ksort($listText);$listTextPath = $item . DIRECTORY_SEPARATOR . 'list.txt';file_put_contents($listTextPath, implode(PHP_EOL, $listText));$outputFileName = $outputDir . DIRECTORY_SEPARATOR . $itemDirName . '.mp4';$cmd = "ffmpeg " . ($isDebug ? "" : "-loglevel quiet") . " -f concat -safe 0 -i {$listTextPath} -c copy {$outputFileName}";echo $cmd . PHP_EOL;shell_exec($cmd); // cmd可执行// 删除list.txt 临时文件deleteFile($listTextPath);
}echo PHP_EOL . '处理完成, 耗时:' . (time() - $startTime) . '秒';
http://www.ds6.com.cn/news/27857.html

相关文章:

  • 坂田公司做网站营业推广促销
  • 网站建设岗位网盘资源
  • 读书郎营销网站关键字参数
  • 网站建设培训网站seo快速排名
  • 影视网站建设目的500个游戏推广群
  • 1sose wordpress东莞seo
  • 合肥网站制作公司有哪些公司长沙网站搭建关键词排名
  • 网页游戏网站搭建移动广告联盟
  • 手机网站的后台管理站长统计入口
  • 在线制作论坛网站无锡seo培训
  • 兰州企业网站建设多少钱网页设计代码案例
  • 顺德网站制作案例价格河南郑州做网站的公司
  • 做国外网站收款怎么收长沙seo行者seo09
  • 自己做网站用什么数据库优化设计答案四年级上册语文
  • 郑州企业网站排名优化公司百度极速版下载安装
  • 开发区网站建设得物app的网络营销分析论文
  • 全国做网站公司排名qq引流推广软件免费
  • 东莞网站搭建网络广告图片
  • 中信建设有限责任公司内部网站百度一下你就知道啦
  • 养殖网站源码合川网站建设
  • 网站结构图百度百家号怎么赚钱
  • 局域网的网站建设百度搜索优化
  • 中国建筑业网福州seo优化排名推广
  • 做非法网站要多少钱百度seo分析工具
  • 手机网站页面模板海外推广营销平台
  • 做电影网站用什么服务器比较好公司企业网站制作
  • 广东省公路建设公司官方网站百度seo关键词优化
  • 网站开发app行业网站有哪些平台
  • wordpress伪装成破解成功关键词优化步骤简短
  • 无锡微网站网店怎么开