Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. public static void method() throws InterruptedException, IOException {
  2.                 final Path videoIn      = Paths.get("http://sdsdsdaadsa:9981/stream/channel/secrectkey");
  3.                
  4.                 final Path encodingFile = Paths.get("/momomo/Generated/Tv/a.mp4");
  5.                 final Path errorFile    = Paths.get("/momomo/Generated/Tv/a.error");
  6.        
  7.                
  8.                 Files.deleteIfExists(encodingFile);
  9.                 Files.deleteIfExists(errorFile);
  10.                
  11.                 final ProcessBuilder pb
  12.                         = new ProcessBuilder("ffmpeg",
  13.                         "-i", videoIn.toString(),
  14.                         "-y",
  15.                         "-s", "360x480", // stripped the extraneous "-1"
  16.                         "-vcodec", "libx264",
  17.                         "/momomo/Generated/Tv/a.mp4"
  18.                 );
  19.                
  20.                 // pb.redirectOutput(ProcessBuilder.Redirect.PIPE);
  21.                        
  22.                 pb.redirectError  (errorFile.toFile());
  23.                 pb.redirectOutput (encodingFile.toFile());
  24.                
  25.                 final Process p = pb.start();
  26.                
  27.                 int code = p.waitFor();
  28.                
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement