Code Monkey home page Code Monkey logo

Comments (9)

elango avatar elango commented on May 28, 2024

Did you get a chance to make the audio working?

from gpuimage.

kobenini avatar kobenini commented on May 28, 2024

In File GPUImageMovieWriter.m

Function - (void)initializeMovie{
....
assetWriterPixelBufferInput = [AVAssetWriterInputPixelBufferAdaptor assetWriterInputPixelBufferAdaptorWithAssetWriterInput:assetWriterVideoInput sourcePixelBufferAttributes:sourcePixelBufferAttributesDictionary];

[assetWriter addInput:assetWriterVideoInput];

// *****add by me  
// Add the audio input
AudioChannelLayout acl;
bzero( &acl, sizeof(acl));
acl.mChannelLayoutTag = kAudioChannelLayoutTag_Mono;
NSDictionary* audioOutputSettings = nil; 
audioOutputSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                       [ NSNumber numberWithInt: kAudioFormatMPEG4AAC ], AVFormatIDKey,
                       [ NSNumber numberWithInt: 1 ], AVNumberOfChannelsKey,
                       [ NSNumber numberWithFloat: 44100.0 ], AVSampleRateKey,
                       [ NSNumber numberWithInt: 64000 ], AVEncoderBitRateKey,
                       [ NSData dataWithBytes: &acl length: sizeof( acl ) ], AVChannelLayoutKey,
                       nil];

AVAssetWriterInput *_audioWriterInput = [AVAssetWriterInput 
                      assetWriterInputWithMediaType: AVMediaTypeAudio 
                      outputSettings: audioOutputSettings ];

_audioWriterInput.expectsMediaDataInRealTime = YES;

[assetWriter addInput:_audioWriterInput];

}

But the film still silence. Is there something wrong with this code ?
How can i capture the video with audio?

Thanks in advance!

from gpuimage.

ountzza avatar ountzza commented on May 28, 2024

Still no luck on my end too.

Can anyone point me to the right direction?

Thankz in advance :)

from gpuimage.

ankitmalhotra avatar ankitmalhotra commented on May 28, 2024

@kobenini , i followed similar approach, but no results.

from gpuimage.

iwanglian avatar iwanglian commented on May 28, 2024

I have add code as Avcam Demo in WWDC, but no audio was recorded.

from gpuimage.

BradLarson avatar BradLarson commented on May 28, 2024

Audio recording for both live video and for filtered movies should now be fully functional within the framework.

from gpuimage.

kobenini avatar kobenini commented on May 28, 2024

Wow! That's amazing!

Great works.

Thanks!

Audio recording for both live video and for filtered movies should now be fully functional within the framework.


Reply to this email directly or view it on GitHub:
#25 (comment)

from gpuimage.

WilliamShenw avatar WilliamShenw commented on May 28, 2024

cool

from gpuimage.

shruthimr avatar shruthimr commented on May 28, 2024

Hi All,

I am working on applying sepia filter on a video using the GPUImageSepiaFilter. The filtering go through very well but its stripping off the audio from the movie.

This is what i am doing.

-(IBAction)addFilter:(id)sender
{

movieFile = [[GPUImageMovie alloc] initWithURL:movieURL];
sepiaFilter = [[GPUImageSepiaFilter alloc] init];
[movieFile addTarget:sepiaFilter];    

movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:filteredMovieURL size:CGSizeMake(1280.0, 720.0)];
[sepiaFilter addTarget:movieWriter];

movieWriter.shouldPassthroughAudio = YES;
movieFile.audioEncodingTarget = movieWriter;
[movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];

[movieWriter startRecording];
[movieFile startProcessing];

 __weak id weakSelf = self;
[movieWriter setCompletionBlock:^{
    [weakSelf finishedFilter];

}];    

}

-(void)finishedFilter
{

[sepiaFilter removeTarget:movieWriter];
[movieWriter finishRecording];

}

I tried to step into the code and I see when the control comes to startProcessing of GPUImageMovie.m the audioTracks is empty.

NSArray *audioTracks = [self.asset tracksWithMediaType:AVMediaTypeAudio];

Looks like the sepia filtering is taking away the audio?

Any idea on how to handle this. Any help would be great !

Thanks,
Shruthi.

from gpuimage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.