AVI header 채우기 (ADPCM)[완료]

rev7707의 이미지

avi open source 를 구해서 mpeg4 와 IMA-adpcm을 넣어 동영상을
만드는 함수를 만들었습니다. 그런데 화면은 나오는데 소리가는 제대로 안나와서 약간 수정했더니
소리는 나오는데(윈도우에 코덱있는거 확인했는데 안나와서 통합코덱까니깐 나왔음)
윈도우에서 등록정보를 보면 오디오의 정보가 잘 못표시되네요.(비트전송율)
아시는 분 도움 부탁드립니다.
아래는파일헤더를 채우는 부분입니다.

오디오 정보: IMA-adpcm, 4bit, mono, 32000sampling.
OUT--- 은 파일에 쓰는 함수입니다.

int aud_extword =0;
// sampsize = avi_sampsize(AVI);

/* Start the audio stream list ---------------------------------- */

OUT4CC ("LIST");
OUTLONG(0); /* Length of list in bytes, don't know yet */
strl_start = nhb; /* Store start position */
OUT4CC ("strl");

/* The audio stream header */

OUT4CC ("strh");
OUTLONG(64); /* # of bytes to follow */
OUT4CC ("auds");
OUT4CC ("\0\0\0\0");
OUTLONG(0); /* Flags */
OUTLONG(0); /* Reserved, MS says: wPriority, wLanguage */
OUTLONG(0); /* InitialFrames */

sampsize = 1024;
OUTLONG(sampsize); /* Scale */

//OUTLONG(sampsize*AVI->a_rate); /* Rate: Rate/Scale == samples/second */
aud_extword = (((sampsize - (4 * 1)) * 8) / (4 * 1)) + 1;
OUTLONG((32000) * sampsize / aud_extword);

OUTLONG(0); /* Start */
OUTLONG(AVI->audio_bytes/sampsize); /* Length */
// OUTLONG(0); /* SuggestedBufferSize */
OUTLONG(sampsize*8);
OUTLONG(-1); /* Quality */
OUTLONG(sampsize); /* SampleSize */
OUTLONG(0); /* Frame */
OUTLONG(0); /* Frame */
OUTLONG(0); /* Frame */
OUTLONG(0); /* Frame */

/* The audio stream format */

OUT4CC ("strf");
OUTLONG(16); /* # of bytes to follow */
OUTSHRT(AVI->a_fmt); /* Format */
OUTSHRT(AVI->a_chans); /* Number of channels */
OUTLONG(AVI->a_rate); /* SamplesPerSec */
OUTLONG(sampsize*AVI->a_rate); /* AvgBytesPerSec */
OUTSHRT(sampsize); /* BlockAlign */
OUTSHRT(AVI->a_bits); /* BitsPerSample */

/* Finish stream list, i.e. put number of bytes in the list to proper pos */

long2str(AVI_header+strl_start-4,nhb-strl_start);

}

static int avi_sampsize(avi_t *AVI)
{
int s;
s = ((AVI->a_bits+7)/8)*AVI->a_chans;
if(s==0) s=1; /* avoid possible zero divisions */
return s;
}

특히 samplesize와 scale 그리고 scale바로 아래부분이 궁금합니다.

Necromancer의 이미지

http://www.wotsit.org

가서 AVI 포맷 문서를 찾아보시면 도움이 될지 모르겠습니다.

Written By the Black Knight of Destruction

Written By the Black Knight of Destruction

Prentice의 이미지

4 x 1 x 32000 == 128000 bps == 128 kbps

맞나요?

rev7707의 이미지

감사합니다 많은 도움 됐습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.