1 year ago

#10502

test-img

LeoNard

Problem in decoding h264 raw frame in swift

I try to decode an inputstream of [UInt8] to h264 video , I have search the whole web and read the beautiful detailed answer of olivia How to use VideoToolbox to decompress H.264 video stream , I tried to convert her objc answer to swift but it didn't worked for me .

Then i came to this nice pod https://github.com/songbihai/VideoDecoder?ref=iosexample.com the problem is i am getting some of images completely and some other in half green , this the image i am getting

Beside this image issue , the other issue i have is this code doesn't work on real device(iPad pro 2019 , iOS 15), and gives me

DecodeError.decompressionOutputCallback(-12909)

which as I searched means bad data(!?) , and this is just for my stream the example file included in pod is ok, I tried to tweak some parameters but when I did it just didn't give me anything both on simulator and the real device.

this is one part of data that I'm getting

1, 0, 0, 0, 85, 3, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 253, 8, 0, 0, 6, 102, 1, 0, 53, 3, 0, 0, 4, 1, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 97, 224, 112, 124, 79, 87, 150, 179, 234, 117, 62, 173, 161, 255, 77, 252, 87, 185, 125, 113, 31, 255, 255, 87, 241, 151, 222, 199, 142, 213, 117, 121, 250, 180, 99, 215, 101, 247, 175, 94, 229, 188, 214, 166, 189, 243, 107, 139, 188, 215, 170, 203, 138, 174, 181, 38, 226, 122, 180, 220, 187, 228, 229, 239, 8, 47, 215, 235, 245, 253, 98, 247, 23, 186, 235, 81, 26, 155, 189, 241, 21, 87, 142, 235, 95, 90, 159, 171, 212, 35, 147, 171, 244, 228, 234, 241, 61, 106, 78, 173, 84, 174, 242, 195, 61, 125, 117, 175, 171, 205, 85, 105, 175, 25, 213, 165, 234, 247, 214, 162, 124, 208, 133, 123, 95, 87, 174, 181, 17, 187, 235, 95, 87, 133, 191, 93, 111, 35, 249, 122, 212, 41, 214, 164, 235, 215, 205, 127, 212, 223, 191, 12, 49, 122, 123, 105, 188, 144, 238, 35, 171, 86, 253, 195, 143, 233, 252, 109, 215, 213, 170, 173, 234, 94, 181, 9, 119, 175, 142, 147, 179, 235, 213, 246, 229, 234, 213, 213, 190, 251, 201, 221, 120, 222, 175, 243, 111, 164, 55, 101, 191, 19, 17, 151, 155, 215, 94, 241, 253, 90, 47, 171, 117, 151, 81, 92, 215, 125, 87, 147, 63, 55, 180, 77, 221, 99, 43, 223, 175, 17, 141, 239, 79, 44, 51, 215, 213, 103, 228, 247, 87, 147, 173, 77, 201, 218, 147, 247, 136, 172, 188, 180, 250, 234, 213, 173, 105, 235, 123, 234, 213, 19, 87, 174, 181, 10, 94, 171, 93, 90, 42, 176, 142, 19, 221, 127, 47, 74, 185, 123, 207, 133, 101, 198, 233, 100, 132, 57, 111, 253, 94, 90, 196, 86, 126, 11, 123, 232, 246, 155, 147, 165, 9, 117, 120, 158, 189, 92, 102, 143, 189, 157, 143, 96, 95, 193, 85, 27, 119, 109, 46, 214, 131, 171, 227, 175, 233, 116, 116, 252, 22, 117, 183, 99, 243, 102, 190, 47, 58, 134, 47, 69, 241, 158, 187, 123, 116, 244, 31, 193, 12, 210, 216, 216, 141, 189, 245, 168, 67, 115, 241, 126, 158, 223, 198, 250, 91, 116, 52, 61, 122, 15, 151, 211, 252, 41, 236, 39, 76, 149, 239, 122, 119, 191, 205, 175, 224, 135, 216, 153, 240, 133, 47, 64, 126, 255, 31, 211, 219, 247, 246, 89, 24, 227, 55, 39, 87, 159, 113, 187, 142, 234, 208, 75, 184, 107, 130, 75, 125, 136, 156, 146, 110, 93, 250, 140, 234, 245, 120, 158, 93, 15, 124, 157, 168, 142, 181, 238, 28, 235, 221, 226, 123, 167, 196, 98, 100, 220, 70, 225, 77, 215, 86, 251, 239, 47, 55, 181, 226, 116, 251, 89, 186, 180, 61, 201, 111, 139, 230, 239, 92, 212, 184, 107, 171, 198, 106, 106, 205, 201, 127, 228, 239, 25, 213, 253, 43, 201, 201, 127, 230, 244, 15, 203, 75, 146, 209, 188, 184, 42, 241, 60, 154, 235, 151, 75, 124, 221, 185, 111, 55, 90, 159, 154, 203, 136, 172, 70, 235, 190, 178, 240, 81, 218, 191, 98, 184, 158, 221, 127, 190, 213, 242, 122, 248, 202, 210, 233, 94, 148, 170, 149, 14, 184, 78, 191, 183, 226, 180, 187, 31, 225, 46, 236, 73, 255, 25, 239, 163, 214, 235, 97, 176, 252, 37, 239, 189, 112, 81, 234, 170, 142, 223, 8, 251, 237, 167, 106, 190, 16, 238, 235, 178, 176, 255, 31, 207, 11, 59, 185, 55, 191, 130, 207, 44, 45, 232, 156, 198, 255, 17, 181, 75, 68, 161, 30, 79, 114, 113, 93, 236, 249, 121, 111, 205, 194, 22, 182, 244, 237, 255, 8, 119, 245, 98, 254, 46, 213, 83, 206, 24, 15, 197, 221, 191, 127, 132, 111, 125, 157, 200, 65, 219, 126, 59, 96, 94, 195, 158, 25, 249, 169, 255, 8, 123, 62, 205, 28, 141, 75, 193, 85, 135, 172, 112, 221, 213, 45, 34, 241, 222, 77, 161, 49, 253, 175, 139, 221, 171, 21, 143, 229, 218, 252, 20, 216, 246, 223, 175, 175, 138, 239, 162, 252, 18, 119, 215, 197, 123, 105, 115, 117, 233, 234, 111, 75, 223, 181, 228, 245, 39, 94, 139, 226, 55, 223, 251, 223, 241, 30, 233, 255, 116, 139, 15, 196, 211, 96, 189, 126, 74, 86, 171, 143, 223, 183, 250, 249, 50, 209, 159, 238, 203, 79, 242, 81, 214, 184, 139, 243, 193, 47, 196, 82, 73, 157, 36, 177, 60, 186, 89, 121, 54, 13, 63, 146, 151, 91, 147, 114, 110, 54, 241, 29, 106, 78, 246, 121, 47, 27, 29, 119, 230, 239, 210, 63, 37, 248, 138, 199, 245, 121, 55, 62, 235, 8, 43, 68, 110, 159, 10, 197, 117, 105, 249, 186, 197, 245, 98, 126, 172, 85, 97, 110, 111, 105, 64

swift

video

video-processing

h.264

video-toolbox

0 Answers

Your Answer

Accepted video resources