You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GallerySaver.saveVideo() silently fails when the video is encoded with x.265 on IOS. No errors in the log, but the call returns false. The same video encoded with x.264 works fine IOS and both 265 and 264 work fine in Android. Anyone run into this?
The text was updated successfully, but these errors were encountered:
This is not the problem of the third-party library ( GallerySaver ) we use, but a fact that iOS does not support hev1 codec tagged MP4.
iOS supports hvc1 codec tagged MP4, only hvc1 tagged MP4 works in iOS 11 beta and above.
H.265 and HEVC (High Efficiency Video Coding) is the same thing.
When using ffmpeg to mux H.265/HEVC to MP4, we can use codec tag hvc1 or hev1 (or others), default when codec tag not set, it will use hev1.
hev1 and hvc1 are two codec tags, indicating different packaging methods of the HEVC stream in the MP4 container. Quicktime Player and iOS do not support hev1 tagged mp4.
hvc1 parameter sets are stored out-of-band in the sample entry (i.e. below the Sample Description Box ( stsd ) box)
hev1 parameter sets are stored out-of-band in the sample entry and/or in-band in the samples (i.e. SPS/PPS/VPS NAL units in the bitstream/ mdat box)
So if a video is muxed from HEVC to MP4 with codec tag not being hvc1, when GallerySaver calls Swift code PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url) to save the MP4 video file to iOS Gallery, it will throw an error : error Error? domain: "PHPhotosErrorDomain" - code: 3302 , see https://developer.apple.com/documentation/photokit/phphotoserror/code/invalidresource
error code 3302 means invalidResource :
An error that indicates the asset resource validation fails.
If you use the command mentioned in https://stackoverflow.com/questions/32152090/encode-h265-to-hvc1-codec ffmpeg -i input-hev1.mp4 -c:v copy -tag:v hvc1 -c:a copy output-hvc1.mp4 to convert your input-hev1.mp4 to output-hvc1.mp4, the output-hvc1.mp4 file will be able to be put in Gallery of iOS and be played with QuickTime Player.
GallerySaver.saveVideo() silently fails when the video is encoded with x.265 on IOS. No errors in the log, but the call returns false. The same video encoded with x.264 works fine IOS and both 265 and 264 work fine in Android. Anyone run into this?
The text was updated successfully, but these errors were encountered: