fluke.l
3rd March 2008, 07:32
Can't find it in ISO documents.:scared:
setarip_old
3rd March 2008, 09:06
Hi!
You may find what you're looking for by clicking on ther following Google search link:
http://www.google.com/search?hl=en&q=%22avcC%22+and+%22atom%22
fluke.l
12th March 2008, 03:33
I'm generating some mp4 files with my own mux filter.
But I don't know how to get valid avcC field that can be parsed by mo4box.
Here's the result of mp4box parsing:
F:\Media_files\MP4Box.exe xx0.mp4
[iso file] Box "avcC" has 180 extra bytes
bond
12th March 2008, 20:52
what about the specs?
dont double post, threads merged
fluke.l
13th March 2008, 02:54
im using x264vfw to encode h264.
FOURCC set to avc1
other setting I just left default.
I just took the extraData from x264vfw for my avcc, it make the movie can be play in many media player. But mp4box cannot parse it for "avcC has some extra bytes".
And I know avcC has sth to do with MPEG2VIDEOINFO's dwSequenceHeader, But unfortunately I can only get VIDEOINFOHEADER struct from x264vfw.
So. I steal this:
#pragma once
DWORD avc_quant(BYTE *src, BYTE *dst, int len)
{
//Stolen from libavcodec h264.c
BYTE *p = src, *d = dst;
int cnt;
cnt = *(p+5) & 0x1f; // Number of sps
if(src[0] != 0x01 || cnt > 1) {
memcpy(dst, src, len);
return len;
}
p += 6;
//cnt > 1 not supported?
cnt = (*p << 8) | *(p+1) + 2;
memcpy(d, p, cnt);
d+=cnt;
p+=cnt;
//assume pps cnt == 1 too
p++;
cnt = (*p << 8) | *(p+1) + 2;
memcpy(d, p, cnt);
return d + cnt - dst;
}
// 判断 avcc
#define is_avc(cc) (cc == mmioFOURCC('A', 'V', 'C', '1') || \
cc == mmioFOURCC('a', 'v', 'c', '1'))
// 从 VIDEOINFOHEADER 获得 MPEG2VIDEOINFO
char *ConvertVIHtoMPEG2VI(VIDEOINFOHEADER *vih, int *size)
{
int extra = 0;
if(vih->bmiHeader.biSize > sizeof(BITMAPINFOHEADER)) {
extra = vih->bmiHeader.biSize-sizeof(BITMAPINFOHEADER);
}
MPEG2VIDEOINFO *mp2vi;
//mp2vi = (struct MPEG2VIDEOINFO *)malloc(sizeof(struct MPEG2VIDEOINFO)+extra-4);
mp2vi = (MPEG2VIDEOINFO *)malloc(sizeof(MPEG2VIDEOINFO)+extra-4);
//memset(mp2vi, 0, sizeof(struct MPEG2VIDEOINFO));
memset(mp2vi, 0, sizeof(MPEG2VIDEOINFO));
mp2vi->hdr.rcSource = vih->rcSource;
mp2vi->hdr.rcTarget = vih->rcTarget;
mp2vi->hdr.dwBitRate = vih->dwBitRate;
mp2vi->hdr.dwBitErrorRate = vih->dwBitErrorRate;
mp2vi->hdr.AvgTimePerFrame = vih->AvgTimePerFrame;
mp2vi->hdr.dwPictAspectRatioX = vih->bmiHeader.biWidth;
mp2vi->hdr.dwPictAspectRatioY = vih->bmiHeader.biHeight;
memcpy(&mp2vi->hdr.bmiHeader, &vih->bmiHeader, sizeof(BITMAPINFOHEADER));
mp2vi->hdr.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
if(extra) {
if(is_avc(vih->bmiHeader.biCompression)) {
mp2vi->dwFlags = 4; //What does this mean?
mp2vi->cbSequenceHeader = avc_quant(
(BYTE *)(&vih->bmiHeader) + sizeof(BITMAPINFOHEADER),
(BYTE *)(&mp2vi->dwSequenceHeader[0]), extra);
} else {
mp2vi->cbSequenceHeader = extra;
memcpy(&mp2vi->dwSequenceHeader[0],
(BYTE *)(&vih->bmiHeader) + sizeof(BITMAPINFOHEADER), extra);
}
}
// The '4' is from the allocated space of dwSequenceHeader
//*size = sizeof(struct MPEG2VIDEOINFO) + mp2vi->cbSequenceHeader - 4;
*size = sizeof(MPEG2VIDEOINFO) + mp2vi->cbSequenceHeader - 4;
return (char *)mp2vi;
}
But I still don't know how to generate avcC atom.
And, thank you setarip_old , I im checking out the Google link.
fluke.l
13th March 2008, 10:34
I finally find some useful document.
iso 14496-15 avc file format: class AVCDecoderConfigurationRecord
iso 14496-10 Advance Video Encoding.
:helpful:
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.