Fragmenting H.264 Frames Over IP Networks

本文深入探讨了视频质量在视觉通讯中的关键要素,特别关注H.264编码中的多切片策略及其对网络传输中包丢失敏感性的影响。通过解析不同切片类型和网络包类型,解释了如何优化编码过程以提高视频传输的鲁棒性和效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I have said it before and I’ll say it again: video quality in visualcommunications is a lot more than just the video codec.

H.264 and slices

I recently had to explain why we need “multi-slicing” to be supported inour H.264 video encoder and how this influences the sensitivity (or robustness)to packet losses.

You see – in classic video coding, the video frame is split into macroblocks, where each macroblock is compressedseparately. In H.264, a number of consecutive macroblocks can be grouped into aslice and so a frame can be comprised of several slices.

From a network perspective, a slice or a group of slices are encapsulatedinto a NALU – a Network Abstraction Layer Unit, which serves as a container.This allows a decoder to decode it independently of the other NALUs of a frame.

The way these NALUs are created, packetized and sent over the networkaffects packet loss resilience.

Group

Type

Packet

Type name

Single

1-23

NAL unit

Single NAL unit packet per H.264

Aggregation

24

STAP-A

Single-time aggregation packet

25

STAP-B

Single-time aggregation packet

26

MTAP16

Multi-time aggregation packet

27

MTAP24

Multi-time aggregation packet

Fragmentation

28

FU-A

Fragmentation unit

29

FU-B

Fragmentation unit

Packet types, as defined in RFC3984

As can be seen in the table above, packet types are divided in generalinto 3: single NALU per packet, multiple NALU in one packet and one NALUfragmented over multiple packets.

Single NALU per packet

The most straight forward solution is to place each NALU in its ownpacket. And while this makes everything easy on the decoder side, as you justdecode the packet you receive, it is quite a headache on the encoder side. Why?Because of that nagging little thing called MTU size. You see – if you want a NALU to fitinto a packet, you must make sure that it is within the MTU size of thenetwork. And if you really want to be effective, you should probably try tomake each NALU as close as possible to the MTU size itself.


When I wrote “multi-slicing” earlier, I generally meant that the encodershould be capable of encoding a frame into multiple slices, where each slicecan fit nicely into the MTU size (which is a configurable and not a staticvalue).

I should tell you that most out of the box encoders don’t do such a goodjob when it comes to supporting multi-slicing.

Aggregating multiple NALUs per packet

Another option is to take several NALUs and place them in a single packet.

With the resolutions used today, and the resolutions coming in the future,the need to split a frame into more slices, with a negligible but existentoverhead of a slice header, makes little sense. The only reasonable place Iknow of where this is a common practice is when dealing with circuit switching:3G-324M doesn’t like payloads that are largerthan 254 bytes, and when interworking with IP it makes sense to aggregate thesesmaller NALUs into larger network packets.

Fragmenting a NALU between packets

What is left is the ability to take a single NALU and fragment it betweenseveral network packets, placing each part in a separateRTPpacket. This is important when MTU size becomes a restriction, and NALUs aremuch bigger than it.

The down side of it is that when you miss a packet, the whole set ofpackets of the same NALU are considered lost since they cannot be decoded anylonger, which makes for bad implementation to use over IP networks.

It is also the most common approach of general purpose encoders, as it isthe easiest to implement in the encoder: you encode each frame as a single NALUand let the transport layer of the system deal with it.

 


【基于QT的调色板】是一个使用Qt框架开发的色彩选择工具,类似于Windows操作系统中常见的颜色选取器。Qt是一个跨平台的应用程序开发框架,广泛应用于桌面、移动和嵌入式设备,支持C++和QML语言。这个调色板功能提供了横竖两种渐变模式,用户可以方便地选取所需的颜色值。 在Qt中,调色板(QPalette)是一个关键的类,用于管理应用程序的视觉样式。QPalette包含了一系列的颜色角色,如背景色、前景色、文本色、高亮色等,这些颜色可以根据用户的系统设置或应用程序的需求进行定制。通过自定义QPalette,开发者可以创建具有独特视觉风格的应用程序。 该调色板功能可能使用了QColorDialog,这是一个标准的Qt对话框,允许用户选择颜色。QColorDialog提供了一种简单的方式来获取用户的颜色选择,通常包括一个调色板界面,用户可以通过滑动或点击来选择RGB、HSV或其他色彩模型中的颜色。 横渐变取色可能通过QGradient实现,QGradient允许开发者创建线性或径向的色彩渐变。线性渐变(QLinearGradient)沿直线从一个点到另一个点过渡颜色,而径向渐变(QRadialGradient)则以圆心为中心向外扩散颜色。在调色板中,用户可能可以通过滑动条或鼠标拖动来改变渐变的位置,从而选取不同位置的颜色。 竖渐变取色则可能是通过调整QGradient的方向来实现的,将原本水平的渐变方向改为垂直。这种设计可以提供另一种方式来探索颜色空间,使得选取颜色更为直观和便捷。 在【colorpanelhsb】这个文件名中,我们可以推测这是与HSB(色相、饱和度、亮度)色彩模型相关的代码或资源。HSB模型是另一种常见且直观的颜色表示方式,与RGB或CMYK模型不同,它以人的感知为基础,更容易理解。在这个调色板中,用户可能可以通过调整H、S、B三个参数来选取所需的颜色。 基于QT的调色板是一个利用Qt框架和其提供的色彩管理工具,如QPalette、QColorDialog、QGradient等,构建的交互式颜色选择组件。它不仅提供了横竖渐变的色彩选取方式,还可能支持HSB色彩模型,使得用户在开发图形用户界面时能更加灵活和精准地控制色彩。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值