AVFoundation doesn't load H.264 and/or AAC tracks from AVAsset

Originator:jorgenisaksson
Number:rdar://12178659 Date Originated:2012-08-27
Status:Open Resolved:
Product:Mac OS X Product Version:10.8.1
Classification:Serious bug Reproducible:Always
 
27-Aug-2012 01:45 PM Jorgen Isaksson:
Summary:
When using AVFoundation to open assets with H.264 and/or AAC tracks it doesn't work if the file is not a .mp4 or .m4v file. This problem happens with .mkv containers with proper H.264 and AAC tracks inside. There's really no reason for AVFoundation to ignore to handle such files. This also applies to AVMediaTypeSubtitle tracks inside .mkv containers. These are exactly the same sort of track that would have been in a .mp4 or .m4v container, but as it's part of a .mkv container it doesn't work with AVFoundation for no appearent reason.

Steps to Reproduce:
Instantiate an AVAsset from an .mkv file and load it's tracks. Even though the tracks are proper H.264 tracks nothing comes back. Some code...

AVAsset *sourceAsset = [AVURLAsset assetWithURL:[NSURL fileURLWithPath:@"/Users/me/Movies/movie.mkv"]];
    
NSArray *assetKeysToLoadAndTest = [NSArray arrayWithObjects:@"tracks", nil];
	[sourceAsset loadValuesAsynchronouslyForKeys:assetKeysToLoadAndTest completionHandler:^(void) {
	// The asset invokes its completion handler on an arbitrary queue when loading is complete.
	if ([[sourceAsset tracksWithMediaType:AVMediaTypeVideo] count] != 0) {
            NSLog(@"Found video tracks");
        } else {
            NSLog(@"No video tracks!!!");
        }
}];

Expected Results:
Expected AVFoundation to properly load AVMediaTypeVideo, AVMediaTypeAudio and AVMediaTypeSubtitle if they are in the correct format. The container type, in this case .mkv, shouldn't matter at all.

Actual Results:
AVFoundation fails to read tracks it should be able to read just because they are part of an .mkv container.

Regression:

Notes:
I have supplied a screenshot from the .mkv file I used in the example. As you can see it contains proper AVMediaTypeVideo, AVMediaTypeAudio and AVMediaTypeSubtitle tracks but it still doesn't work with AVFoundation.

27-Aug-2012 01:45 PM Jorgen Isaksson:
'Media Information.jpg' was successfully uploaded

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!