- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 NSDocument 架构的应用程序中对 QTMovie 进行少量编辑(例如添加轨道,如下所示)。编辑后,我想保存到原始文件。但是,我不断收到“文件正忙”错误。我认为这是由于我在处理文件时的一些疏忽,或者是我使用 NSDocument 的方式失败造成的。任何提示都会有帮助!这是(一些)相关代码:
// open file that has the track I want to add to my movie
QTMovie* tempMovie = [QTMovie movieWithURL:outputFileURL error:nil];
// Use old API to add the track
AddMovieSelection([movie quickTimeMovie], [tempMovie quickTimeMovie]);
// get the filename from the NSDocument
NSString *filename = [[self fileURL] path];
NSLog(@"writing to filename: %@", filename);
// FLATTEN the movie file so I don't get external references
NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithCapacity:1];
[attributes setObject:[NSNumber numberWithBool:YES] forKey:QTMovieFlatten];
// attempt to write
NSError *error;
// this is where I get the "file is busy"
if (![movie writeToFile:filename withAttributes:attributes error:&error]) {
NSLog(@"Error: %@", [error localizedDescription]);
NSRunAlertPanel(@"Error", [error localizedDescription], nil, nil, nil);
}
我必须首先在我的 NSDocument 中发布电影吗?这样做的“正确”方法是什么?请记住,我不一定完成此文档,我不会关闭它。我刚刚完成此操作,我希望磁盘上的文件反射(reflect)我的更改。我很想使用 [movie updateMovieFile],但该调用似乎并没有使电影变平。我不想在我的文件中包含任何外部引用。
最佳答案
我对 QuickTime C API 不太熟悉,所以老实说我无法告诉你那里出了什么问题。 绝对猜测:也许缺少对 EndMediaEdits
的调用?
尽管 AddMovieSelection
不应该要求这样做,但您说的是“[...]例如添加轨道[...]”。那么也许还有其他事情发生,比如 AddMediaSample
或类似的事情?
也就是说,如果您不需要以 10.5 以下的任何目标为目标,并且您所需要做的就是添加另一部电影中的一些片段,则无需使用 C API 即可实现这一目标:
看看
-[QTMovie insertSegmentOfTrack:fromRange:scaledToRange:]
和 -[QTMovie insertSegmentOfMovie:fromRange:scaledToRange:]
,如果您想让插入的片段“重叠”(暂时而言)。-[QTMovie insertSegmentOfMovie:timeRange:atTime:]
和 -[QTMovie insertSegmentOfTrack:timeRange:atTime:]
,如果您想要{ movieA.firstPart, movieB, movieA.secondPart }
。Do I have to first release the movie in my NSDocument?
您的意思是为了将其写入磁盘?不:这甚至会导致崩溃。
release的作用是处理内存管理。它与文件的繁忙状态没有太大关系。
关于cocoa - 使用QTKit编辑后如何正确保存QTMovie?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4950277/
我已经关注了这个 http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/在我的 Mac 上安
我正在尝试创建一个用于 Mac 的应用程序来创建实时视频流。我了解 VLC 和其他解决方案,但仍然如此。 为此,我尝试使用 QTKit 从 iSight 录制视频,并将其连续保存为一系列小视频文件。然
我正在尝试两次导入单个电影文件(2 个单独的 QTMovie 实例),将第二个实例的音轨偏移一秒,然后将其与第一个实例的音轨混合。它不混合。第一首轨道开始播放,然后停止,第二首轨道开始播放。当我使用
每当我尝试运行 simple application to grab frames from the camera 时都会出现以下错误Macbook Pro 13"(内置 iSight): QTKit
我想使用 FFMPEG 提交申请到 Mac App Store 但我被拒绝了,因为 libavcodec 链接到已弃用的 QTKit 框架: Deprecated API Usage - Apple
我正在尝试向 QTCaptureSession 添加两个输入,如下所示: mainSession = [[QTCaptureSession alloc] init]; BOOL success; NS
我正在尝试使用 qtkit 通过我的应用程序录制和播放电影。我在一个 View 中录制视频并将其显示到另一个 View 中。我是这样做的 - (void)startRecording { NS
我正在尝试以慢动作播放电影并将其附加到现有电影中。这是我到目前为止所做的: QTMovie *originalMovie = ...; QTMovie *slowMotionMovie = ...;
我刚刚制作了一个简单的应用程序,它使用 QTKit 将两个视频合并在一起 这是问题: 我刚刚发现,如果我尝试合并两个宽度和高度不同的视频,输出的视频的高度和宽度与大视频相同,但包含带有黑色和宽边框的小
是否有 QTKit 理解的文件格式的概述? 最佳答案 您使用 QTMovie 的 +movieFileTypes: 方法从以下位置选择类型选项: QTIncludeStillImageTypes QT
在我当前正在编码的 cocoa 应用程序中,我从 Quartz Composer 渲染器(NSImage 对象)获取快照图像,我想将它们编码在 QTMovie 中,尺寸为 720*480、25 fps
我正在构建一个导出电影的应用程序。电影有一个或多个音频和视频轨道。这些轨道是从包含不同压缩方案的媒体的其他电影中提取的。当我使用 QTKit 导出我的合成电影时,我想指定每个轨道的编码。就目前而言,我
使用 AVFoundation/QTKit 如何将多个视频设备同时录制到一个文件中? 我知道如何分别记录它们,但是尝试同时记录它们会导致诸如... “无法添加到 session 中,因为源和目标媒体类
抱歉,如果这是一个非常简单的问题,但是: 我正在尝试创建 Quicktime 影片的引用影片。我正在剪切电影的一部分,然后我想将文件保存为引用而不是独立的电影。我知道如何进行切割以及如何保存独立文件,
如何以编程方式判断 QTMovie 正在播放还是暂停? 看起来很简单,但我梳理了QTMovie和 QTMovieView文档相当广泛,但找不到任何此类内容。我错过了什么? 最佳答案 您可能正在查找电影
看起来使用核心音频录制音频过于复杂。虽然 QTkit 是基本的和脚踏实地的 但是。我看到的所有示例都将视频和音频集成在一起。有人拥有或知道使用 QTkit 录制音频的示例吗? 最佳答案 Here是使用
我正在尝试在我的 Mac 上为 Python 安装 openCV,但在浏览了一堆教程之后,似乎没有一个适合我。这些是我采取的步骤 已安装 CMake 下载 OpenCV 库 使用 CMake 生成 U
我正在尝试将旧的 QuickTime 框架代码转换为 OS X 上基于 Cocoa 的 64 位 QTKit,这意味着我无法在任何时候直接调用 C 函数。具体来说,我试图找到一种使用 QTKit 编写
为 Mac 创建具有最大视频格式支持的视频播放器的最佳方法是什么? 可以将外部编解码器添加到 QTKit 吗? 如果没有人可以提供步骤教程如何为 mac 编译 ffmpeg(正确的方法,谷歌给了我很多
我有一个 Qt 项目,该项目依赖于我从源代码编译的其他第 3 方库。在编译这些第 3 方库时,我指定了用于编译的 Qt 工具包(因为这些第 3 方库依赖于 Qt) 例如,这些第 3 方库可能是使用 Q
我是一名优秀的程序员,十分优秀!