Skip to content

Commit

Permalink
* Ensure FFmpegFrameGrabber.start() skips over streams with no cod…
Browse files Browse the repository at this point in the history
…ecs (issue #2299)
  • Loading branch information
saudet committed Nov 23, 2024
1 parent 971081a commit 295e89f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 295e89f

Please sign in to comment.