diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ed85469..439d96e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Ensure `FFmpegFrameGrabber.start()` skips over streams with no codecs ([issue #2299](https://github.com/bytedeco/javacv/issues/2299)) * Add `FFmpegLogCallback.logRejectedOptions()` for debugging purposes ([pull #2301](https://github.com/bytedeco/javacv/pull/2301)) ### November 16, 2024 version 1.5.11 diff --git a/src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java b/src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java index a0e4954c..ee171be5 100644 --- a/src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java +++ b/src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java @@ -1025,11 +1025,13 @@ public synchronized void startUnsafe(boolean findStreamInfo) throws Exception { // Get a pointer to the codec context for the video or audio stream AVCodecParameters par = st.codecpar(); streams[i] = par.codec_type(); - if (video_st == null && par.codec_type() == AVMEDIA_TYPE_VIDEO && (videoStream < 0 || videoStream == i)) { + if (video_st == null && par.codec_type() == AVMEDIA_TYPE_VIDEO + && par.codec_id() != AV_CODEC_ID_NONE && (videoStream < 0 || videoStream == i)) { video_st = st; video_par = par; videoStream = i; - } else if (audio_st == null && par.codec_type() == AVMEDIA_TYPE_AUDIO && (audioStream < 0 || audioStream == i)) { + } else if (audio_st == null && par.codec_type() == AVMEDIA_TYPE_AUDIO + && par.codec_id() != AV_CODEC_ID_NONE && (audioStream < 0 || audioStream == i)) { audio_st = st; audio_par = par; audioStream = i;