Question

I am able to record video and save it in documents directory using AVFondation, now i want to re-open that saved video file and start recording again from the end of that file, is that possible or do i have to create multiple video files and merge them, please advise!

Regards,

Was it helpful?

Solution

I'm pretty sure there isn't a way to get the AVAssetWriter mux to append to an existing file. And of course if you need to prepend all the existing data when starting a new file, you will be slow to start.

An alternative is to start a new temporary file, and copy the data in the background into a third file, using something similar to http://www.gdcl.co.uk/2013/02/20/iOS-Video-Encoding.html. That is, you have file 1, which was closed when you suspended. You start writing to file 2 when you resume, and simultaneously read from 1 and write to a new file 3. when you've exhausted 1, you can read from file 2 (using the example code linked to above) and append that to file 3.

G

OTHER TIPS

I think you should read the saved video, and then append the recorded video in NSData format, and rewrite the whole data again.. You can use NSMutableData to appendData..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top