Posts

Post not yet marked as solved
1 Replies
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
Post not yet marked as solved
10 Replies
I was able to get rid of the cycle message by adding an .id(myIdentifier) to the root container of the view. I'm not sure why, because myIdentifier is a let value on the view, so I would assume it would already be a part of the view's identity
Post not yet marked as solved
40 Replies
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)     }   } }
Post not yet marked as solved
2 Replies
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.
Post marked as solved
5 Replies
For people wondering how to actually set up the multipass texture https://stackoverflow.com/questions/64958392/antialiasing-a-scenekit-rendering-with-metal
Post not yet marked as solved
2 Replies
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
Post marked as solved
5 Replies
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?