时长信息转到video主体 增加多线程获取时间方法
This commit is contained in:
@@ -5,11 +5,25 @@ import com.aliyun.teautil.models.RuntimeOptions;
|
||||
import com.aliyun.vod20170321.Client;
|
||||
import com.aliyun.vod20170321.models.GetVideoPlayAuthRequest;
|
||||
import com.aliyun.vod20170321.models.GetVideoPlayAuthResponse;
|
||||
import org.bytedeco.javacv.FFmpegFrameGrabber;
|
||||
import org.bytedeco.javacv.FrameGrabber;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class SpdbUtil {
|
||||
|
||||
public static Integer getMp4Duration(String url){
|
||||
double duration = 0;
|
||||
try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(url)) {
|
||||
frameGrabber.start();
|
||||
duration = frameGrabber.getLengthInTime()/1000000;
|
||||
frameGrabber.stop();
|
||||
} catch (FrameGrabber.Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return (int)duration;
|
||||
};
|
||||
|
||||
public static GetVideoPlayAuthResponse getPlayAuth(String vid) throws Exception {
|
||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||
|
||||
Reference in New Issue
Block a user