2013-05-16 3 views
1

사용자가 업로드 한 비디오를 처리 할 수있는 적절한 명령 줄 도구 을 선택하는 것에 대한 제안이 필요합니다. I를 처리하여최상의 서버 측 비디오 프로세싱 라이브러리 또는 소프트웨어

의미 :

  • 변환이 FLV하기, MP4, OGG 등 형식
  • 수정 품질, 비트 레이트, 프레임 속도 등
  • 제어 파일 크기와
  • 가 처리해야 할 수도 있습니다 다른 속성 비디오 일괄 모드에서

이 처리는 파일을 가져올 일부 예약 된 프로세스를 통해 수행되지만 그런 다음 처리합니다. 이 도구에는 명령 줄 유틸리티가 있어야합니다.

무료 FFMPEG 라이브러리 만 알고 있습니다. 내가 할 수있게 해주는 다른 도구가 있습니까?

youtube가 알고있는 내용은 무엇입니까?

답변

1

ffmpeg 꽤 아주 좋은 오픈 소스 자산 및 자원을 안전하게 가지고 좋은 라이브러리 주셔서 감사합니다. ffmpeg라는 작업을 수행이 스크립트 (pars_submit)에

@Path("/ffmpeg") 
public class FfmpegResource { 


    @GET 
     @Produces("text/plain") 

     public String getFfmpeg(@QueryParam("infil1") String infil1, 
       @QueryParam("infil2") String infil2, @QueryParam("otfil") String otfil, 
       @QueryParam("t") String time) {   
     String outfil = "dummy.mp4"; 

      List<String> command = new ArrayList<String>(); 
      command.add("vendor/bin/pars_submit"); 

      command.add(infil1);  

      command.add(infil2); 
      command.add(otfil); 
      command.add(time); 

System.out.println("Starting process " +command.toString()); 
      ProcessBuilder builder = new ProcessBuilder(command); 
      Map<String, String> environ = builder.environment(); 
      Process process = null; 
      try { 
       process = builder.start(); 

      InputStream is = process.getInputStream(); 

      InputStreamReader isr = new InputStreamReader(is); 
      BufferedReader br = new BufferedReader(isr); 
      String line; 
      while ((line = br.readLine()) != null) { 

       outfil=line; 
      } 

      } catch (IOException e) { 
       // TODO Auto-generated catch block 
       e.printStackTrace(); 
      } 
      finally { 
        if (process != null) { 
        process.destroy(); 
        process = null; //   int exitVal = process.waitFor(); 
//   System.out.println("Process exitValue: " + exitVal); 
        }         
       }           
      return outfil;        
       } 
} 

전화 :

나는 그것을 실제는 FFmpeg은이 과정에 의해 호출되는 자바 (JAX-RS) REST API의 서버 측을 사용합니다 :

#!/bin/bash 
shopt -s globstar 
uri=$1 
filnam="${uri##*/}" 
uri2=$2 
filnam2="${uri2##*/}" 
otfil=$3 
time=$4 
curl -#LO $uri 
curl -#LO $uri2 
ffmpeg -y -loop 1 -i "$filnam" -i "$filnam2" -t "$time" -r 1/2 -pass 1 -vcodec libx264 -b:v 200k -bt 50k -an -f mp4 -strict -2 -passlogfile mydummy /dev/null 
# echo "ffmpegP1 Exit status" $? 
ffmpeg -y -loop 1 -i "$filnam" -i "$filnam2" -t "$time" -r 1/2 -pass 2 -vcodec libx264 -b:v 200k -bt 50k -f mp4 -strict -2 -passlogfile mydummy -ar 44100 "$otfil" 
# echo "ffmpegp2 Exit status" $? 
# last test 
json=$(curl -X POST -H "X-Parse-Application-Id: 3KxPBTPSTe8f0iexGanSagCztLp6wSPzJkyMLAbR" -H "X-Parse-REST-API-Key: kVl5Z0CXmBSCoQRmE8XSLIDFuLGHMCIkLXXjkuI9" -H "Content-Type: video/mp4" --data-binary @"$otfil" https://api.parse.com/1/files/"$otfil") 
# echo "parse POST Exit status" $? 
echo $json 
관련 문제