a-schild / jave2

The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project
GNU General Public License v3.0
1.2k stars 246 forks source link

ws.schild.jave.EncoderException: Exit code of ffmpeg encoding run is 1 #225

Closed jiangxiulong closed 1 year ago

jiangxiulong commented 1 year ago

introduction:

Local normal, AliCloud server reports an error

error:

ws.schild.jave.Encoder:637] - Process exit code: 1 to xxxxx.mp3 ws.schild.jave.EncoderException: Exit code of ffmpeg encoding run is 1 at ws.schild.jave.Encoder.encode(Encoder.java:638) at ws.schild.jave.Encoder.encode(Encoder.java:481) at ws.schild.jave.Encoder.encode(Encoder.java:351) at ws.schild.jave.Encoder.encode(Encoder.java:318)

AliCloud:

Ubuntu 22.04.1 LTS

Local:

macOS 11.6

pom:

<dependency>
            <groupId>ws.schild</groupId>
            <artifactId>jave-all-deps</artifactId>
            <version>3.3.1</version>
</dependency>

code:

public static String wavToMp3(String filePath) {
        try {
            File source = new File(filePath);
            String outPath = filePath.replaceAll(".wav", "").concat(".mp3");
            File target = new File(outPath);

            AudioAttributes audio = new AudioAttributes();
            audio.setCodec("libmp3lame");
            audio.setBitRate(new Integer(320000));
            audio.setChannels(new Integer(2));
            audio.setSamplingRate(new Integer(44100));

            EncodingAttributes attrs = new EncodingAttributes();
            attrs.setOutputFormat("mp3");
            attrs.setAudioAttributes(audio);

            Encoder encoder = new Encoder();
            MultimediaObject multimediaObject = new MultimediaObject(source);
            System.out.println(multimediaObject);
            encoder.encode(new MultimediaObject(source), target, attrs);
            return outPath;
        } catch (EncoderException e) {
            e.printStackTrace();
            return "";
        }
    }

root@xxxx:/data/excel# ffmpeg -i test.wav

ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 11 (Ubuntu 11.2.0-19ubuntu1) configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, wav, from 'test.wav': Duration: 00:04:54.51, bitrate: 2304 kb/s Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s At least one output file must be specified`

Sorry for poor English!!!!!!!!!

jiangxiulong commented 1 year ago

The WAV file is too large to upload

a-schild commented 1 year ago

Please enable more detailed logging, so we see what happens

jiangxiulong commented 1 year ago

I have turned on the debug log level. I don't see any more log information. It needs an additional way to turn it on. If not, it is my own log level. Let me see again

jiangxiulong commented 1 year ago

Today's retest is suddenly better. Yesterday, a ffmpeg server was installed. I don't know if it is affected. I will test it later. Now I'm running fast. I'm the Docker environment

a-schild commented 1 year ago

Have you also included the native jar for your platform? For Ubuntu 64 Bit it would be

<dependency>
    <groupId>ws.schild</groupId>
    <artifactId>jave-nativebin-linux64</artifactId>
    <version>3.3.1</version>
</dependency>
jiangxiulong commented 1 year ago

I only added this one to the pom file. This should include the one you said

 <dependency>
            <groupId>ws.schild</groupId>
            <artifactId>jave-all-deps</artifactId>
            <version>3.3.1</version>
</dependency>
smalllh commented 1 year ago

I only added this one to the pom file. This should include the one you said

 <dependency>
            <groupId>ws.schild</groupId>
            <artifactId>jave-all-deps</artifactId>
            <version>3.3.1</version>
</dependency>

you can print stdout or stderr, maybe it can help you to get more infomation

smalllh commented 1 year ago

You can run it on ubantu through the command line

smalllh commented 1 year ago

This can compare the difference between ubantu and macos

jiangxiulong commented 1 year ago

At present, it is running normally. There is no new progress for the time being. Turn it off for the time being, thank you