Javacv-ffmpeg를 사용하여 오디오 데이터를 디코딩하기 위해 Red5 서버에서 오는 AAC 오디오 라이브 스트림을 재생하려고합니다. 바이트 패킷 여기서 [] 제가 -1을 반환 한 다음 -22 항상 첫번째 프레임에 대한 복호 후에안드로이드에서 javacv-ffmpeg로 red5 서버에서 오는 AAC 오디오 스트림
public Frame decodeAudio(byte[] adata,long timestamp){
BytePointer audio_data = new BytePointer(adata);
avcodec.AVCodec codec1 = avcodec.avcodec_find_decoder(avcodec.AV_CODEC_ID_AAC);// For AAC
if (codec1 == null) {
Log.d("showit","avcodec_find_decoder() error: Unsupported audio format or codec not found: " + audio_c.codec_id() + ".");
}
audio_c = null;
audio_c = avcodec.avcodec_alloc_context3(codec1);
audio_c.sample_rate(44100);
audio_c.sample_fmt(3);
audio_c.bits_per_raw_sample(16);
audio_c.channels(1);
if ((ret = avcodec.avcodec_open2(audio_c, codec1, (PointerPointer)null)) < 0) {
Log.d("showit","avcodec_open2() error " + ret + ": Could not open audio codec.");
}
if ((samples_frame = avcodec.avcodec_alloc_frame()) == null)
Log.d("showit","avcodec_alloc_frame() error: Could not allocate audio frame.");
avcodec.av_init_packet(pkt2);
samples_frame = avcodec.avcodec_alloc_frame();
avcodec.av_init_packet(pkt2);
pkt2.data(audio_data);
pkt2.size(audio_data.capacity());
pkt2.pts(timestamp);
pkt2.pos(0);
int len = avcodec.avcodec_decode_audio4(audio_c, samples_frame, got_frame, pkt2);
}
그러나 렌 시도 무엇으로 데이터가 수신된다.
첫 번째 패킷은 항상
AF 00 12 08 56 E5 00
또한 패킷이 문제이고 이해할 수 없었다
AF 01 01 1E 34 2C F0 A4 71 19 06 00 00 95 12 AE AA 82 5A 38 F3 E6 C2 46 DD CB 2B 09 D1 00 78 1D B7 99 F8 AB 41 6A C4 F4 D2 40 51 17 F5 28 51 9E 4C F6 8F 15 39 49 42 54 78 63 D5 29 74 1B 4C 34 9B 85 20 8E 2C 0E 0C 19 D2 E9 40 6E 9C 85 70 C2 74 44 E4 84 9B 3C B9 8A 83 EC 66 9D 40 1B 42 88 E2 F3 65 CF 6D B3 20 88 31 29 94 29 A4 B4 DE 26 B0 75 93 3A 0C 57 12 8A E3 F4 B9 F9 23 9C 69 C9 D4 BF 9E 26 63 F2 78 D6 FD 36 B9 32 62 01 91 19 71 30 2D 54 24 62 A1 20 1E BA 3D 21 AC F3 80 33 3A 1A 6C 30 3C 44 29 F2 A7 DC 9A FF 0F 99 F2 38 85 AB 41 FD C7 C5 40 5C 3F EE 38 70
처럼 이런 인 AVcodec 컨텍스트 audio_c 설정 또는 디코더 설정 용 패킷의 여부.
도움을 주시면 감사하겠습니다. 미리 감사드립니다.
데이터를 디코더, 데이터 시작 AF 00 ... 또는 AF 만 무시한다고 생각할 수 있습니다 .. –
그래서 여기에 acc 데이터의 더 나은 분석을 보았습니다. 그러나 찾을 수 없습니다. http://wiki.multimedia.cx/index.php?title=Understanding_AAC#Packaging.2FEncapsulation_And_Setup_Data 및 http://wiki.multimedia.cx/index.php에서이 기사를 통해 여러분을 도울 수 있습니다. ? title = MPEG-4_Audio –
많은 시간이 지난 후에 .. 패킷에서 첫 번째 ** AF 00 ** 데이터를 버리고 올바른 채널 수 (제 경우는 2)와 채널 레이아웃 및 프로필 유형을 설정 한 것을 발견했습니다. 오디오 컨텍스트가 잘 작동하도록 디코더를 만들었습니다. –