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.
2 parents e397794 + f71bf21 commit fa36e76Copy full SHA for fa36e76
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