• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding sound to movie with QTKit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding sound to movie with QTKit


  • Subject: Re: Adding sound to movie with QTKit
  • From: Eric Matecki <email@hidden>
  • Date: Wed, 16 Nov 2011 14:31:48 +0100

Thanks, I'll try that.
(Sorry Robert for the msg to your address...)

However, I don't like creating temporary files :)
Would it work if I put the sound (with a prepended AIFF header) into a NSData,
creating a movie from that (movieWithData:error:), and inserting that
movie's audio track into the "video only" movie ?

I'm really new to Cocoa and QTKit...

Thanks.

Robert Martin wrote:
One way: Save your PCM audio to an AIF file, then open it as a QTMovie. Set the attribute 'QTMovieEditableAttribute' to TRUE. It will just have one audio track.

Then:
QTTimeRange videoRange = QTMakeTimeRange(QTZeroTime, [videoTrkOnlyMovie duration]);

[audioTrkOnlyMovie insertSegmentOfTrack:[videoTrkOnlyMovie firstVideoTrack] timeRange:videoRange atTime:QTZeroTime];


Then flatten it.



On Nov 16, 2011, at 5:03 AM, Eric M. wrote:

Hello,

I create my movie this way:

QTMovie*  qtMovie = [[QTMovie  alloc]  initToWritableFile: path error: &nserror];
NSDictionary*  attributes = [NSDictionary  dictionaryWithObjectsAndKeys:
                                       @"mp4v", QTAddImageCodecType,
                                       [NSNumber  numberWithInt: codecHighQuality], QTAddImageCodecQuality,
                                       [NSNumber  numberWithLong: 10000L], QTTrackTimeScaleAttribute,
                                       nil];
QTTime  duration = QTMakeTime( 10000./mFrameRate, 10000 );

for( ""every frame"" )
{
 NSImage*  img = ""get the correct frame"";

 [qtMovie  addImage: img forDuration: duration withAttributes: attributes]
 [qtMovie  setCurrentTime: [qtMovie  duration]];
 [img  release];
}


How do I add sound to the movie ? I have the sound in memory in PCM format.

I've found how to add a sound track, but the QTTrack class has only an addImage:... method !

Thanks.



--
Keep intel OUTSIDE my Mac !
Hiii !!! I can see Intel chips creeping around my G5 !

Eric M.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Adding sound to movie with QTKit (From: "Eric M." <email@hidden>)
 >Re: Adding sound to movie with QTKit (From: Robert Martin <email@hidden>)

  • Prev by Date: Question about selection in a NSCollectionView
  • Next by Date: Re: About iVars declaration and property
  • Previous by thread: Re: Adding sound to movie with QTKit
  • Next by thread: Question about selection in a NSCollectionView
  • Index(es):
    • Date
    • Thread