2
只是尋找如何以編程方式爲使用可可的視頻添加水印或某種疊加。不是在尋找一步一步的步伐(儘管那會很棒),但或多或少地尋找我應該從哪裏開始學習如何。是否有框架開發爲此工作。想要可可或Objective-C或C原生的東西,因爲我想最終在iPhone上放棄這一點。任何幫助都會很棒。Cocoa - 添加視頻水印一般信息
只是尋找如何以編程方式爲使用可可的視頻添加水印或某種疊加。不是在尋找一步一步的步伐(儘管那會很棒),但或多或少地尋找我應該從哪裏開始學習如何。是否有框架開發爲此工作。想要可可或Objective-C或C原生的東西,因爲我想最終在iPhone上放棄這一點。任何幫助都會很棒。Cocoa - 添加視頻水印一般信息
我不確定您的意思只是爲了播放,或者如果您想導出帶有會在其他播放器上顯示的水印的視頻。
如果您只是爲了回放,您可能只需在Mac和iPhone上包含水印的播放器視圖頂部添加視圖即可。
如果你想在視頻本身上使用水印,這在Mac上很難實現,而在沒有基本上重寫QuickTime的情況下,在iPhone上可能不太可能。
在Mac上,代碼可能是這樣的(你需要導入QTKit):
// Make a new movie so we don't destroy the existing one
QTMovie* movie = [[QTMovie alloc] initWithMovie:currentMovie
timeRange:QTMakeTimeRange(QTMakeTime(0,1000), [currentMovie duration])
error:nil];
// Make it editable
[movie setAttribute:[NSNumber numberWithBool:YES]
forKey:QTMovieEditableAttribute];
//Get the size
NSValue *value = [movie attributeForKey:QTMovieNaturalSizeAttribute];
NSSize size = [value sizeValue];
// Add a new track to the movie and make it the frontmost layer
QTTrack *track = [movie addVideoTrackWithSize:size];
[track setAttribute:[NSNumber numberWithShort:-1] forKey:QTTrackLayerAttribute];
// Create a codec dictionary for the image we're about to add
NSDictionary *imageDict = [NSDictionary dictionaryWithObjectsAndKeys:
@"tiff", QTAddImageCodecType,
[NSNumber numberWithLong:codecHighQuality], QTAddImageCodecQuality, nil];
// Get the video length in QT speak
QTTime qttime = [currentMovie duration];
NSTimeInterval reftime;
QTGetTimeInterval(qttime, &reftime);
//Add the image for the entire duration of the video
[track addImage:image forDuration:qttime withAttributes:imageDict];
// Finally, tell the track that it should use its alpha correctly
MediaHandler media = GetMediaHandler([[track media] quickTimeMedia]);
MediaSetGraphicsMode(media, graphicsModeStraightAlpha, NULL);
...這就是它!您的電影現在有一個水印,您可以將其導出到文件。
感謝您的回答。我剩下的唯一問題(就此而言)是 - QTKit是否可用並允許在iPhone上使用? – Brian
基本上,不,不。就像我說的,不幸的是,唯一能做這種事情的方法就是編寫自己的QuickTime,編解碼器和所有的東西! – iKenndac
拍攝視頻後,我想在視頻上做水印嗎?請你幫我? –