mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
video thumbs temp
This commit is contained in:
parent
347dce3a9c
commit
43fdb127a1
@ -25,10 +25,9 @@ package org.sleuthkit.autopsy.coreutils;
|
|||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -78,7 +77,7 @@ public class ImageUtils {
|
|||||||
"flm", "tmv", "4xm"); //NON-NLS
|
"flm", "tmv", "4xm"); //NON-NLS
|
||||||
private static final List<String> SUPP_VIDEO_MIME_TYPES
|
private static final List<String> SUPP_VIDEO_MIME_TYPES
|
||||||
= Arrays.asList("video/avi", "video/msvideo", "video/x-msvideo",
|
= Arrays.asList("video/avi", "video/msvideo", "video/x-msvideo",
|
||||||
"video/mp4", "video/x-ms-wmv", "mpeg", "asf"); //NON-NLS
|
"video/mp4", "video/x-ms-wmv", "video/mpeg", "video/asf"); //NON-NLS
|
||||||
private static final boolean openCVLoaded;
|
private static final boolean openCVLoaded;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -317,19 +316,18 @@ public class ImageUtils {
|
|||||||
|
|
||||||
final String extension = file.getNameExtension();
|
final String extension = file.getNameExtension();
|
||||||
|
|
||||||
String tempFileName = file.getId() + "." + extension;
|
java.io.File tempFile = Paths.get(Case.getCurrentCase().getTempDirectory(), "videos", file.getId() + "." + extension).toFile();
|
||||||
java.io.File tempFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), tempFileName);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
copyFileUsingStream(file, tempFile); //create small file in TEMP directory from the content object
|
copyFileUsingStream(file, tempFile); //create small file in TEMP directory from the content object
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
return DEFAULT_ICON;
|
return DEFAULT_ICON;
|
||||||
}
|
}
|
||||||
|
|
||||||
tempFileName = tempFile.toString(); //store filepath as String
|
|
||||||
VideoCapture videoFile = new VideoCapture(); // will contain the video
|
VideoCapture videoFile = new VideoCapture(); // will contain the video
|
||||||
|
|
||||||
if (!videoFile.open(tempFileName)) {
|
if (!videoFile.open(tempFile.toString())) {
|
||||||
return DEFAULT_ICON;
|
return DEFAULT_ICON;
|
||||||
}
|
}
|
||||||
double fps = videoFile.get(CV_CAP_PROP_FPS); // gets frame per second
|
double fps = videoFile.get(CV_CAP_PROP_FPS); // gets frame per second
|
||||||
@ -341,7 +339,7 @@ public class ImageUtils {
|
|||||||
|
|
||||||
double timestamp = Math.min(milliseconds, 500); //default time to check for is 500ms, unless the files is extremely small
|
double timestamp = Math.min(milliseconds, 500); //default time to check for is 500ms, unless the files is extremely small
|
||||||
|
|
||||||
int framkeskip = Double.valueOf(Math.floor(timestamp / 9)).intValue();
|
int framkeskip = Double.valueOf(Math.floor(milliseconds / 9)).intValue();
|
||||||
|
|
||||||
Mat imageMatrix = new Mat();
|
Mat imageMatrix = new Mat();
|
||||||
BufferedImage bufferedImage = null;
|
BufferedImage bufferedImage = null;
|
||||||
@ -480,26 +478,29 @@ public class ImageUtils {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static void copyFileUsingStream(Content file, java.io.File jFile) throws IOException {
|
public static void copyFileUsingStream(Content file, java.io.File jFile) throws IOException {
|
||||||
InputStream is = new ReadContentInputStream(file);
|
|
||||||
// copy the file data to the temporary file
|
|
||||||
|
|
||||||
OutputStream os = new FileOutputStream(jFile);
|
try (InputStream is = new ReadContentInputStream(file);) {
|
||||||
byte[] buffer = new byte[8192];
|
// copy the file data to the temporary file
|
||||||
int length;
|
|
||||||
int counter = 0;
|
|
||||||
try {
|
|
||||||
while ((length = is.read(buffer)) != -1) {
|
|
||||||
os.write(buffer, 0, length);
|
|
||||||
counter++;
|
|
||||||
if (counter >= 63) {
|
|
||||||
break; //after saving 500 KB (63*8192)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} finally {
|
// OutputStream os = new FileOutputStream(jFile);
|
||||||
is.close();
|
Files.copy(is, jFile.toPath());
|
||||||
os.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// byte[] buffer = new byte[8192];
|
||||||
|
// int length;
|
||||||
|
// int counter = 0;
|
||||||
|
// try {
|
||||||
|
// while ((length = is.read(buffer)) != -1) {
|
||||||
|
// os.write(buffer, 0, length);
|
||||||
|
// counter++;
|
||||||
|
// if (counter >= 63) {
|
||||||
|
// break; //after saving 500 KB (63*8192)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// } finally {
|
||||||
|
// is.close();
|
||||||
|
// os.close();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#Updated by build script
|
#Updated by build script
|
||||||
#Wed, 15 Apr 2015 18:11:08 -0400
|
#Fri, 10 Jul 2015 10:44:36 -0400
|
||||||
LBL_splash_window_title=Starting Autopsy
|
LBL_splash_window_title=Starting Autopsy
|
||||||
SPLASH_HEIGHT=314
|
SPLASH_HEIGHT=314
|
||||||
SPLASH_WIDTH=538
|
SPLASH_WIDTH=538
|
||||||
@ -8,4 +8,4 @@ SplashRunningTextBounds=0,289,538,18
|
|||||||
SplashRunningTextColor=0x0
|
SplashRunningTextColor=0x0
|
||||||
SplashRunningTextFontSize=19
|
SplashRunningTextFontSize=19
|
||||||
|
|
||||||
currentVersion=Autopsy 3.1.2
|
currentVersion=Autopsy 3.1.3
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#Updated by build script
|
#Updated by build script
|
||||||
#Wed, 15 Apr 2015 18:11:08 -0400
|
#Fri, 10 Jul 2015 10:44:36 -0400
|
||||||
|
|
||||||
CTL_MainWindow_Title=Autopsy 3.1.2
|
CTL_MainWindow_Title=Autopsy 3.1.3
|
||||||
CTL_MainWindow_Title_No_Project=Autopsy 3.1.2
|
CTL_MainWindow_Title_No_Project=Autopsy 3.1.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user