2
저는 비디오를 base64 문자열로 변환하려고합니다. 그래서 migBase64 메소드를 안드로이드 내 비디오를 통해 변환합니다. 성공적으로 비디오를 문자열로 변환하지만 비디오에서 문자열을 디코드 할 때 비디오에서 변환이 적절하지 않습니다. 아무도 모른다면 제발 도와주세요.base64에서 비디오를 디코딩하는 방법은 무엇입니까?
내가 다음과 같은 코드를 시도 :
String encodedString;
//Decode Video To String
File tempFile = new File(Environment.getExternalStorageDirectory()+ "/my/part/my_0.mp4");
byte fileContent[] = new byte[3000];
try {
FileInputStream fin = new FileInputStream(tempFile);
while (fin.read(fileContent) >= 0) {
// b.append(Base64.encodeToString(fileContent, true));
encodedString = Base64.encodeToString(fileContent, true);
}
} catch (IOException e) {
}
//Encoding Video To String Successfully.
//Decode String To Video
try {
byte[] decodedBytes = Base64.decodeF
File file2 = new File(Environment.getExternalStorageDirectory()
+ "/my/Converted.mp4");
FileOutputStream os = new FileOutputStream(file2, true);
os.write(decodedBytes);
os.close();
} catch (Exception e) {
// TODO: handle exception
Log.e("Error", e.toString());
}
// Problem is in Decoding.
내 문제는 비디오에 문자열을 디코드, 내 원래 비디오는 1MB입니다 및 비디오를 디코딩 한 후 1.1 킬로바이트입니다 내 원본 비디오가 저를 도와주세요 변환하지.
비디오 처리를 위해 ffmpeg를 사용하십시오. –
예가 있습니까? – Rajneesh
이 https://github.com/churnlabs/android-ffmpeg-sample –