1、base64轉化成mp4文件
/** * base64 視頻base64字符串 * videoFilePath 輸出視頻文件路徑帶文件名 */ public static void base64ToVideo(String base64, String videoFilePath) { try { //base解密 byte[] videoByte = new sun.misc.BASE64Decoder().decodeBuffer(base64); File videoFile = new File(videoFilePath); //輸入視頻文件 FileOutputStream fos = new FileOutputStream(videoFile); fos.write(videoByte, 0, videoByte.length); fos.flush(); fos.close(); } catch (IOException e) { log.info("base64轉換為視頻異常"); } }