问题标签 [avassetwriter]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
uiimage - AVAssetImageGeneratorCompletionHandler - 如何设置或返回变量?
我正在使用 AVAssetImageGenerator 从影片剪辑中获取图像,而无需之前播放它。现在我有一个问题,如何在处理程序的循环中设置变量?是否可以?我收到此错误消息,不知道这是什么意思。(谷歌>没有结果)。
“变量不可赋值(缺少 __block 类型说明符)”
所以我必须在这里问专业人士。这是代码。我想保存或返回我生成的 imageData,所以我可以删除以下处理程序中的“setImage”消息。
很高兴了解这一点。谢谢你的时间。
ios4 - AVAssetWriter startWriting 在 iPod Touch 3rd Gen / OS 4.2.1 上失败
我的应用程序创建一个 mp4 文件。我已验证我的代码适用于以下设备:
- iPad (操作系统 4.3.2)
- iPhone4(操作系统 4.2.1)
- iPhone 3GS (操作系统 4.2.1)
.. 但在运行 OS 4.2.1 的我的 iPod Touch 3rd Gen 上初始化失败。
这与此处的另一个问题有关,但我在与他不同的 iOS 设备上看到它,并且我在这里包含了我的初始化代码。像另一个问题一样,我尝试了不同的像素格式和比特率,但是 AVAssetWriter 的状态在调用其 startWriting 函数后总是更改为AVAssetWriterStatusFailed 。
任何想法将不胜感激。我知道可以在此设备上创建 mp4,因为我已经下载了另一个应用程序,该应用程序在我的代码失败的同一设备上运行良好。
这是进行视频设置的最少代码。
iphone - AVAssetWriterInput 和 readyForMoreMediaData
AVAssetWriterInput 的 readyForMoreMediaData 是否在后台线程中更新?如果 readyForMoreMediaData 为 NO,我可以在主线程中阻塞并等待值变为 YES 吗?
我通过向 AVAssetWriterInput 推送数据(即不使用 requestMediaDataWhenReadyOnQueue)来使用 AVAssetWriterInput,并且我已经设置了 expectsMediaDataInRealTime,并且 99.9% 的时间我可以在其上调用 appendSampleBuffer(或 appendPixelBuffer),其速度与我的应用程序生成帧的速度一样快。
除非您在 AVAssetWriter 会话中间让设备 (iPhone 3GS) 休眠 15 分钟左右,否则这工作正常。唤醒设备后,appendPixelBuffer 有时会收到错误消息:“当 readyForMoreMediaData 为 NO 时,无法附加像素缓冲区”。因此我的问题 - 如何最好地响应 readyForMoreMediaData=NO 以及我是否可以像这样在主线程中稍等片刻:
iphone - 录制视频时,如何设置视频的变换(人像、风景等)?
我应该使用 AVCaptureConnection 的 videoOrientation 属性,还是设置 videoWriterInput 的 transform 属性,或者其他什么?
iphone - 使用 AVAsset 制作带有图片数组和歌曲文件的电影文件
我正在尝试使用图片数组和音频文件制作电影文件。为了用图片数组制作电影,我在这里使用了 zoul 的大帖子。一切都很完美,我有我的电影和我的照片。但是,当我尝试添加一些音轨时,我遇到了很多问题。为了理解我把我的代码:
当我调用这个方法时,图片数组和歌曲文件就准备好了:
我完成了在电影文件中写入图片,我想在文件中复制音频,我这样做:
然而,音频文件的 AssetWriterInput 状态始终为“NO”。
我的问题:如何使用 AVFoundation 将音频添加到视频文件中?
因此,如果我忘记了什么或有什么问题,请有人帮助我。
非常感谢
iphone - 是否可以将 AVAssetWriter 路由到 iOS4 中的网络流?
AVAssetWriter 将文件 URL 作为参数,并将附加到其 AVAssetWriterInput 的缓冲区写入该文件。
如果指定了网络 URL(即 RTSP - 需要实时流媒体源的服务器),则会抛出异常,因为需要基于文件的 URL。
还有另一种访问资产编写器输出的方法吗?我想利用集成的 H.264 编码,只需逐位访问编码数据以通过网络流式传输。
objective-c - 我无法让 AVAssetWriterInputPixelBufferAdaptor 导出小视频
下面的代码将编译并运行,但是当我尝试 appendBuffer 时 AVAssetWriterInputPixelBufferAdaptor 返回 NO:
关于为什么的任何想法?
iphone - AVAssetWriter Woes
I'm trying to use AVAssetWriter to write CGImages to a file to create a video from images.
I've gotten this to work successfully in three different ways on the simulator, but every method fails on an iPhone 4 running iOS 4.3.
This all has to do with pixel buffers.
My first method was to just create the pixel buffers as needed without using a pool. That works, but is too memory intensive to work on the device.
My second method was to use the recommended AVAssetWriterInputPixelBufferAdaptor and then pull pixel buffers from the adaptors pixelBufferPool with CVPixelBufferPoolCreatePixelBuffer.
That also works on the simulator, but fails on the device because the adaptor's pixel buffer pool is never allocated. I get no error messages.
Lastly, I attempted to create by own pixel buffer pool with CVPixelBufferPoolCreate. That also works in the simulator but on the device, everything works fine until I try to append the pixel buffer with appendPixelBuffer which fails every time.
I've found very minimal info on this on the web. I've based my code on the examples I've found, but no luck for days now. If ANYONE has experience doing this with AVAssetWriter successfully, please take a look and let me know if you see anything out of place.
NOTE: you will see commented out block of attempts.
First, the setup
Next, the two methods that append the writer and create the pixel buffer to append.
iphone - 在将它们发送到 AVAssetWriter 之前将它们保存在内存中
我需要在内存中保存一些来自 captureSession 的视频帧,并在发生“某些事情”时将它们写入文件。
与此解决方案类似,我使用此代码将框架放入 NSMutableArray:
这要写入视频文件:
但是 imgBuf 参考有问题。有什么建议么?提前致谢。
ios - 在 AVAssetExportSession 中限制帧速率或比特率?
我正在使用 AVAssetExportSession 以 640x480 的分辨率导出一些内容,这些文件有点可怕——可以预见,但仍然很可怕,因为我们需要通过 3G 网络从手机上传它们。除了降低分辨率之外,还有什么方法可以影响文件的大小?理想情况下,我想尝试,例如,更努力地压缩(即使这会降低质量),或者减少到 15 帧/秒,或者类似的东西,但似乎没有任何钩子可以做到这一点。