private bool StartPostProcess() { UnityEngine.Debug.Assert(_postProcessEvent == null); if (_videoEncodingHints.allowFastStartStreamingPostProcess) { _postProcessEvent = MP4FileProcessing.ApplyFastStartAsync(_path, false); if (_postProcessEvent == null) { UnityEngine.Debug.LogWarning("[AVProMovieCapture] failed moving atom 'moov' to start of file for fast streaming"); } } return(true); }
public static bool ApplyFastStart(string srcPath, string dstPath) { if (!File.Exists(srcPath)) { Debug.LogError("File not found: " + srcPath); return(false); } using (Stream srcStream = new FileStream(srcPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (Stream dstStream = new FileStream(dstPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None)) { MP4FileProcessing mp4 = new MP4FileProcessing(); bool result = mp4.Open(srcStream, dstStream); mp4.Close(); return(result); } } }