Post

Replies

Boosts

Views

Activity

Reply to AVFoundation: Compression property Quality is not supported for video codec type avc1
I have a hypothesis. Would love it if someone could confirm or add information. Compression quality actually not supported by avc1/hvc1 (h264/h265) codecs. In some systems, like mine, AV Foundation translates compression quality to bitrate. In other systems, like my user's, AV Foundation crashes. Testing the hypothesis Write a video with H264 at 40% compression quality Write the same video with H264 at 100% compression quality Compare the bitrates with ffprobe The first video is encoded with a bitrate of 1000 kb/s The second video is encoded with a bitrate of 25841 kb/s These results support the hypothesis. The next question is if bitrate is the only thing adjusted when passing a compression quality value. I haven't tested if it changes any of the other compression settings. Another datapoint is that the docs explicitly say about the compression quality key, "A key to set the JPEG compression quality of the video." which does sound like it's only applicable if the JPEG codec is chosen. Hat tip to this SO answer
Aug ’23
Reply to Xcode error: Abort Trap 6
I'm able to reliably reproduce this with the code below. If I comment it out, the Abort trap disappears. extension DocumentGroup {   func useDefaultSizeIfAvailable() -> some Scene {     if #available(macOS 13.0, *) {       return self.defaultSize(.init(width: 750, height: 750))     } else {       return self.windowStyle(.automatic)     }   } }
Jan ’23
Reply to ProRes encoding on M1 Max fails for high bit depth buffers
Same issue here, but with HEVC With Alpha. Apple's own sample code* crashes with a nil pixel buffer pool after a few frames. I'm getting an increasing amount of bug reports from paying users as they upgrade to M1 pro and max. A workaround I'm testing right now is 1. Not setting the alpha quality, and 2. kVTCompressionPropertyKey_AllowTemporalCompression : false. Maybe that could help someone. I have filed FB9972239, which currently has "similar reports: none", although FB9757381 seems very similar. https://developer.apple.com/documentation/avfoundation/media_playback_and_selection/using_hevc_video_with_alpha -> HEVC-Videos-With-Alpha-AssetWriting
Apr ’22
Reply to SwiftUI Picker with option for no selection?
Make your State variable optional @State private var selectedCategoryIndex = Int? 2. Provide an option for "No selection" and tag it with nil as an optional Int to match it. Place it before or after your ForEach Text("Nothing").tag(nil as Int?) // ForEach here 3. Cast your actual values as Optionals the same way // ForEach here Text(categories[$0].name!).tag($0 as Int?) I'd also consider using the actual object array in your Picker rather than the indices.
May ’21
Reply to SceneKit SCNVector math Crippled on M1
Yes, the following code crashes on M1, but runs fine on Intel       // rotate the diffuse contents        let translation = SCNMatrix4MakeTranslation(0, -1, 0)       let rotation = SCNMatrix4MakeRotation(CGFloat.pi / 2, 0, 0, -1)       let transform = SCNMatrix4Mult(translation, rotation)       self.materials.screen.diffuse.contentsTransform = transform
Nov ’20
Reply to Crash when enabling jittering on SCNRenderer
Update: Thanks for the note, @MoreLightning. If you're curious, there was a link to my repository reproducing this behavior in the post. Here it is. - https://github.com/mortenjust/hevc-with-alpha/blob/main/HEVC-Videos-With-Alpha-AssetWriting/HEVC-Videos-With-Alpha-AssetWriting/AppDelegate.swift#L47 I've been at this all day. No solution. Here's what I tried Attempt: Change the texture descriptor Since I'm creating my Metal texture from a CVPixelbuffer with CVMetalTextureCacheCreateTextureFromImage, I can't figure out how to set its attributes - including the pixel format. Attempt: Change the render pipeline's pixel format I created a MTLRenderPipelineState and set the pixel format on that to match, but it was ignored. I think it's because of CVMetalTextureCacheCreateTextureFromImage Attempt: Try H264 Didn't change anything. Also tried changing just the alpha quality, with HEVC with alpha, but no change. Backing up a bit, I thought maybe isJitteringEnabled is not the way to get rid of jagged edges. Attempt: Enable multi sampling I was able to get my pipeline to pick up that I wanted multi sampling, but it crashes due to the texture not being set up for multisampling (more precisely a MTLTexture of type [.2DMultisample] (docs) - https://developer.apple.com/documentation/metal/mtltexturetype/type2dmultisample And then we're back at the problem of not being able to set the attributes for the MTLTexture. Attempt: Copy the MTLTexture created by Core Video I tried to use a MTLBlitCommandEncoder to copy the texture I was given by Core Video into a texture I had set up with the right attributes. But it crashes telling me that the attributes don't match. I'm starting to think there's no solution to this?
Nov ’20