reghao 2 anni fa
parent
commit
c6ecd015f6

+ 1 - 1
README.md

@@ -1,3 +1,3 @@
-# util
+# jutil
 
 java util

+ 6 - 8
media/src/main/java/cn/reghao/jutil/media/video/FFmpegWrapper.java

@@ -57,14 +57,12 @@ public class FFmpegWrapper {
             double bitRate = format.get("bit_rate").getAsDouble();
 
             MediaProps mediaProps = new MediaProps(audioProps, videoProps);
-            JsonElement tagsElement = format.get("tags");
-            if (tagsElement != null) {
-                JsonElement jsonElement = tagsElement.getAsJsonObject().get("creation_time");
-                if (jsonElement != null) {
-                    String creationTime = jsonElement.getAsString();
-                    LocalDateTime localDateTime = DateTimeConverter.localDateTime(creationTime);
-                    mediaProps.setCreateTime(localDateTime);
-                }
+            JsonObject tags = format.get("tags").getAsJsonObject();
+            JsonElement jsonElement = tags.get("creation_time");
+            if (jsonElement != null) {
+                String creationTime = jsonElement.getAsString();
+                LocalDateTime localDateTime = DateTimeConverter.localDateTime(creationTime);
+                mediaProps.setCreateTime(localDateTime);
             }
 
             return mediaProps;

+ 1 - 1
media/src/test/java/MediaTest.java

@@ -63,7 +63,7 @@ public class MediaTest {
     }
 
     static void videoTest() throws IOException {
-        String src = "/home/reghao/Downloads/0/莫菁柳州艳照门无水印11部MPG大格式合集/MOV08058.MPG";
+        String src = "/home/reghao/Downloads/video.mp4";
         MediaProps mediaProps = FFmpegWrapper.getMediaProps(src);
         if (mediaProps == null) {
             return;

+ 2 - 0
pom.xml

@@ -19,6 +19,8 @@
     <properties>
         <maven.compiler.source>11</maven.compiler.source>
         <maven.compiler.target>11</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     </properties>
 
     <dependencies>