[Live-devel] Broken data when streaming HEVC video
Ross Finlayson
finlayson at live555.com
Thu May 4 10:48:52 PDT 2017
> And this is where I'm stuck. SPS, PPS, VPS NAL units are apparently mandatory, not just for ffplay, but also for MPC, and VLC, and also for my own NvCodec based decoder. I never wrote them into my files, and no program ever complained about it. The files I'm writing from within the server prior to sending (the one I gave you yesterday) are perfectly fine and do *not* contain a header.
Actually, your file “checker.265” *does* contain VPS,SPS,PPS NAL units at the start (each prepended by a 0x00 0x00 0x00 0x01 ‘start code’):
%hexdump checker.265 | head
0000000 00 00 00 01 40 01 0c 01 ff ff 01 40 00 00 03 00
0000010 00 03 00 00 03 00 00 03 00 b4 ac 09 00 00 00 01
0000020 42 01 01 01 40 00 00 03 00 00 03 00 00 03 00 00
0000030 03 00 b4 a0 00 c1 08 00 82 1f 79 6b 4a 42 59 2e
0000040 30 10 10 00 00 03 00 10 00 00 03 01 e0 80 00 00
0000050 00 01 44 01 c0 f7 c0 cc 90 00 00 00 01 26 01 af
0000060 26 6c ca 03 76 1b e3 1a 3a 3d 74 9e fe e1 ab ef
0000070 d1 6d 37 5c c3 1f 69 57 fd 5c c0 e1 1b dd ee 8a
0000080 52 11 1e a0 02 97 a8 eb 9d ee 94 12 5c d7 ee b4
0000090 6f d2 07 37 7f 83 0c 80 02 b5 3b 0a dd 80 14 75
The VPS NAL unit (nal_unit_type 32 == (0x40&0x7E)>>1) is 40 01 0c 01 ff ff 01 40 00 00 03 00 00 03 00 00 03 00 00 03 00 b4 ac 09
The SPS NAL unit (nal_unit_type 33 == (0x42&0x7E)>>1) is 42 01 01 01 40 00 00 03 00 00 03 00 00 03 00 00 03 00 b4 a0 00 c1 08 00 82 1f 79 6b 4a 42 59 2e 30 10 10 00 00 03 00 10 00 00 03 01 e0 80
The PPS NAL unit (nal_unit_type 34 == (0x44&0x7E)>>1) is 44 01 c0 f7 c0 cc 90
Your encoder is generating these NAL units at the start of the stream (*precisely because* they are mandatory). And our streaming (server) software (e.g., when streaming your file “checker.265”) automatically parses these NAL units from the start of the file, and stores them (Base-64-encoded) in the stream’s SDP description, so that receivers (e.g., VLC, or “openRTSP”, using "H265VideoFileSink”) can regenerate them, in case they don’t receive them in the stream.
> Anyways, I found that H265VideoFileSink works while my modified DummySink (as well as my own implementation of a MediaSink) does not.
That’s good. You have something (A) that works, and something (B) that does not work. Therefore, you simply compare (A) with (B), to figure out what your problem is. Which you can easily do, because Remember, You Have Complete Source Code.
But in this case, you have already done the comparison, so you already know what the difference is:
“H265VideoFileSink” writes VPS,SPS,PPS NAL units at the start of the output file, whereas your "modified DummySink” does not.
Therefore, either rewrite your “modified DummySink” so that it does the same thing as “H265VideoFileSink”, or else just use “H265VideoFileSink” instead.
End of Problem.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list