how to reduce h264 annex B NAL unit sizes to avoid IP fragmentation?

1

I'm trying to stream a video over to a terminal using RTP. The video is coded in h.246. I'm using ffmpeg to extract the byte stream according to h.264 annex B :

ffmpeg -i test.h264 -vcodec copy -vbsf h264_mp4toannexb -an out.h264 

This works fine, but some NAL units are bigger than the network MTU and thus they get fragmented by IP when being sent over to the terminal. The terminal seems a little bit lazy and discards fragmented datagrams making the video playback awful.

So basically I need a way to reduce the NAL unit size, any ideas ?

Nicolas Emiliani

Posted 2013-01-25T17:17:37.273

Reputation: 11

size of NAL is decidec by encoder at the time of encoding, nothing can be done at bitstream level. only solution seems like re-encoding. – rajneesh – 2013-01-26T17:05:54.680

@rajneesh thanks for your comment. I've done that. I decoded the video into raw and then reencoded it as h246, but I still get these huge (around 3kb) SPS frames that I can not reduce. – Nicolas Emiliani – 2013-01-28T13:29:24.523

enable multiple slice, each slice can then be put into separate NAL unit.you can choose number of slice per picture according to picture-size, bitrate. – rajneesh – 2013-01-28T17:14:42.250

@rajneesh I've been trying to do what you suggested with no luck, I'm using x264 for the encoding but I still get huge SPSs... this is the line I'm trying : $ x264 --profile baseline --input-res 352x288 --slices 8 --slice-max-size 1200 -o test.h264 --fps 15 --bitrate 90 video.yuv – Nicolas Emiliani – 2013-01-30T13:15:13.583

No answers