Manevolent / ffmpeg4j

A Java OOP FFmpeg wrapper around the JavaCPP FFmpeg native library bindings
Apache License 2.0
105 stars 16 forks source link

Error: Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) #20

Open maxixcom opened 11 months ago

maxixcom commented 11 months ago

I was trying to run your example for transcoding but got error:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x103007df0] stream 0, offset 0x30: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x103007df0] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(tv, bt709), 1920x960, 4215 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Assertion desc failed at libswscale/swscale_internal.h:725

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

Am I did something wrong? May be I can add some additional configuration for suggested parameters somehow?

You can find example project with media here: https://github.com/maxixcom/ffmpeg4j-issue

Source code:

public class Main {
    private void transcode(InputStream inputStream,
                           String inputFormatName,
                           SeekableByteChannel outputChannel,
                           String outputFormatName) {
        try (FFmpegSourceStream sourceStream = FFmpegIO.openInputStream(inputStream).open(inputFormatName);
             FFmpegTargetStream targetStream = FFmpegIO.openChannel(outputChannel).asOutput().open(outputFormatName)) {
            sourceStream.registerStreams();
            sourceStream.copyToTargetStream(targetStream);

            Transcoder.convert(sourceStream, targetStream, Double.MAX_VALUE);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void run() throws IOException {
        Set<OpenOption> openOptions = Set.of(
                StandardOpenOption.CREATE,
                StandardOpenOption.WRITE,
                StandardOpenOption.TRUNCATE_EXISTING
        );
        try (
                FileInputStream inputStream = new FileInputStream("tmp/sample-0.mp4");
                SeekableByteChannel seekableByteChannel = Files.newByteChannel(Paths.get("tmp/output.ts"), openOptions);
        ) {
            transcode(inputStream,"mp4", seekableByteChannel, "mpegts");
        }
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}
Relism commented 5 months ago

i also have the same issue bump

Marek2k17 commented 3 months ago

running into the same issue, is there any way to expose this paramters?