diff --git a/MP42/MP42File.m b/MP42/MP42File.m index d2fea4a..43b0a10 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -710,6 +710,10 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { - (BOOL)updateMP4FileWithAttributes:(NSDictionary *)attributes error:(NSError **)outError { BOOL noErr = YES; + // Organize the alternate groups + if ([[attributes valueForKey:MP42OrganizeAlternateGroups] boolValue]) + [self organizeAlternateGroups]; + // Open the mp4 file if (![self startWriting]) { if (outError) @@ -717,10 +721,6 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { return NO; } - // Organize the alternate groups - if ([[attributes valueForKey:MP42OrganizeAlternateGroups] boolValue]) - [self organizeAlternateGroups]; - // Delete tracks for (MP42Track *track in _tracksToBeDeleted) [self removeMuxedTrack:track];