我之前的问题没有找到解决方案,所以我决定逐步尝试。
现在我想要做的事情是将RTP/H264流存储为文件。
目前我找到的是以下内容:
(首先我的RTP/H264是FU-A格式)
| RTP HEADER 12bytes long | FU INDICATOR 1byte | FU HEADER 1byte | FU payload |
根据我理解RFC 6184文档,我将使用在FU头的第一个比特为'1'的数据包开启NAL,并附加接下来的数据包,在最后一个数据包的FU头的第二个比特位设定'1'。
我认为这是在进行FU-A封装之前获取完整的NAL的方法,同时我发现需要在每个完整的NAL前面放置“起始比特”(0x00000001)。
但到目前为止还没有成功。以下是日志的一部分
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= adding the next NAL as 716
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]7C/1111100 [5]85/10000101 [6]B8/10111000 [7]40/1000000 ...
========= a NAL is summed up as 4866
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= adding the next NAL as 139
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E2/11100010 [7]20/100000 ...
========= a NAL is summed up as 7061
========= the new NAL is as 1377
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]41/1000001 [5]E4/11100100 [6]40/1000000 [7]1A/11010 ...
========= a NAL is summed up as 1369
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E6/11100110 [7]60/1100000 ...
========= adding the next NAL as 94
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]E6/11100110 [7]60/1100000 ...
========= a NAL is summed up as 1472
========= the new NAL is as 447
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]41/1000001 [5]E8/11101000 [6]80/10000000 [7]16/10110 ...
========= a NAL is summed up as 439
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EA/11101010 [7]A0/10100000 ...
========= adding the next NAL as 1174
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EA/11101010 [7]A0/10100000 ...
========= a NAL is summed up as 2552
========= the new NAL is as 1400
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EC/11101100 [7]C0/11000000 ...
========= adding the next NAL as 1364
[0]0/0 [1]0/0 [2]0/0 [3]1/1 [4]5C/1011100 [5]81/10000001 [6]EC/11101100 [7]C0/11000000 ...
========= a NAL is summed up as 2742
========= the new NAL is as 1400
...
我的问题是,
如果我可以通过FU-A从分片数据包中获取完整的NAL单元,那么我该如何将其制作成能够在VLC或其他播放器中运行的文件?
我仍然不确定是否需要保留FU指示符和FU头部。有人说我只需要在第一个分片数据包(以FU头部的'1'开头)中保留它们。
非常感谢任何建议。
谢谢。