Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit code of ffmpeg encoding run is 1 #251

Open
czdsd00 opened this issue Dec 28, 2023 · 5 comments
Open

Exit code of ffmpeg encoding run is 1 #251

czdsd00 opened this issue Dec 28, 2023 · 5 comments

Comments

@czdsd00
Copy link

czdsd00 commented Dec 28, 2023

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:
<[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>-->
<!--        &lt;!&ndash; 在linux上部署 linux服务器需要这个才能生效 linux64位 &ndash;&gt;-->
<!--        <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);
@a-schild
Copy link
Owner

Cannot find a valid font for the family Helvetica

Does your system have a Helvetica font available?

@czdsd00
Copy link
Author

czdsd00 commented Dec 28, 2023

I have tried using '华文仿宋' and 'Helvetica', which are in my Mac's Font Book.

@a-schild
Copy link
Owner

What JVM are you using?
Perhaps these fonts are not exposed in the JVM?
Architecture differences between m1/m2 chips and the intel ones

@czdsd00
Copy link
Author

czdsd00 commented Dec 28, 2023

i use jdk 8.361,m2 chips and another workmate use intel also can't run it

@a-schild
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants