我希望在将视频发送到服务器之前压缩或更改视频的分辨率,但我不想花太长时间。例如,对于以下代码,大小为100MB的视频需要2-3分钟才能将其大小调整为10MB。我能否在不损失太多质量的情况下更快地完成任务?
#!/bin/bash
set -e
set -x
rm -rf ./build
mkdir ./build
rm -rf ./bin/
mkdir ./bin/
g++ \
-o ./bin/myprog \
./src/cpp/myprog.c \
-L/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/jre/bin/server/ \
-ljvm \
-Isrc/cpp \
-I/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/include \
-I/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/include/win32
/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/bin/javac \
-Xlint:all \
-Werror \
-g \
-verbose \
-cp ./build \
-sourcepath ./src/java \
-d ./build \
./src/java/myPackage/MyClass.java
/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/bin/jar \
cvf ./bin/myPackage.jar \
-C ./build \
myPackage/MyClass.class
/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/bin/jar tf ./bin/myPackage.jar
cd ./bin
PATH=/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/jre/bin/server/:/cygdrive/c/Program\ Files/Java/jdk1.8.0_131/bin/:$PATH ./myprog
上述命令的控制台输出:
String[] command = {"-i", filePath, "-vf", "scale=640:360", "-c:a", "copy", "-preset", "ultrafast", dest.getAbsolutePath()};