This commit is contained in:
wangjinlei
2024-05-16 13:54:42 +08:00
parent 1b3803074d
commit 7beb2b2b2c
6 changed files with 24 additions and 22 deletions

View File

@@ -5,24 +5,24 @@ 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 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 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()