Open naffan2014 opened 2 years ago
Hello @naffan2014 , thanks for reporting this. You are welcome to enhance that code part. And in future, please post the full stack trace when you got any exception
this problem caused by ffmpeg version 4.4.x, since the jave version is above 3.2.0.
to reproduce this issue, please run below junit code
@Test
public void testMergeFiles() {
VideoProcessor vps = new VideoProcessor();
String workdir = "testMergeFiles";
String sample = "desktop01.flv";
String output = "desktop01sum.flv";
String baseDir = System.getProperty("java.io.tmpdir") + File.separator + workdir;
List<String> files = new LinkedList<>();
files.add(baseDir + "/" + sample);
List<File> videos = files
.stream()
.map(File::new)
.collect(Collectors.toList());
File mergedFile = new File(baseDir + File.separator + output);
try {
vps.catClipsTogether(videos, mergedFile, new EchoingProgressListener("Test Merge Files"));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (EncoderException e) {
e.printStackTrace();
}
}
merge files task will failed, and get this exception, please notice the command line of the second DEBUG message.
21:40:39,296 [DEBUG ] ProcessWrapper.execute(ProcessWrapper.java:99) - About to execute C:\Users\xxx\workspace\temp\jave\ffmpeg-amd64-3.2.0.exe -f concat -safe 0 -i C:\Users\xxx\workspace\temp\testMergeFiles\desktop01sum.flv.merge.txt -vcodec copy -movflags faststart -an -y C:\Users\xxx\workspace\temp\testMergeFiles\desktop01sum.flv -hide_banner
21:40:42,593 [DEBUG ] ProcessWrapper.execute(ProcessWrapper.java:99) - About to execute C:\Users\xxx\workspace\temp\jave\ffmpeg-amd64-3.2.0.exe -i C:\Users\xxx\workspace\temp\testMergeFiles\desktop01sum.flv.merge.txt -hide_banner
....
ws.schild.jave.InputFormatException: Invalid data found when processing input
at ws.schild.jave.MultimediaObject.parseMultimediaInfo(MultimediaObject.java:217)
at ws.schild.jave.MultimediaObject.getInfo(MultimediaObject.java:165)
at ws.schild.jave.Encoder.encode(Encoder.java:534)
at ws.schild.jave.Encoder.encode(Encoder.java:351)
at ws.schild.jave.VideoProcessor.catClipsTogether(VideoProcessor.java:83)
because the ffmpeg 4.4.x did not accept arguments "-i merge.txt",
here is the command line output difference between ffmpeg v4.4.1 and v4.2.2
$ ./ffmpeg-amd64-4.2.2-static -i ../feature1/desktop01sum.flv.merge.txt -hide_banner
Input #0, tty, from '../feature1/desktop01sum.flv.merge.txt':
Duration: 00:00:00.04, bitrate: 23 kb/s
Stream #0:0: Video: ansi, pal8, 640x400, 25 fps, 25 tbr, 25 tbn, 25 tbc
At least one output file must be specified
$ ./ffmpeg-amd64-4.4.1-static -i ../feature1/desktop01sum.flv.merge.txt -hide_banner
../feature1/desktop01sum.flv.merge.txt: Invalid data found when processing input
I have submit the patch for this issue. #209
otherwise, we may need downgrade the jave-nativebin-xxx version to 3.1.1 to invoid this issue.
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-linux64</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win64</artifactId>
<version>3.1.1</version>
</dependency>
jave 3.2.0
First,i have add lots of videos in encode()
As we can see above,i want to get more informations from MonitoringConcatListener. this is my code
At the end, when i ran my code , jvm throw a null pointer exception. After my digging into your code.i found that in Encoder.java lines 551:
i don't understand why you miss List logic. if it is a bug? or my fault?