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

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

Open
maxixcom opened this issue Jan 5, 2024 · 0 comments

Comments

@maxixcom
Copy link

maxixcom commented Jan 5, 2024

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();
    }
}
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

1 participant