Posts

Post marked as solved
2 Replies
669 Views
I'm trying to save h.264 frames that comes to the app from network into a .mov file. Using AVAssetWriter with AVAssetWriterInput appending CMSampleBuffer. Output settings are nil which means that frames will not be encoded during saving: videoWriter = AVAssetWriterInput(mediaType: .video, outputSettings: nil, sourceFormatHint: format) videoWriter.append(buffer) I have the code that saves frames to a file. Tried to run it in iOS app and in macOS app using same frames data iOS result video file plays correctly macOS result video file plays with artefacts I've inspected both result files with MediaInfo and all the data is equal except 1 line (bold line): Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4 Format settings : CABAC / 1 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 1 frame Format settings, GOP : M=1, N=15 Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 9 s 398 ms Source duration : 9 s 432 ms Bit rate mode : Variable Bit rate : 14.3 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Variable Frame rate : 30.000 FPS Minimum frame rate : 30.000 FPS Maximum frame rate : 31.579 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.231 Stream size : 16.1 MiB (100%) Source stream size : 16.1 MiB (100%) Title : Core Media Video Encoded date : UTC 2021-03-04 13:30:21 Tagged date : UTC 2021-03-04 13:30:23 Codec configuration box : avcC iOS result file has this line and macOS result file missing it: Format settings, GOP : M=1, N=15 Is there a way to provide some settings to AVAssetWriter/AVAssetWriterInput to have correct Group of Pictures in result file on macOS? The goal is to save raw H.264 stream to file without additional encoding.
Posted
by Makoni.
Last updated
.