ffmpeg 동영상 이미지 캡쳐 및 스트리밍서버로 데이타 전송하기 > 그누4 팁자료실

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

ffmpeg 동영상 이미지 캡쳐 및 스트리밍서버로 데이타 전송하기 정보

ffmpeg 동영상 이미지 캡쳐 및 스트리밍서버로 데이타 전송하기

본문

ffmpeg를 이용해서 동영상이미지 캡쳐및 스트리밍서버로 데이타 전송하기입니다.

** 기본적 플로우 **

동영상파일 -->> 임시디렉토리에 업로드 -->> 동영상 변환 및 영상캡쳐

-->> 스트리밍서버접속 및 동영상 이전 -->> 임시디렉토리파일 삭제

-->> 전송할 디렉토리파일정보를 웹서버에 저장.

----------------------전송플로우입니다.----------------------

<?php
    // Handle the file and return the file identifier to the SWF
 if (isset($_FILES["resume_file"]) && isset($_FILES["resume_file"]["name"])) {
  //echo $_FILES["resume_file"]["name"];
  
/*************************************************************************/
 /**********************디렉토리에 업로드할경우*******************************/

 //$upload_path = str_replace("\\", "/", realpath(dirname($_SERVER['SCRIPT_FILENAME']))) . "/uploads/";
 $upload_path = "uploads/";

  $ext = strtolower(substr(strrchr($_FILES["resume_file"]["name"],"."), 1)); //확장자

//세팅할 파일명
 $seting_name  = "";
 $seting_name .= time();
 $seting_name .= time();
 $seting_name .= ".".$ext;
 

 
 //세팅할 주소
 $seting_path  = $upload_path;
 $seting_path .= $seting_name;
 
/****************************
 // Handle the upload
 if (!move_uploaded_file($_FILES["resume_file"]["tmp_name"], $seting_path)) {
  header("HTTP/1.0 500 Internal Server Error");
 }
 ************************8/


 
 // Delete the file.  We don't want it.
 //@unlink($upload_path . $_FILES["Filedata"]["name"]);
 
 /***************************디렉토리 업로드 끝**********************************/


/***********************************동영상변환************************/

  //$in_file  = "2.wmv";
  $in_file  = $_FILES["resume_file"]["tmp_name"];
  $out_name  = time();
  $out_name .= time();

  $rr_path     = "/home/seumi/www/upload2/uploads/";
  $o_i_path    =  $rr_path;
  $o_i_path   .=  $out_name;

 

  exec("/home/seumi/www/ffmpeg/ffmpeg/ffmpeg -i $in_file -an -ss 00:00:14 -an -r 2 -vframes 1 -y $o_i_path%d.jpg ", $output, $error);

//에러가 없다면
   if(!$error){
    $creat_img   = $out_name;
    $creat_img  .= 1;
    $creat_img  .= ".jpg";

  }
  else{
  header("HTTP/1.0 500 Internal Server Error");
  }

/***********************************동영상변환************************/

 

//접속할 서버

 $ftp_server = "접속할아이피주소";
 $ftp_user_name = "계정이름";
 $ftp_user_pass = "계정패스워드";
 $server_port = 21; //포트

 $r_path  = $in_file;

  $ext = strtolower(substr(strrchr($_FILES["resume_file"]["name"],"."), 1)); //확장자

//세팅할 파일명
 $seting_name  = "";
 $seting_name .= time();
 $seting_name .= time();
 $seting_name .= ".".$ext;

$fp              = fopen($r_path, 'r');
     if (!$fp)
    {
  header("HTTP/1.0 500 Internal Server Error");
    }
   
   
//원격서버에 연결한다.
if(!($fc = ftp_connect($ftp_server, $server_port)))
    die("$server_host : $server_post - connect failed");

//원격서버에 로그인한다.
if(!ftp_login($fc, $ftp_user_name, $ftp_user_pass))
    die("$server_id - login failed");

//디렉토리로 이동
$server_dir  = "/동영상업로드할경로/";
$f_chdir     = ftp_chdir($fc, $server_dir);

   /*
   if (!$f_chdir)
    {
       alert("접속서버 디렉토리변경 실패");
    }
 */

//파일을 업로드 한다.
$ftp_result = ftp_put($fc, $seting_name , $r_path, FTP_BINARY);

 // Delete the file.  We don't want it.
 @unlink($upload_path . $seting_name);
 @unlink($upload_path . $ch_file);
/*************************************************************************/
  
  echo $seting_name;
  echo "|";
  echo $creat_img;
  echo "|";
  echo $file_size;
  echo "|";
  echo $file_type;

  
 } else {
  echo ' ';
 }
?>

-------------------------------------

해당결과물정보를 그누보드 게시판 여분필드에 저장하세요.

추천
2

댓글 2개

전체 2 |RSS
그누4 팁자료실 내용 검색
  • 개별 목록 구성 번호 제목 작성자 작성일 추천 조회
  • 게시물이 없습니다.

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT