[FFmpeg-user] ffmpeg generated h.264 stream

Kenneth Fields ken.fields at gmail.com
Wed May 25 04:44:13 CEST 2016


Wondering if anyone has any insight about h.264 byte code stream:

The ffmpeg command line is:

      fmpeg\" -s 320x240 -f avfoundation -r 30.00 -i \"0:none\" -c:v libx264 -preset ultrafast -tune zerolatency -x264opts crf=20:vbv-maxrate=3000:vbv-bufsize=100:intra-refresh=1:slice-max-size=1500:keyint=30:ref=1 -b:v 1000 -an -f mpegts -threads 8 -profile:v baseline -level 3.0 -pix_fmt yuv420p udp:// <udp://>"      

  In theory, the elementary stream in h.264 should be like this:      
view here: http://artsmesh.io/notice/15153 <http://artsmesh.io/notice/15153>
So the key is to generate individual NALUs from H.264 stream. So we should get the bitstream like this:       
view here: http://artsmesh.io/conversation/15160 <http://artsmesh.io/conversation/15160>
We need get the real NALU type like this: 0x1F & NALU type. So 0x27 is equal 0x67.

Normally, we should just have these NALU type(after the operation of 0x1F & NALU type):

    1: slice of a non-IDR picture.  (P frame)    

    5: slice of an IDR picture.     (I frame)

    6: Supplemental enhancement information. (SEI)

    7: Sequence parameter set. (SPS parameter)

    8: Picture parameter set. (PPS parameter)",          

    9: Access unit delimiter.

But what I get from udp is like this from the first  UDP packet:

In this udp datagram, something doesn’t make sense, after the 0x00000001start code header, the NALU type is 0xff, and the second one is 0xf0, both of them are undefined in h.264.

view here: http://artsmesh.io/notice/15154 <http://artsmesh.io/notice/15154>
So I’m having trouble finding out why the h.264 stream is not working.

And is that true that the start code header is always four bytes, "0x0000 0001"

Sent out to the ffmpeg list for Whisky Zed

More information about the ffmpeg-user mailing list