Chinaunix首页 | 论坛 | 博客
  • 博客访问: 228651
  • 博文数量: 50
  • 博客积分: 1793
  • 博客等级: 上尉
  • 技术积分: 393
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-22 23:28
文章分类
文章存档

2012年(7)

2011年(17)

2010年(26)

我的朋友

分类: LINUX

2011-10-25 10:19:25


1.对于在ffmpeg里的时间戳与基本单位的概念,原理,用法不清楚
#define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
#define AV_TIME_BASE 1000000
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
这些宏定义用在什么地方作为判断,参考值==
在某些结构里有这么些字段pts,dts,time_base,timestamps
在ffmpeg里是这么解释的
  /**\
  * presentation timestamp in time_base units (time when frame should be shown to user)\
  * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
  * - encoding: MUST be set by user.\
  * - decoding: Set by libavcodec.\
  */\
  int64_t pts;\
dts

//********************************************

2.在下面这个结构里,以下3个值指的是什么,能否举个例子对应音视频里的什么内容,比如音视频文件里编解码器
CODEC_TYPE_AUDIO,CODEC_TYPE_VIDEO流,都能理解,但不理解CODEC_TYPE_SUBTITLE是什么?
enum CodecType {
  CODEC_TYPE_DATA,
  CODEC_TYPE_SUBTITLE,
  CODEC_TYPE_ATTACHMENT,
};

//********************************************

3.这个结构不知道怎么使用它
typedef struct RcOverride {
  int start_frame;
  int end_frame;
  int qscale; //如果为0,则用quality_factor替代
  float quality_factor;
}RcOverride;

//这些结构不知道怎么使用它
typedef struct AVPanScan {
  int id;
  //1/16 pel
  int width;
  int height;
  //左上角位置(1/16 pel)升到3字段或祯
  int16_t position[3][2];
}AVPanScan;
typedef struct AVPaletteControl {
  //分离器设置此选项为1指示已经改变,解码器重设为0
  int palette_changed;
  //4字节 ARGB颜色入口,保存本身字节序列
  //注:个别调色板可能是8位伸缩;如果调色板数据来自一个IBM VGA本身格式,组成数据或许6位,且需要伸缩
  unsigned int palette[AVPALETTE_COUNT];  
}
typedef struct AVSubtitleRect {
  int x; //图像左边,未定义当图像未设置时
  int y; //图像上边,未定义当图像未设置时
  int w; //图像宽,未定义当图像未设置时
  int h; //图像高,未定义当图像未设置时
  int nb_colors; //图像里颜色总数,未定义当图像未设置时
  //此副标题的位图的data+linesize
  AVPicture pict;
  enum AVSubtitleType type;
  char *text; //0结尾,utf8纯文本
  //0结尾的ass/ssa兼容的事件行
  char *ass;
}AVSubtitleRect;
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; //相对于包的pts,单位ms
  uint32_t end_display_time; //相对于包的pts,单位ms
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;



//这些结构不知道怎么使用它
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; /* relative to packet pts, in ms */
  uint32_t end_display_time; /* relative to packet pts, in ms */
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;

typedef struct AVSubtitleRect {
  uint16_t x;
  uint16_t y;
  uint16_t w;
  uint16_t h;
  uint16_t nb_colors;
  int linesize;
  uint32_t *rgba_palette;
  uint8_t *bitmap;
} AVSubtitleRect;

//********************************************

4.这些函数还不太清楚它的性能,用法,效果
draw_horiz_band();
avcodec_flush_buffers();
av_xiphlacing();

//********************************************

5.对于视频中的维度的概念不太明白.
avcodec_align_dimensions
avcodec_check_dimensions
在ffmpeg里,为什么要这样运算
void avcodec_set_dimensions(AVCodecContext *s, int width, int height) {
  s->coded_width = width;
  s->coded_height = height;
  s->width = -(( -width ) >> s->lowres);
  s->height = -(( -height) >> s->lowres);
}

//********************************************

6.CODEC_FLAG_QSCALE与CODEC_CAP_DRAW_HORIZ_BAND之间区别

//********************************************

7.有些字段在AVCodecContext及AVCodec里同时存在的?enum PixelFormat pix_fmt.有些混乱,有时不知道使用哪个

有些字段不太理解,但在out_example.c,ffmpeg.c等例子里又没有使用到,是不是存在一些字段一般在ffmpeg内部实现功能时使用的,在库外面的使用者不太需要使用
  //IP和B祯之间的qscale因数
  float b_quant_factor;
  //场景变化检测阈
  int scenechange_threshold;
  //最小拉格朗日倍数
  int lmin;

//********************************************

8.采样格式,像素格式指的是什么
enum SampleFormat {
  SAMPLE_FMT_NONE = -1,
  SAMPLE_FMT_U8, ///< unsigned 8 bits
  SAMPLE_FMT_S16, ///< signed 16 bits
  SAMPLE_FMT_S32, ///< signed 32 bits
  SAMPLE_FMT_FLT, ///< float
  SAMPLE_FMT_DBL, ///< double
  SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
};
enum PixelFormat {
  PIX_FMT_NONE= -1,
  PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
  PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
  PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
  PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
  //...
};


//********************************************

9.muxer/demuxer与encoder/decoder区别

//********************************************

10.能说说在ffmpeg里的结构,枚举,宏定义,特别是函数的前缀有什么规则么?
比如说
av_get_pict_type_char
avcodec_flush_buffers
av_oformat_next
avfilter_draw_slice

又比如,有些以audio_resample这样来开头
audio_resample_init
audio_resample
audio_resample_close
有些以av_resample来开头,
av_resample_init
av_resample
av_resample_compensate
av_resample_close
但似乎这些毓的功能都是指重采样

又比如
avpicture_alloc
avpicture_free
avpicture_fill
avpicture_layout
avpicture_get_size

av_picture_copy
av_picture_crop
av_picture_pad

特别是有些函数以av开头,有些以avcodec开头,有些以av_codec开头
如:
av_new_packet
avcodec_get_pix_fmt
av_codec_next

//********************************************

11.avfilter,avscale的用法

//********************************************

12.ReSampleContext和AVResampleContext区别

//********************************************

13.dump_format和和ffmpeg log,这些功能都是用来调试,测试的吧?
在command line程序中可以看到dump_format的信息;
如果桌面EXE应用程序,又怎么来看dump_format及ffmpeg的log信息呢?

//********************************************


14.在ffmpeg里以下的关于线程的函数是怎么一种机制?
int avcodec_thread_init(AVCodecContext *s, int thread_count);
void avcodec_thread_free(AVCodecContext *s);
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
在ffmpeg.c,out_example.c等文件里调用这些函数,还有点看不明白.
在那里怎么就没有,线程的挂起,暂停,唤醒的操作呢


在我理解的用法中:创建线程,在线程里跑一些代码如
  AVFormatContext *ifmtCtx = NULL;
  av_open_input_file(&ifmtCtx, ifile, NULL, 0, NULL);
  av_find_stream_info(ifmtCtx);
  dump_format(ifmtCtx, 0, ifile, 0);  
  for (int i = 0;i < ifmtCtx->nb_streams;i++) {
  //...
  }
  //...

//********************************************

15.这种结构怎么翻译成delphi,的*.pas文件呢,我想查找一些前辈的封装ffmpeg的类,其他IDE或语言调用的头文件
typedef struct AVCodecParser {
  int priv_data_size;
  int (*parser_init)(AVCodecParserContext *s);
  void (*parser_close)(AVCodecParserContext *s);
  int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
} AVCodecParser;

//********************************************

16.avcodec_parse_frame,img_convert 好像在dll里没有?

1.对于在ffmpeg里的时间戳与基本单位的概念,原理,用法不清楚
#define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
#define AV_TIME_BASE 1000000
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
这些宏定义用在什么地方作为判断,参考值==
在某些结构里有这么些字段pts,dts,time_base,timestamps
在ffmpeg里是这么解释的
  /**\
  * presentation timestamp in time_base units (time when frame should be shown to user)\
  * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
  * - encoding: MUST be set by user.\
  * - decoding: Set by libavcodec.\
  */\
  int64_t pts;\
dts

//********************************************

2.在下面这个结构里,以下3个值指的是什么,能否举个例子对应音视频里的什么内容,比如音视频文件里编解码器
CODEC_TYPE_AUDIO,CODEC_TYPE_VIDEO流,都能理解,但不理解CODEC_TYPE_SUBTITLE是什么?
enum CodecType {
  CODEC_TYPE_DATA,
  CODEC_TYPE_SUBTITLE,
  CODEC_TYPE_ATTACHMENT,
};

//********************************************

3.这个结构不知道怎么使用它
typedef struct RcOverride {
  int start_frame;
  int end_frame;
  int qscale; //如果为0,则用quality_factor替代
  float quality_factor;
}RcOverride;

//这些结构不知道怎么使用它
typedef struct AVPanScan {
  int id;
  //1/16 pel
  int width;
  int height;
  //左上角位置(1/16 pel)升到3字段或祯
  int16_t position[3][2];
}AVPanScan;
typedef struct AVPaletteControl {
  //分离器设置此选项为1指示已经改变,解码器重设为0
  int palette_changed;
  //4字节 ARGB颜色入口,保存本身字节序列
  //注:个别调色板可能是8位伸缩;如果调色板数据来自一个IBM VGA本身格式,组成数据或许6位,且需要伸缩
  unsigned int palette[AVPALETTE_COUNT];  
}
typedef struct AVSubtitleRect {
  int x; //图像左边,未定义当图像未设置时
  int y; //图像上边,未定义当图像未设置时
  int w; //图像宽,未定义当图像未设置时
  int h; //图像高,未定义当图像未设置时
  int nb_colors; //图像里颜色总数,未定义当图像未设置时
  //此副标题的位图的data+linesize
  AVPicture pict;
  enum AVSubtitleType type;
  char *text; //0结尾,utf8纯文本
  //0结尾的ass/ssa兼容的事件行
  char *ass;
}AVSubtitleRect;
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; //相对于包的pts,单位ms
  uint32_t end_display_time; //相对于包的pts,单位ms
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;



//这些结构不知道怎么使用它
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; /* relative to packet pts, in ms */
  uint32_t end_display_time; /* relative to packet pts, in ms */
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;

typedef struct AVSubtitleRect {
  uint16_t x;
  uint16_t y;
  uint16_t w;
  uint16_t h;
  uint16_t nb_colors;
  int linesize;
  uint32_t *rgba_palette;
  uint8_t *bitmap;
} AVSubtitleRect;

//********************************************

4.这些函数还不太清楚它的性能,用法,效果
draw_horiz_band();
avcodec_flush_buffers();
av_xiphlacing();

//********************************************

5.对于视频中的维度的概念不太明白.
avcodec_align_dimensions
avcodec_check_dimensions
在ffmpeg里,为什么要这样运算
void avcodec_set_dimensions(AVCodecContext *s, int width, int height) {
  s->coded_width = width;
  s->coded_height = height;
  s->width = -(( -width ) >> s->lowres);
  s->height = -(( -height) >> s->lowres);
}

//********************************************

6.CODEC_FLAG_QSCALE与CODEC_CAP_DRAW_HORIZ_BAND之间区别

//********************************************

7.有些字段在AVCodecContext及AVCodec里同时存在的?enum PixelFormat pix_fmt.有些混乱,有时不知道使用哪个

有些字段不太理解,但在out_example.c,ffmpeg.c等例子里又没有使用到,是不是存在一些字段一般在ffmpeg内部实现功能时使用的,在库外面的使用者不太需要使用
  //IP和B祯之间的qscale因数
  float b_quant_factor;
  //场景变化检测阈
  int scenechange_threshold;
  //最小拉格朗日倍数
  int lmin;

//********************************************

8.采样格式,像素格式指的是什么
enum SampleFormat {
  SAMPLE_FMT_NONE = -1,
  SAMPLE_FMT_U8, ///< unsigned 8 bits
  SAMPLE_FMT_S16, ///< signed 16 bits
  SAMPLE_FMT_S32, ///< signed 32 bits
  SAMPLE_FMT_FLT, ///< float
  SAMPLE_FMT_DBL, ///< double
  SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
};
enum PixelFormat {
  PIX_FMT_NONE= -1,
  PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
  PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
  PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
  PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
  //...
};


//********************************************

9.muxer/demuxer与encoder/decoder区别

//********************************************

10.能说说在ffmpeg里的结构,枚举,宏定义,特别是函数的前缀有什么规则么?
比如说
av_get_pict_type_char
avcodec_flush_buffers
av_oformat_next
avfilter_draw_slice

又比如,有些以audio_resample这样来开头
audio_resample_init
audio_resample
audio_resample_close
有些以av_resample来开头,
av_resample_init
av_resample
av_resample_compensate
av_resample_close
但似乎这些毓的功能都是指重采样

又比如
avpicture_alloc
avpicture_free
avpicture_fill
avpicture_layout
avpicture_get_size

av_picture_copy
av_picture_crop
av_picture_pad

特别是有些函数以av开头,有些以avcodec开头,有些以av_codec开头
如:
av_new_packet
avcodec_get_pix_fmt
av_codec_next

//********************************************

11.avfilter,avscale的用法

//********************************************

12.ReSampleContext和AVResampleContext区别

//********************************************

13.dump_format和和ffmpeg log,这些功能都是用来调试,测试的吧?
在command line程序中可以看到dump_format的信息;
如果桌面EXE应用程序,又怎么来看dump_format及ffmpeg的log信息呢?

//********************************************


14.在ffmpeg里以下的关于线程的函数是怎么一种机制?
int avcodec_thread_init(AVCodecContext *s, int thread_count);
void avcodec_thread_free(AVCodecContext *s);
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
在ffmpeg.c,out_example.c等文件里调用这些函数,还有点看不明白.
在那里怎么就没有,线程的挂起,暂停,唤醒的操作呢


在我理解的用法中:创建线程,在线程里跑一些代码如
  AVFormatContext *ifmtCtx = NULL;
  av_open_input_file(&ifmtCtx, ifile, NULL, 0, NULL);
  av_find_stream_info(ifmtCtx);
  dump_format(ifmtCtx, 0, ifile, 0);  
  for (int i = 0;i < ifmtCtx->nb_streams;i++) {
  //...
  }
  //...

//********************************************

15.这种结构怎么翻译成delphi,的*.pas文件呢,我想查找一些前辈的封装ffmpeg的类,其他IDE或语言调用的头文件
typedef struct AVCodecParser {
  int priv_data_size;
  int (*parser_init)(AVCodecParserContext *s);
  void (*parser_close)(AVCodecParserContext *s);
  int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
} AVCodecParser;

//********************************************

16.avcodec_parse_frame,img_convert 好像在dll里没有?

1.对于在ffmpeg里的时间戳与基本单位的概念,原理,用法不清楚
#define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
#define AV_TIME_BASE 1000000
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
这些宏定义用在什么地方作为判断,参考值==
在某些结构里有这么些字段pts,dts,time_base,timestamps
在ffmpeg里是这么解释的
  /**\
  * presentation timestamp in time_base units (time when frame should be shown to user)\
  * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
  * - encoding: MUST be set by user.\
  * - decoding: Set by libavcodec.\
  */\
  int64_t pts;\
dts

//********************************************

2.在下面这个结构里,以下3个值指的是什么,能否举个例子对应音视频里的什么内容,比如音视频文件里编解码器
CODEC_TYPE_AUDIO,CODEC_TYPE_VIDEO流,都能理解,但不理解CODEC_TYPE_SUBTITLE是什么?
enum CodecType {
  CODEC_TYPE_DATA,
  CODEC_TYPE_SUBTITLE,
  CODEC_TYPE_ATTACHMENT,
};

//********************************************

3.这个结构不知道怎么使用它
typedef struct RcOverride {
  int start_frame;
  int end_frame;
  int qscale; //如果为0,则用quality_factor替代
  float quality_factor;
}RcOverride;

//这些结构不知道怎么使用它
typedef struct AVPanScan {
  int id;
  //1/16 pel
  int width;
  int height;
  //左上角位置(1/16 pel)升到3字段或祯
  int16_t position[3][2];
}AVPanScan;
typedef struct AVPaletteControl {
  //分离器设置此选项为1指示已经改变,解码器重设为0
  int palette_changed;
  //4字节 ARGB颜色入口,保存本身字节序列
  //注:个别调色板可能是8位伸缩;如果调色板数据来自一个IBM VGA本身格式,组成数据或许6位,且需要伸缩
  unsigned int palette[AVPALETTE_COUNT];  
}
typedef struct AVSubtitleRect {
  int x; //图像左边,未定义当图像未设置时
  int y; //图像上边,未定义当图像未设置时
  int w; //图像宽,未定义当图像未设置时
  int h; //图像高,未定义当图像未设置时
  int nb_colors; //图像里颜色总数,未定义当图像未设置时
  //此副标题的位图的data+linesize
  AVPicture pict;
  enum AVSubtitleType type;
  char *text; //0结尾,utf8纯文本
  //0结尾的ass/ssa兼容的事件行
  char *ass;
}AVSubtitleRect;
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; //相对于包的pts,单位ms
  uint32_t end_display_time; //相对于包的pts,单位ms
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;



//这些结构不知道怎么使用它
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; /* relative to packet pts, in ms */
  uint32_t end_display_time; /* relative to packet pts, in ms */
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;

typedef struct AVSubtitleRect {
  uint16_t x;
  uint16_t y;
  uint16_t w;
  uint16_t h;
  uint16_t nb_colors;
  int linesize;
  uint32_t *rgba_palette;
  uint8_t *bitmap;
} AVSubtitleRect;

//********************************************

4.这些函数还不太清楚它的性能,用法,效果
draw_horiz_band();
avcodec_flush_buffers();
av_xiphlacing();

//********************************************

5.对于视频中的维度的概念不太明白.
avcodec_align_dimensions
avcodec_check_dimensions
在ffmpeg里,为什么要这样运算
void avcodec_set_dimensions(AVCodecContext *s, int width, int height) {
  s->coded_width = width;
  s->coded_height = height;
  s->width = -(( -width ) >> s->lowres);
  s->height = -(( -height) >> s->lowres);
}

//********************************************

6.CODEC_FLAG_QSCALE与CODEC_CAP_DRAW_HORIZ_BAND之间区别

//********************************************

7.有些字段在AVCodecContext及AVCodec里同时存在的?enum PixelFormat pix_fmt.有些混乱,有时不知道使用哪个

有些字段不太理解,但在out_example.c,ffmpeg.c等例子里又没有使用到,是不是存在一些字段一般在ffmpeg内部实现功能时使用的,在库外面的使用者不太需要使用
  //IP和B祯之间的qscale因数
  float b_quant_factor;
  //场景变化检测阈
  int scenechange_threshold;
  //最小拉格朗日倍数
  int lmin;

//********************************************

8.采样格式,像素格式指的是什么
enum SampleFormat {
  SAMPLE_FMT_NONE = -1,
  SAMPLE_FMT_U8, ///< unsigned 8 bits
  SAMPLE_FMT_S16, ///< signed 16 bits
  SAMPLE_FMT_S32, ///< signed 32 bits
  SAMPLE_FMT_FLT, ///< float
  SAMPLE_FMT_DBL, ///< double
  SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
};
enum PixelFormat {
  PIX_FMT_NONE= -1,
  PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
  PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
  PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
  PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
  //...
};


//********************************************

9.muxer/demuxer与encoder/decoder区别

//********************************************

10.能说说在ffmpeg里的结构,枚举,宏定义,特别是函数的前缀有什么规则么?
比如说
av_get_pict_type_char
avcodec_flush_buffers
av_oformat_next
avfilter_draw_slice

又比如,有些以audio_resample这样来开头
audio_resample_init
audio_resample
audio_resample_close
有些以av_resample来开头,
av_resample_init
av_resample
av_resample_compensate
av_resample_close
但似乎这些毓的功能都是指重采样

又比如
avpicture_alloc
avpicture_free
avpicture_fill
avpicture_layout
avpicture_get_size

av_picture_copy
av_picture_crop
av_picture_pad

特别是有些函数以av开头,有些以avcodec开头,有些以av_codec开头
如:
av_new_packet
avcodec_get_pix_fmt
av_codec_next

//********************************************

11.avfilter,avscale的用法

//********************************************

12.ReSampleContext和AVResampleContext区别

//********************************************

13.dump_format和和ffmpeg log,这些功能都是用来调试,测试的吧?
在command line程序中可以看到dump_format的信息;
如果桌面EXE应用程序,又怎么来看dump_format及ffmpeg的log信息呢?

//********************************************


14.在ffmpeg里以下的关于线程的函数是怎么一种机制?
int avcodec_thread_init(AVCodecContext *s, int thread_count);
void avcodec_thread_free(AVCodecContext *s);
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
在ffmpeg.c,out_example.c等文件里调用这些函数,还有点看不明白.
在那里怎么就没有,线程的挂起,暂停,唤醒的操作呢


在我理解的用法中:创建线程,在线程里跑一些代码如
  AVFormatContext *ifmtCtx = NULL;
  av_open_input_file(&ifmtCtx, ifile, NULL, 0, NULL);
  av_find_stream_info(ifmtCtx);
  dump_format(ifmtCtx, 0, ifile, 0);  
  for (int i = 0;i < ifmtCtx->nb_streams;i++) {
  //...
  }
  //...

//********************************************

15.这种结构怎么翻译成delphi,的*.pas文件呢,我想查找一些前辈的封装ffmpeg的类,其他IDE或语言调用的头文件
typedef struct AVCodecParser {
  int priv_data_size;
  int (*parser_init)(AVCodecParserContext *s);
  void (*parser_close)(AVCodecParserContext *s);
  int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
} AVCodecParser;

//********************************************

16.avcodec_parse_frame,img_convert 好像在dll里没有?
不小心看到别人提的一堆(真的是一堆,而且是一大堆)关于ffmpeg的问题,而这里边有部分问题我也至今没有搞清楚,把它转过来看看有没有人能帮忙解决。

原地址:


1.对于在ffmpeg里的时间戳与基本单位的概念,原理,用法不清楚
#define AV_NOPTS_VALUE INT64_C(0x8000000000000000)
#define AV_TIME_BASE 1000000
#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE}
这些宏定义用在什么地方作为判断,参考值==
在某些结构里有这么些字段pts,dts,time_base,timestamps
在ffmpeg里是这么解释的
  /**\
  * presentation timestamp in time_base units (time when frame should be shown to user)\
  * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
  * - encoding: MUST be set by user.\
  * - decoding: Set by libavcodec.\
  */\
  int64_t pts;\
dts

//********************************************

2.在下面这个结构里,以下3个值指的是什么,能否举个例子对应音视频里的什么内容,比如音视频文件里编解码器

CODEC_TYPE_AUDIO,CODEC_TYPE_VIDEO流,都能理解,但不理解CODEC_TYPE_SUBTITLE是什么?
enum CodecType {
  CODEC_TYPE_DATA,
  CODEC_TYPE_SUBTITLE,
  CODEC_TYPE_ATTACHMENT,
};

//********************************************

3.这个结构不知道怎么使用它
typedef struct RcOverride {
  int start_frame;
  int end_frame;
  int qscale; //如果为0,则用quality_factor替代
  float quality_factor;
}RcOverride;

//这些结构不知道怎么使用它
typedef struct AVPanScan {
  int id;
  //1/16 pel
  int width;
  int height;
  //左上角位置(1/16 pel)升到3字段或祯
  int16_t position[3][2];
}AVPanScan;
typedef struct AVPaletteControl {
  //分离器设置此选项为1指示已经改变,解码器重设为0
  int palette_changed;
  //4字节 ARGB颜色入口,保存本身字节序列
  //注:个别调色板可能是8位伸缩;如果调色板数据来自一个IBM VGA本身格式,组成数据或许6位,且需要伸缩
  unsigned int palette[AVPALETTE_COUNT];  
}
typedef struct AVSubtitleRect {
  int x; //图像左边,未定义当图像未设置时
  int y; //图像上边,未定义当图像未设置时
  int w; //图像宽,未定义当图像未设置时
  int h; //图像高,未定义当图像未设置时
  int nb_colors; //图像里颜色总数,未定义当图像未设置时
  //此副标题的位图的data+linesize
  AVPicture pict;
  enum AVSubtitleType type;
  char *text; //0结尾,utf8纯文本
  //0结尾的ass/ssa兼容的事件行
  char *ass;
}AVSubtitleRect;
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; //相对于包的pts,单位ms
  uint32_t end_display_time; //相对于包的pts,单位ms
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;



//这些结构不知道怎么使用它
typedef struct AVSubtitle {
  uint16_t format; /* 0 = graphics */
  uint32_t start_display_time; /* relative to packet pts, in ms */
  uint32_t end_display_time; /* relative to packet pts, in ms */
  unsigned num_rects;
  AVSubtitleRect **rects;
}AVSubtitle;

typedef struct AVSubtitleRect {
  uint16_t x;
  uint16_t y;
  uint16_t w;
  uint16_t h;
  uint16_t nb_colors;
  int linesize;
  uint32_t *rgba_palette;
  uint8_t *bitmap;
} AVSubtitleRect;

//********************************************

4.这些函数还不太清楚它的性能,用法,效果
draw_horiz_band();
avcodec_flush_buffers();
av_xiphlacing();

//********************************************

5.对于视频中的维度的概念不太明白.
avcodec_align_dimensions
avcodec_check_dimensions
在ffmpeg里,为什么要这样运算
void avcodec_set_dimensions(AVCodecContext *s, int width, int height) {
  s->coded_width = width;
  s->coded_height = height;
  s->width = -(( -width ) >> s->lowres);
  s->height = -(( -height) >> s->lowres);
}

//********************************************

6.CODEC_FLAG_QSCALE与CODEC_CAP_DRAW_HORIZ_BAND之间区别

//********************************************

7.有些字段在AVCodecContext及AVCodec里同时存在的?enum PixelFormat pix_fmt.有些混乱,有时不知道使用哪个

有些字段不太理解,但在out_example.c,ffmpeg.c等例子里又没有使用到,是不是存在一些字段一般在ffmpeg内部实现功能时使用的,在库外面的使用者不太需要使用
  //IP和B祯之间的qscale因数
  float b_quant_factor;
  //场景变化检测阈
  int scenechange_threshold;
  //最小拉格朗日倍数
  int lmin;

//********************************************

8.采样格式,像素格式指的是什么
enum SampleFormat {
  SAMPLE_FMT_NONE = -1,
  SAMPLE_FMT_U8, ///< unsigned 8 bits
  SAMPLE_FMT_S16, ///< signed 16 bits
  SAMPLE_FMT_S32, ///< signed 32 bits
  SAMPLE_FMT_FLT, ///< float
  SAMPLE_FMT_DBL, ///< double
  SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
};
enum PixelFormat {
  PIX_FMT_NONE= -1,
  PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
  PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
  PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
  PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
  //...
};


//********************************************

9.muxer/demuxer与encoder/decoder区别


//********************************************

10.能说说在ffmpeg里的结构,枚举,宏定义,特别是函数的前缀有什么规则么?
比如说
av_get_pict_type_char
avcodec_flush_buffers
av_oformat_next
avfilter_draw_slice

又比如,有些以audio_resample这样来开头
audio_resample_init
audio_resample
audio_resample_close
有些以av_resample来开头,
av_resample_init
av_resample
av_resample_compensate
av_resample_close
但似乎这些毓的功能都是指重采样

又比如
avpicture_alloc
avpicture_free
avpicture_fill
avpicture_layout
avpicture_get_size

av_picture_copy
av_picture_crop
av_picture_pad

特别是有些函数以av开头,有些以avcodec开头,有些以av_codec开头
如:
av_new_packet
avcodec_get_pix_fmt
av_codec_next

//********************************************

11.avfilter,avscale的用法

//********************************************

12.ReSampleContext和AVResampleContext区别

//********************************************

13.dump_format和和ffmpeg log,这些功能都是用来调试,测试的吧?
在command line程序中可以看到dump_format的信息;
如果桌面EXE应用程序,又怎么来看dump_format及ffmpeg的log信息呢?

//********************************************


14.在ffmpeg里以下的关于线程的函数是怎么一种机制?
int avcodec_thread_init(AVCodecContext *s, int thread_count);
void avcodec_thread_free(AVCodecContext *s);
int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void **arg, int *ret, int count);
在ffmpeg.c,out_example.c等文件里调用这些函数,还有点看不明白.
在那里怎么就没有,线程的挂起,暂停,唤醒的操作呢


在我理解的用法中:创建线程,在线程里跑一些代码如
  AVFormatContext *ifmtCtx = NULL;
  av_open_input_file(&ifmtCtx, ifile, NULL, 0, NULL);
  av_find_stream_info(ifmtCtx);
  dump_format(ifmtCtx, 0, ifile, 0);  
  for (int i = 0;i < ifmtCtx->nb_streams;i++) {
  //...
  }
  //...

//********************************************

15.这种结构怎么翻译成delphi,的*.pas文件呢,我想查找一些前辈的封装ffmpeg的类,其他IDE或语言调用的头文件
typedef struct AVCodecParser {
  int priv_data_size;
  int (*parser_init)(AVCodecParserContext *s);
  void (*parser_close)(AVCodecParserContext *s);
  int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
} AVCodecParser;

//********************************************

16.avcodec_parse_frame,img_convert 好像在dll里没有?
阅读(6340) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~