jave2
jave2 copied to clipboard
Exit code of ffmpeg encoding run is 1
Hello When i run a demo ,it tell me "Exit code of ffmpeg encoding run is 1". Message show Unhandled message in step: 2 Line: 23 message: <Fontconfig error: Cannot load default config file> <[Parsed_drawtext_0 @ 0x7fa833f07280] Cannot find a valid font for the family Helvetica> <[AVFilterGraph @ 0x7fa884807700] Error initializing filter 'drawtext' with args 'shadowcolor=0x00000044:shadowx=2:shadowy=2:x=(w-text_w)/2:y=(h-text_h)/2:fontsize=30.0:fontcolor=0xffffff44:text=223:font=Helvetica'>
i use this pom
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>3.4.0</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>ws.schild</groupId>-->
<!-- <artifactId>jave-nativebin-win64</artifactId>-->
<!-- <version>3.4.0</version>-->
<!-- </dependency>-->
<!-- <!– 在linux上部署 linux服务器需要这个才能生效 linux64位 –>-->
<!-- <dependency>-->
<!-- <groupId>ws.schild</groupId>-->
<!-- <artifactId>jave-nativebin-linux64</artifactId>-->
<!-- <version>3.4.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-osxm1</artifactId>
<version>3.4.0</version>
</dependency>
But when my workmate can run it with his windows pc. How can i deal it ?
My demo code:
File sourceVideo = new File(sourceFile);
File target = new File(distFile);
// 如果目标文件已存在,则删除
if (target.exists()) {
target.delete();
}
//todo 定制化水印过滤器
// DrawtextFilter vf = new DrawtextFilter(textWaterMark, "(w-text_w)/2", "(h-text_h)/2", "华文防宋", 30.0, new Color("ffffff", "44"));
DrawtextFilter vf = new DrawtextFilter(textWaterMark, "(w-text_w)/2", "(h-text_h)/2", "Helvetica", 30.0, new Color("ffffff", "44"));
vf.setShadow(new Color("000000", "44"), 2, 2);
// 设置视频属性
VideoAttributes videoAttributes = new VideoAttributes();
videoAttributes.addFilter(vf);
// 设置编码属性
EncodingAttributes attrs = new EncodingAttributes();
attrs.setVideoAttributes(videoAttributes);
attrs.setOutputFormat("mp4");
// 执行编码操作
Encoder encoder = new Encoder();
encoder.encode(new MultimediaObject(sourceVideo), target, attrs, pListener);
Cannot find a valid font for the family Helvetica
Does your system have a Helvetica font available?
I have tried using '华文仿宋' and 'Helvetica', which are in my Mac's Font Book.
What JVM are you using? Perhaps these fonts are not exposed in the JVM? Architecture differences between m1/m2 chips and the intel ones
i use jdk 8.361,m2 chips and another workmate use intel also can't run it
Can you look at /System/Library/Fonts/ and /Library/Fonts/ if there exists such a font in ttf format?
It looks like the Helvetica ist a ttc font, wich might not be handled by ffmpeg. Is the ffmpeg build you use including a recent freetype support?