Questions tagged [video-toolbox]

The Video Toolbox framework (VideoToolbox.framework) includes direct access to hardware video encoding and decoding in iOS and OSX.

107 questions
73
votes
6 answers

How to use VideoToolbox to decompress H.264 video stream

I had a lot of trouble figuring out how to use Apple's Hardware accelerated video framework to decompress an H.264 video stream. After a few weeks I figured it out and wanted to share an extensive example since I couldn't find one. My goal is to…
Olivia Stork
  • 4,312
  • 4
  • 23
  • 39
10
votes
1 answer

How do you access hardware decoding on tvOS without VideoToolbox?

Since VideoToolbox isn't available for tvOS, how do I decode video? I have an app where I have frames of h.264 in memory (streams in over the network) and I was handling the decoding with VideoToolbox previously. What's the replacement?
David
  • 25,830
  • 16
  • 80
  • 130
9
votes
2 answers

What is the most efficient way to display CVImageBufferRef on iOS

I have CMSampleBufferRef(s) which I decode using VTDecompressionSessionDecodeFrame which results in CVImageBufferRef after decoding of a frame has completed, so my questions is.. What would be the most efficient way to display these…
8
votes
3 answers

Image buffer display order with VTDecompressionSession

I have a project where I need to decode h264 video from a live network stream and eventually end up with a texture I can display in another framework (Unity3D) on iOS devices. I can successfully decode the video using VTDecompressionSession and then…
Kaleb
  • 1,815
  • 1
  • 17
  • 24
8
votes
1 answer

AVFoundation Vs VideoToolbox - Hardware Encoding

So this is a more theoretical question/discussion, as I haven't been able to come to a clear answer reading other SO posts and sources from the web. It seems like there are a lot of options: Brad Larson's comment about AVFoundation Video Decode…
royherma
  • 3,775
  • 1
  • 26
  • 37
6
votes
2 answers

How to encode audio along with video to h264 format using VideoToolbox?

I am able to compress video captured from camera device to h264 format using video toolbox framework, but when I tried to play that h264 file in VLC player I am not able to hear the audio of the video. I think audio compression should also be done…
5
votes
1 answer

Encoding H.264 Compression Session with CGDisplayStream

I'm trying to create an H.264 Compression Session with the data from my screen. I've created a CGDisplayStreamRef instance like so: displayStream = CGDisplayStreamCreateWithDispatchQueue(0, 100, 100, k32BGRAPixelFormat, nil, self.screenCaptureQueue,…
narner
  • 2,729
  • 3
  • 22
  • 54
5
votes
2 answers

Why does AVSampleBufferDisplayLayer fail with Operation Interrupted (-11847)?

I'm using an AVSampleBufferDisplayLayer to decode and display H.264 video streamed from a server. When my app goes into the background and then returns to the foreground, the decoding process gets screwed up and the AVSampleBufferDisplayLayer fails.…
Greg
  • 9,304
  • 5
  • 39
  • 62
4
votes
2 answers

How to debug why Mac OS is not using Hardware H264 encoder

I'm trying to encode some video only stream using H264, and I'm willing to use the hardware encoder in order to compare both quality and resource consumption between hardware and CPU encoding. The thing is that I'm not being able to force the OS to…
Gonzalo Larralde
  • 3,365
  • 21
  • 30
3
votes
2 answers

VTDecompressionSessionDecodeFrame returns imageBuffer = nil but OSStatus = noErr

I am trying to decode a raw H264 stream using VideoToolbox APIs in Swift (macOS). In the viewDidLoad() I setup my display layer and CMTimeBase as so: self.view.wantsLayer = true self.VideoLayer = AVSampleBufferDisplayLayer() self.VideoLayer.frame =…
user3339439
  • 45
  • 1
  • 6
3
votes
0 answers

VTDecompressionOutputCallback returns kVTVideoDecoderBadDataErr = -12909

I have desktop server which is encode frames. My iOS client is connecting to this client and receives data using NWConnection like this: NWListener using .udp parameter causes odd logs sometimes Actual problem: Device without error (video is ok):…
vpoltave
  • 1,070
  • 3
  • 10
  • 26
3
votes
1 answer

Decoding frames with VTDecompressionSessionDecodeFrame fails with 12909 error

I'm trying to decode CMSampleBuffer so I can analyze their pixel data. I keep getting error 12909 when I call VTDecompressionSessionDecodeFrame. This is all very new to me - any ideas where might be the problem? Here's my code: func…
msmialko
  • 949
  • 1
  • 14
  • 29
3
votes
4 answers

How to get CVPixelBuffer handle from UnsafeMutablePointer in Swift?

I got a decoded AVFrame whose format shows 160/Videotoolbox_vld. After googled some articles(here) and viewed the FFmpeg source code(here, and here), the CVBuffer handle should be at AVFrame.data[3]. But the CVBuffer I got seems invalid, any…
Chen OT
  • 2,945
  • 2
  • 19
  • 38
3
votes
0 answers

iOS VTDecompressionSessionDecodeFrame error -12909 when decoding HEVC

I have some trouble with streaming raw H.265 over rtsp when using VTDecompressionSessionDecodeFrame. The 3 main steps I do are the following ones: OSStatus status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault, 3,…
Mench
  • 31
  • 3
3
votes
0 answers

Decode h264 video stream to get image buffer

I followed this post to decode my h264 video stream frames. My data frames as bellow: My code: NSString * const naluTypesStrings[] = { @"0: Unspecified (non-VCL)", @"1: Coded slice of a non-IDR picture (VCL)", // P frame @"2:…
Nhat Dinh
  • 3,202
  • 2
  • 30
  • 45
1
2 3 4 5 6 7 8