Commit d6caa6e5 authored by yanzg's avatar yanzg

视频转换

parent 6cbc6257
......@@ -102,21 +102,18 @@ public class MediaHelper extends ImageHelper {
);
parameter.init(grabber, recorder);
try {
// 开始转换
// recorder.start(grabber.getFormatContext());
recorder.start();
// 转码没有图像
if (Frame) {
// 开始转换
recorder.start();
Frame frame;
while ((frame = grabber.grabFrame(true, true, true, false)) != null) {
// if (grabber.grabPacket() == null) {
// continue;
// }
recorder.record(frame);
}
} else {
// 开始转换
recorder.start(grabber.getFormatContext());
avcodec.AVPacket packet;
long t1 = System.currentTimeMillis();
while ((packet = grabber.grabPacket()) != null) {
recorder.recordPacket(packet);
}
......
......@@ -45,7 +45,7 @@ public class TestMediaHelper {
public void testConvertSingle() throws IOException {
String fileName = "100M.mp4";
// String fileName = "z001594372388232a3017ad69c82a342.MOV";
testConvert(fileName, 1, 1);
testConvert(fileName, 0.5f, 0.5f);
}
private void testConvert(String fileName, float size, float quote) throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment