ios - AVCaptureSession audio doesn't work for long videos -
ios - AVCaptureSession audio doesn't work for long videos -
i'm using avcapturesession record video audio. seems work short videos, reason, if record video longer 12 seconds, sound doesn't work.
i found solution an reply different question.
the issue moviefragmentinterval
property in avcapturemoviefileoutput.
the documentation property explains these fragments are:
a quicktime film comprised of media samples , sample table identifying location in file. film file without sample table unreadable.
in processed file, sample table typically appears @ origin of file. may appear @ end of file, in case header contains pointer sample table @ end. when new film file beingness recorded, not possible write sample table since size of file not yet known. instead, table must written when recording complete. if no other action taken, means if recording not finish (for example, in event of crash), file info unusable (because there no sample table). periodically inserting “movie fragments” film file, sample table can built incrementally. means if file not written completely, film file still usable (up point lastly fragment written).
it says:
the default 10 seconds. set kcmtimeinvalid disable film fragment writing (not typically recommended).
so reason recording getting messed whenever fragment written. added line moviefileoutput.moviefragmentinterval = kcmtimeinvalid;
(where moviefileoutput
avcapturemoviefileoutput i've added avcapturesession) disable fragment writing, , sound works.
ios avcapturesession
Comments
Post a Comment