Hi, Recording Videos with AVAssetWriter, capture fps(camera output fps) is ok, but final result video fps was lower, the reason is AVAssetWriterInput.isReadyForMoreMediaData
is false sometimes.
Yes, I have read document many times, it said need to set expectsMediaDataInRealTime
to true and balabala...
I really be tortured by this problem for a long time, can I debug this problem? or any advice?
Hello @PhonJac, the discussion section in isReadyForMoreMediaData explains that when expectsMediaDataInRealTime
, the isReadyForMoreMediaData
property becomes false only when the input can’t process media samples at the current data rate. If that is the case, your app may need to reduce the rate at which it appends samples, or drop them altogether.
If you cannot reduce the rate at which samples are acquired, and you don't want to drop samples, one suggestion is to implement some queueing mechanism to cope with AVAssetWriterInput
. In that case, it might be easier to use requestMediaDataWhenReady(on:using:), effectively regarding this queueing mechanism as a non-real-time source.