We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc09f5a commit f71bf21Copy full SHA for f71bf21
modules/highgui/src/cap_avfoundation_mac.mm
@@ -697,7 +697,15 @@ -(int) updateImage {
697
return;
698
}
699
700
- mAssetTrack = [[mAsset tracksWithMediaType: AVMediaTypeVideo][0] retain];
+ NSArray *tracks = [mAsset tracksWithMediaType:AVMediaTypeAudio];
701
+ if ([tracks count] == 0) {
702
+ fprintf(stderr, "OpenCV: Couldn't read movie file \"%s\"\n", filename);
703
+ [localpool drain];
704
+ started = 0;
705
+ return;
706
+ }
707
+
708
+ mAssetTrack = [tracks[0] retain];
709
710
if ( ! setupReadingAt(kCMTimeZero) ) {
711
fprintf(stderr, "OpenCV: Couldn't read movie file \"%s\"\n", filename);
0 commit comments