沉水之鱼 发表于 2013-07-23 10:59

用avilib封装avi文件,为什么播放不了,都是黑的!

avi_t* avi= AVI_open_output_file("test.avi");
AVI_set_video(avi, 736, 576, 25, "H264");
AVI_write_frame(avi,(char*)Buffer_getUserPtr(hOutBuf),(long)Buffer_getNumBytesUsed(hOutBuf),1)
hOutBuf为硬件编码出来的帧buffer 结构如下
typedef struct _Buffer_Object {
    Buffer_Type             type;
    _Buffer_State         origState;
    _Buffer_State         usedState;
    Memory_AllocParams      memParams;
    Int8                   *userPtr;
    Int32                   physPtr;
    Int                     id;
    Bool                  reference;
    BufTab_Handle         hBufTab;
    Int32                   virtualBufferSize;
} _Buffer_Object;

这个帧BUFF是硬件编码器编码出来的帧,是不是要经过处理才能写进去?对这个不很懂,求解!
avilib库在附件!

用ffplay播放 显示一下error log:
ffplay version 1.2 Copyright (c) 2003-2013 the FFmpeg developers
built on Jul 23 2013 10:42:25 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
configuration: --enable-shared --prefix=/usr/local/ffmpeg/ --disable-yasm
libavutil      52. 18.100 / 52. 18.100
libavcodec   54. 92.100 / 54. 92.100
libavformat    54. 63.104 / 54. 63.104
libavdevice    54.3.103 / 54.3.103
libavfilter   3. 42.103 /3. 42.103
libswscale      2.2.100 /2.2.100
libswresample   0. 17.102 /0. 17.102
max_analyze_duration 5000000 reached at 5000000 microseconds
decoding for stream 0 failed
Could not find codec parameters for stream 0 (Video: mpeg2video (MPEG / 0x4745504D), 736x576): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
test.avi: could not find codec parameters
    nan A-V:0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
页: [1]
查看完整版本: 用avilib封装avi文件,为什么播放不了,都是黑的!