OpenWatch / FFmpegWrapper

A lightweight Objective-C wrapper for some FFmpeg libav functions
Other
179 stars 54 forks source link

Library converts mkv -> mp4 incorrectly, file cannot be opened #17

Open natalia-osa opened 8 years ago

natalia-osa commented 8 years ago

Using the following code:

FFmpegWrapper *ffmpegWrapper = [[FFmpegWrapper alloc] init];
[ffmpegWrapper convertInputPath:mkvVideoFilePath outputPath:mp4VideoFilePath options:nil progressBlock:^(NSUInteger bytesRead, uint64_t totalBytesRead, uint64_t totalBytesExpectedToRead) {
    NSLog(@"Progress: %.2f", (float)totalBytesRead / totalBytesExpectedToRead);
} completionBlock:^(BOOL success, NSError *error) {
    if (success && !error) {
        // delete mp4 file
    } else {
        if (error) {
            DDLogError(@"MKV -> MP4 conversion: Error occured: %@", error.localizedDescription);
            // do something else with the error
        } else {
            DDLogError(@"MKV -> MP4 conversion: Unknown error occured.");
        }
        // check if mkv also needs to be deleted
}];

Problems:

  1. The video is unplayable.
  2. Output mp4 is 5 minutes long, while input mkv is 11 seconds long.
  3. Console is flooded with logs.
  4. Even though everything failed, the completionBlock is called with success = YES, error = nil.

My console looks like the linked gist file (FFmpegWrapper is basically spamming with logs, 30k lines generated for 11s .mkv movie, it's really long so I don't want to attach it here).

I'm using the version from: pod 'FFmpegWrapper-up-to-date', '~> 1.2'