画像変換
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
[[定点カメラ]]
- カメラ画像を日にち単位に集める
function move_file($yesterday, $yesterday2, $DBY, $camera)
{
$srcdir = "/mnt/dsk4/www/html/" . $camera . "/";
$destdir = "/mnt/dsk4/picture/" . $camera . "/" . $ye...
$dir_pre= "snapshot_";
$file_pre= "motion-";
$file_dir = $dir_pre.$yesterday; // snapshot_20...
$file_dir2 = $dir_pre.$DBY; // snapshot_20...
$file_name = $file_pre.$yesterday2; // motion-2016...
// ディレクトリの作成
mkdir($destdir, 0777);
// カメラ画像を日にち単位に集める
$dh = opendir($srcdir);
while(false !== ($fn = readdir($dh))){
if($fn !== '.' && $fn !== '..' && is_dir($srcdir....
// 対象となるディレクトリかのチェック
if(strpos($fn, $file_dir, 0)===0 || strpos($f...
$targetdir = $srcdir.$fn;
$dh2 = opendir($targetdir);
while(false !== ($fn2 = readdir($dh2))){
if($fn2 !== '.' && $fn2 !== '..' && !...
// 対象となるファイルかのチェック
if(strpos($fn2, $file_name, 0)===...
$srcfile = $srcdir.$fn.'/'.$f...
$destfile = $destdir.'/'.$fn2;
if(filesize($srcfile)){
copy($srcfile, $destfile);
}
}
}
}
closedir($dh2);
}
}
}
closedir($dh);
}
- 画像にファイル名称を埋め込む。
動画の内容が何時に起きたかを確認するために、時間情報が必...
画像名称は motion-2015-03-15-11-30-43.jpg という感じに ”...
Windows では、IrfanView を使用していましたが、コマンドラ...
function fill_filename($yesterday, $camera)
{
$srcdir = "/mnt/dsk4/picture/".$camera."/".$yesterday;
$destdir = "/mnt/dsk4/picture/".$camera."/".$yesterda...
$file_pre= "motion-";
$file_post= ".jpg";
// ディレクトリの作成
mkdir($destdir, 0777);
// ファイル名で整頓する
$dh = opendir($srcdir);
$array_file = array();
while(false !== ($fn = readdir($dh))){
if($fn !== '.' && $fn !== '..' && !is_dir($srcdir...
if(filesize($srcdir.'/'.$fn) != 0){
array_push($array_file, $fn);
}
}
}
closedir($dh);
sort($array_file);
// ファイル名を埋め込む
$destno = 1;
$destno5 = sprintf("%05d", $destno);
foreach($array_file as $val){
$srcfile = $srcdir.'/'.$val;
$destfile = $destdir . '/' . $file_pre . $destno5...
$cmd = 'convert ' . $srcfile . ' -fill white -poi...
shell_exec($cmd);
$destno ++;
$destno5 = sprintf("%05d", $destno);
}
}
- 静止画を連結し、mp4 動画を作成する。
function make_movie($yesterday, $camera)
{
/*
連番jpeg を avi file に変換
ffmpeg -i /mnt/dsk4/picture/qwatch2/20171125/movie/motio...
-vcodec copy /mnt/dsk4/picture/qwatch2/20171125/mo...
avi file を mp4 file に変換
ffmpeg -i /mnt/dsk4/picture/qwatch2/20171125/movie/20171...
-pix_fmt yuv420p -crf 18 /mnt/dsk1/www/html/qwatch...
*/
$srcdir = "/mnt/dsk4/picture/".$camera."/".$yesterday;
$destdir = "/mnt/dsk4/picture/".$camera."/".$yesterda...
$movie_dir = "/mnt/dsk1/www/html/".$camera."/tmp";
$src_file = "motion-%05d.jpg";
$avi_post = ".avi";
$mp4_post = ".mp4";
// ムービーにする
$cmd = 'ffmpeg -i ' . $destdir . '/' . $src_file . ' ...
shell_exec($cmd);
$cmd = 'ffmpeg -i ' . $destdir . '/' . $yesterday . $...
shell_exec($cmd);
}
- 作業の終わった jpeg を削除。
function delete_file($yesterday, $yesterday2, $DBY, $cam...
{
$srcdir = "/mnt/dsk4/www/html/" . $camera . "/";
$destdir = "/mnt/dsk4/picture/" . $camera . "/" . $ye...
$dir_pre= "snapshot_";
$file_pre= "motion-";
$file_dir = $dir_pre.$yesterday; // snapshot_20...
$file_dir2 = $dir_pre.$DBY; // snapshot_20...
$file_name = $file_pre.$yesterday2; // motion-2016...
$cmd = 'cd ' . $srcdir ;
shell_exec($cmd);
$cmd = 'rm -Rf ' . $file_dir2 . "*" ;
shell_exec($cmd);
$cmd = 'rm -Rf ' . $destdir ;
shell_exec($cmd);
}
終了行:
[[定点カメラ]]
- カメラ画像を日にち単位に集める
function move_file($yesterday, $yesterday2, $DBY, $camera)
{
$srcdir = "/mnt/dsk4/www/html/" . $camera . "/";
$destdir = "/mnt/dsk4/picture/" . $camera . "/" . $ye...
$dir_pre= "snapshot_";
$file_pre= "motion-";
$file_dir = $dir_pre.$yesterday; // snapshot_20...
$file_dir2 = $dir_pre.$DBY; // snapshot_20...
$file_name = $file_pre.$yesterday2; // motion-2016...
// ディレクトリの作成
mkdir($destdir, 0777);
// カメラ画像を日にち単位に集める
$dh = opendir($srcdir);
while(false !== ($fn = readdir($dh))){
if($fn !== '.' && $fn !== '..' && is_dir($srcdir....
// 対象となるディレクトリかのチェック
if(strpos($fn, $file_dir, 0)===0 || strpos($f...
$targetdir = $srcdir.$fn;
$dh2 = opendir($targetdir);
while(false !== ($fn2 = readdir($dh2))){
if($fn2 !== '.' && $fn2 !== '..' && !...
// 対象となるファイルかのチェック
if(strpos($fn2, $file_name, 0)===...
$srcfile = $srcdir.$fn.'/'.$f...
$destfile = $destdir.'/'.$fn2;
if(filesize($srcfile)){
copy($srcfile, $destfile);
}
}
}
}
closedir($dh2);
}
}
}
closedir($dh);
}
- 画像にファイル名称を埋め込む。
動画の内容が何時に起きたかを確認するために、時間情報が必...
画像名称は motion-2015-03-15-11-30-43.jpg という感じに ”...
Windows では、IrfanView を使用していましたが、コマンドラ...
function fill_filename($yesterday, $camera)
{
$srcdir = "/mnt/dsk4/picture/".$camera."/".$yesterday;
$destdir = "/mnt/dsk4/picture/".$camera."/".$yesterda...
$file_pre= "motion-";
$file_post= ".jpg";
// ディレクトリの作成
mkdir($destdir, 0777);
// ファイル名で整頓する
$dh = opendir($srcdir);
$array_file = array();
while(false !== ($fn = readdir($dh))){
if($fn !== '.' && $fn !== '..' && !is_dir($srcdir...
if(filesize($srcdir.'/'.$fn) != 0){
array_push($array_file, $fn);
}
}
}
closedir($dh);
sort($array_file);
// ファイル名を埋め込む
$destno = 1;
$destno5 = sprintf("%05d", $destno);
foreach($array_file as $val){
$srcfile = $srcdir.'/'.$val;
$destfile = $destdir . '/' . $file_pre . $destno5...
$cmd = 'convert ' . $srcfile . ' -fill white -poi...
shell_exec($cmd);
$destno ++;
$destno5 = sprintf("%05d", $destno);
}
}
- 静止画を連結し、mp4 動画を作成する。
function make_movie($yesterday, $camera)
{
/*
連番jpeg を avi file に変換
ffmpeg -i /mnt/dsk4/picture/qwatch2/20171125/movie/motio...
-vcodec copy /mnt/dsk4/picture/qwatch2/20171125/mo...
avi file を mp4 file に変換
ffmpeg -i /mnt/dsk4/picture/qwatch2/20171125/movie/20171...
-pix_fmt yuv420p -crf 18 /mnt/dsk1/www/html/qwatch...
*/
$srcdir = "/mnt/dsk4/picture/".$camera."/".$yesterday;
$destdir = "/mnt/dsk4/picture/".$camera."/".$yesterda...
$movie_dir = "/mnt/dsk1/www/html/".$camera."/tmp";
$src_file = "motion-%05d.jpg";
$avi_post = ".avi";
$mp4_post = ".mp4";
// ムービーにする
$cmd = 'ffmpeg -i ' . $destdir . '/' . $src_file . ' ...
shell_exec($cmd);
$cmd = 'ffmpeg -i ' . $destdir . '/' . $yesterday . $...
shell_exec($cmd);
}
- 作業の終わった jpeg を削除。
function delete_file($yesterday, $yesterday2, $DBY, $cam...
{
$srcdir = "/mnt/dsk4/www/html/" . $camera . "/";
$destdir = "/mnt/dsk4/picture/" . $camera . "/" . $ye...
$dir_pre= "snapshot_";
$file_pre= "motion-";
$file_dir = $dir_pre.$yesterday; // snapshot_20...
$file_dir2 = $dir_pre.$DBY; // snapshot_20...
$file_name = $file_pre.$yesterday2; // motion-2016...
$cmd = 'cd ' . $srcdir ;
shell_exec($cmd);
$cmd = 'rm -Rf ' . $file_dir2 . "*" ;
shell_exec($cmd);
$cmd = 'rm -Rf ' . $destdir ;
shell_exec($cmd);
}
ページ名: