当前位置:网站首页>Use txvideoeditor to add watermark and export video card at 99%? No successful failed callback?

Use txvideoeditor to add watermark and export video card at 99%? No successful failed callback?

2022-06-24 12:36:00 Xiao Ming receives audio and video

The problem background :

Use TXVideoEditer Add watermark , After that

- (void) generateVideo:(TXVideoCompressed)videoCompressed videoOutputPath:(NSString *)videoOutputPath;

Export the watermarked video , There are no successful or failed callbacks when exporting , And the progress has been 99%.

The root cause of the problem :

When exporting the video path , You need to splice video suffixes . If it is the name of the network video obtained directly , It is recommended to check whether the name has a suffix .

correct :/var/mobile/Containers/Data/Application/7C70754F-60F1-4955-B69A-7A41611775E6/Library/Caches/WaterMark.mp4

error :/var/mobile/Containers/Data/Application/7C70754F-60F1-4955-B69A-7A41611775E6/Library/Caches/WaterMark

Solution :

When exporting video, add video format suffix .

NSURL*url=  [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"1621582392155992" ofType:@"mp4"]];
    
    [_ugcEdit setVideoPath:url.path];
    [_ugcEdit setVideoBitrate:2000000];

   //  Configure agent 
         //  Set the callback delegate object for generating events , You can get the generation progress and results 
//    _fileName = @"1621582392155992.mp4";
   // 2.  Processing video , Take adding watermark as an example 
    UIImage *image = [UIImage imageNamed:@"watermark"];
    [_ugcEdit setWaterMark:image normalizationFrame:CGRectMake(0, 0, 0.3 , 0.3 * image.size.height / image.size.width)];

    // Get cache Path to folder 
    NSString *cache=[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)lastObject];
    cache = [cache stringByAppendingPathComponent:@"WaterMark.mp4"];
    _savePath = cache;
    [_ugcEdit generateVideo:VIDEO_COMPRESSED_720P videoOutputPath:cache];
原网站

版权声明
本文为[Xiao Ming receives audio and video]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/05/20210527143729709k.html