Bad H.264 out (extra AUD NAL Units) when looping TS input to UDP output
I've been troubleshooting a Shaka packager issue with the developers, and it was traced back to a VLC problem. Here's the VLC command being used to loop a TS to UDP which is then read by Shaka packager:
cvlc file.TS --sout udp:127.0.0.1:11111 --sout-ts-es-id-pid --ts-es-id-pid --repeat --loop --sout-all --sout-keep --quiet &
It turns out VLC inserts an AUD between SPS/PPS and IDRSlice. Here is the sequence of NAL units from the live stream generated by VLC:
AUD | SPS | PPS | SPS | PPS | AUD | SEI | SEI | SEI | IDR_SLICE | AUD | SEI | NON_IDR_SLICE
This is not compliant to H264 (ITU-T H.264 02/2014) spec.
7.4.1.2.3 Order of NAL units and coded pictures and association to access units • When an access unit delimiter NAL unit is present, it shall be the first NAL unit. There shall be at most one access unit delimiter NAL unit in any access unit.
The TS was created using ffmpeg
, and there are no stray AUD NAL Units in that file.
$ vlc --version
VLC media player 3.0.4 Vetinari (revision 3.0.4-0-gf615db6332)
VLC version 3.0.4 Vetinari (3.0.4-0-gf615db6332)
Compiled by buildd on lcy01-amd64-027.buildd (Oct 7 2018 01:20:32)
Compiler: gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)