在VC ++中使用H264视频压缩和UDP打孔。 [英] Using H264 video Compression with UDP hole punching in VC++.

查看:93
本文介绍了在VC ++中使用H264视频压缩和UDP打孔。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自爱尔兰的您好,

我正在使用H264压缩和实时视频解压缩。我通过UDP套接字使用Hole-Punching将它从一台Windows计算机发送到另一台。所有开发都在Visual C ++中。它进展顺利,我有一个工作版本。当
我使用

I am working with H264 compression and decompression on live video. I am sending it from one windows computer to another using Hole-Punching through UDP sockets. All development is in Visual C++. It is going well and I have a working version. When I compress the video frame with the

avcodec_encode_video2命令我得到了

avcodec_encode_video2 command I get the

AVPacket后面我可以通过UDP套接字发送到另一台机器,可以解压缩并显示它。

AVPacket back which I can then send to another machine via the UDP socket where it can be decompressed and displayed.

我遇到的问题是数据包的长度从12个字节到32000不等。发送这些数据的唯一方法是将它们全部填充到32,000字节,这意味着我发送的大部分内容是填充。我可以使用

The issue I have is that the Packets vary in length from 12 bytes to 32000. The only way to send these is to pad them all out to 32,000 bytes and that means that most of what I am sending is padding. I can use the

time_base.den标志,我已将其值从25更改为130,现在所有数据包都低于10,000字节,但仍然很长。我已尝试各种各样的价值与旗帜无济于事,我已经在互联网上搜索了一些例子,但无济于事。我
试图遗漏最长的数据包。我已经尝试将数据包分组为32,000字节的字符串。没有骰子。我想让H264压缩器给我更小的包。任何帮助非常感谢。 - Peadar。

time_base.den flag, I have changed its value from 25 to 130 and now all packets are below 10,000 bytes but that is still very long. I have tried all sorts of values with the flag to no avail and I have trawled the internet for examples but to no avail. I have tried leaving out the longest packets. I have tried grouping the packets into 32,000 bytes strings. No dice. I would like to get the H264 compressor to give me smaller packets. Any help much appreciated. - Peadar.

 

推荐答案

大家好,

Peadar in爱尔兰再次。我将回答我自己的问题。

Peadar in Ireland again. I am going to answer my own question.

如果您使用H264压缩从一台Windows机器向另一台Windows机器发送实时视频,您可能会遇到数据包太大的问题。在进行压缩时,有一个名为
的结构

If you are sending live video from one windows machine to another using H264 compression you will probably run into the issue of packets being too big. When doing the compressing there is a struct called

AVCodecContext。在这个结构中有两个标志:qmin和qmax。这些是量化标志,它们是程序员告诉系统压缩帧数的方式。您将不得不尝试各种值来查看适合您的压缩级别b $ b。我为qmin选择了35,为qmax选择了51。这给了我可接受的视频质量,我发送的数据包都低于2200字节。

AVCodecContext. In this struct there are two flags: qmin and qmax. These are the quantization flags and they are the programmers way of telling the system how much to compress the frames. You will have to experiment with various values to see what level of compression suits you. I picked 35 for qmin and 51 for qmax. This gives me acceptable video quality and the packets I am sending are all below 2200 bytes.

Peadar


这篇关于在VC ++中使用H264视频压缩和UDP打孔。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆