编码域中的DCT系数和运动矢量提取
DCT coefficient and motion vector extraction in encoded domain
我想从MPEG 4视频中提取DCT系数和运动向量而不解码。我已经搜索了答案,但没有发现任何有用的东西。
请友好地分享任何想法,执行此任务或代码的可能性。
一些我能够使用ffmpeg读取编码代码的代码。
void CFfmpegmethods::VideoRead(){
//cout << "this is video read" << endl;
const char *url = "H:/Sanduni_projects/ad_2.mp4";
AVFormatContext *s = NULL;
int ret = avformat_open_input(&s, url, NULL, NULL);
if (ret < 0)
//abort();
AVDictionary *options = NULL;
av_dict_set(&options, "video_size", "640x480", 0);
av_dict_set(&options, "pixel_format", "rgb24", 0);
if (avformat_open_input(&s, url, NULL, &options) < 0){
//abort();
}
av_dict_free(&options);
AVDictionaryEntry *e;
if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) {
fprintf(stderr, "Option %s not recognized by the demuxer.n", e->key);
//abort();
}
avformat_close_input(&s);
}
我能够如下提取运动向量。在这里,我使用坐标生成一个数组。那是向量的初始和目的地位置。
static int MV_generation(const AVPacket *pkt)
{
double x_src_val = 0;
double y_src_val = 0;
double x_dst_val = 0;
double y_dst_val = 0;
int ret = avcodec_send_packet(video_dec_ctx, pkt);
while (ret >= 0){
ret = avcodec_receive_frame(video_dec_ctx, frame);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
break;
}
if (ret >= 0) {
AVFrameSideData *sd;
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);
if (sd) {
const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
int size_sd = sd->size;
}
av_frame_unref(frame);
}
}
return 0;
}
相关文章:
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 如何从 std::atomic 中提取指针 T<T>?
- 为什么istream不支持右值提取
- 如何设置一个范围来提取我想要获得的信息
- 视觉工作室项目.提取源文件夹名称
- C++17 - 使用自定义分配器的节点提取/重新插入 - 适用于 clang++/libc++,但不适用于 libstd
- 从字符串中提取整数并形成一个数组
- C ++中的StringStream有助于使用向量从字符串中提取逗号分隔的整数,而不是空格分隔的整数,为什么?
- asn1c 不会从 asn.1 模块中提取八位字节字符串的默认值
- 从 std::vector<无符号字符>切片中提取 int?
- 在C++中使用重载提取运算符时出现问题
- 在 Qt(C++) 中使用 QProcess 解压缩 - 提取目录问题
- C++(.cpp文件和.h文件)拆分代码并添加一个函数,提取 - 这很容易吗?
- 无法从 std::string 中提取C++ Unicode 符号
- 如何从也包含C++字母的文本文件中提取某些数字?
- 如何从适合一定范围的数字中提取数字?
- C++从通用引用中提取实际类型
- 从运行服务的应用程序代码中提取窗口句柄
- 在何处更改参考代码以从 HEVC 编码的视频中提取运动矢量
- 编码域中的DCT系数和运动矢量提取