相关疑难解决方法(0)

使用AVAssetReader绘制波形

我使用assetUrl从iPod库中读取歌曲(在代码中命名为audioUrl)我可以用很多方式播放,我可以剪掉它,我可以用它来做一些但是......我真的不明白我要用这个做什么CMSampleBufferRef获取绘制波形的数据!我需要有关峰值的信息,我怎么能得到这个(也许是另一种)方式?

    AVAssetTrack * songTrack = [audioUrl.tracks objectAtIndex:0];
    AVAssetReaderTrackOutput * output = [[AVAssetReaderTrackOutput alloc] initWithTrack:songTrack outputSettings:nil];
    [reader addOutput:output];
    [output release];

    NSMutableData * fullSongData = [[NSMutableData alloc] init];
    [reader startReading];

    while (reader.status == AVAssetReaderStatusReading){

        AVAssetReaderTrackOutput * trackOutput = 
        (AVAssetReaderTrackOutput *)[reader.outputs objectAtIndex:0];

        CMSampleBufferRef sampleBufferRef = [trackOutput copyNextSampleBuffer];

        if (sampleBufferRef){/* what I gonna do with this? */}
Run Code Online (Sandbox Code Playgroud)

请帮我!

iphone waveform ipod objective-c core-audio

78
推荐指数
2
解决办法
4万
查看次数

从AVPlayer获取HLS的PCM数据

过去几年似乎几次都没问过这个问题,但没有人回答这个问题.我正在尝试从HLS处理PCM数据,我必须使用AVPlayer.

这篇文章点击本地文件 https://chritto.wordpress.com/2013/01/07/processing-avplayers-audio-with-mtaudioprocessingtap/

这个点击工作与远程文件,但不与.m3u8 hls文件. http://venodesigns.net/2014/01/08/recording-live-audio-streams-on-ios/

我可以在播放列表中播放前两个曲目,但它不会启动所需的回调来获取pcm,当文件是本地或远程(不是流)我仍然可以得到pcm但是它是hls不工作而我需要HLS工作

这是我的代码

//avplayer tap try
- (void)viewDidLoad {
    [super viewDidLoad];

    NSURL*testUrl= [NSURL URLWithString:@"http://playlists.ihrhls.com/c5/1469/playlist.m3u8"];

    AVPlayerItem *item = [AVPlayerItem playerItemWithURL:testUrl];
    self.player = [AVPlayer playerWithPlayerItem:item];

    // Watch the status property - when this is good to go, we can access the
    // underlying AVAssetTrack we need.
    [item addObserver:self forKeyPath:@"status" options:0 context:nil];

}

-(void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
    if(![keyPath isEqualToString:@"status"])
        return;

    AVPlayerItem *item = (AVPlayerItem *)object;
    if(item.status != AVPlayerItemStatusReadyToPlay)
        return;

    NSArray *tracks = [self.player.currentItem tracks]; …
Run Code Online (Sandbox Code Playgroud)

audio pcm http-live-streaming ios avplayer

33
推荐指数
1
解决办法
1521
查看次数

IOS上的WaveForm

我正在寻找如何绘制声音幅度.

我找到了http://supermegaultragroovy.com/2009/10/06/drawing-waveforms/但我遇到了一些问题.如何获取表示音频的浮点值列表?

cocoa-touch objective-c avfoundation ios

25
推荐指数
2
解决办法
3万
查看次数

在WebRTC for iOS中测量麦克风级别

我有一个WebRTC iOS应用程序.我有AVAudioSessionRTCAudioSource.我需要检测麦克风何时开始接收响亮的声音(比如一个人开始讲话时),类似于hark在带有AudioContext的浏览器中所做的事情.我怎样才能检测到它或得到的东西,类似于可等来测定流AVCaptureAudioChannelAVCaptureAudioDataOutput

audio ios webrtc

13
推荐指数
1
解决办法
1042
查看次数

getByteFrequencyData不适用于Safari中的实时流

如需现场演示,请访问:http://codepen.io/rrorg/pen/WxPjrz?edit = 0010

在Safari中播放HTTP音频直播流时,分析器会getByteFrequencyData使用零填充数组.

在所有其他浏览器中,这可以按预期工作,并且Safari正确填充静态文件的频率数据没有问题.

CORS标头设置正确,Apple文档没有提到特殊情况.

javascript safari stream html5-audio web-audio-api

11
推荐指数
1
解决办法
712
查看次数

使用AVPlayer播放视频并同时使用AVAudioRecorder录制声音

我谷歌搜索这个问题很多天但我找不到解决我的简单问题的方法.

我正在尝试录制声音时播放视频.没有视频,录制声音效果很好.视频无需录制即可正常工作.

一旦我将两者放在一起,录音就会抛出对声音没有反应的值,而视频不再播放.顺便说一下,这只发生在我的设备上(iPhone 4/iOS5).在模拟器中一切正常.

这是我的代码的缩减版本,它位于ViewController中.

// Audio Recorder

NSURL *nullUrl = [NSURL fileURLWithPath:@"/dev/null"];

NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
                          [NSNumber numberWithFloat:44100.0],                 AVSampleRateKey,
                          [NSNumber numberWithInt:kAudioFormatAppleLossless], AVFormatIDKey,
                          [NSNumber numberWithInt:1],                         AVNumberOfChannelsKey,
                          [NSNumber numberWithInt:AVAudioQualityMax],         AVEncoderAudioQualityKey,
                          nil];

NSError *recorderError;
_recorder = [[AVAudioRecorder alloc] initWithURL:nullUrl settings:settings error:&recorderError];

if (_recorder)
{
    [_recorder prepareToRecord];
    _recorder.meteringEnabled = YES;
    [_recorder record];

    _levelTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(levelTimerCallback:) userInfo:nil repeats:YES];
}


// Video Player

NSURL *url = [[NSBundle mainBundle] URLForResource:@"Video"
                                      withExtension:@"mp4"
                                       subdirectory:nil];

_avPlayer = [[AVPlayer playerWithURL:url] retain];
_avPlayerLayer = [[AVPlayerLayer playerLayerWithPlayer:_avPlayer] retain]; …
Run Code Online (Sandbox Code Playgroud)

iphone simultaneous recording avaudioplayer avplayer

7
推荐指数
1
解决办法
4355
查看次数