Hi Eeri, Upon re-examination of find_highest_res, I see it does get the aspect ratio from the 720x480 size in ffmpeg_codec_desc. So if I change this default size to 704x576 (4CIF), pjsip will allocate an equivalent sized frame for decoding. I was also mistaken when I said 4CIF used the maximum macroblocks for level 3.0, the table below gives more info: 4CIF: 704x576 => 44x36 mb = 1584 mb, 11/9 ratio pjsip: 720x480 => 45x30 mb = 1350 mb, 3/2 ratio max 3.0: 720x576 => 45x36 mb = 1620 mb, 5/4 ratio So to safely connect to other H264 endpoints at level 3.0, I think the ffmpeg table should use 720x576. I will try that. My understanding of the H264 spec is that each level limits the maximum picture size in terms of macroblocks, but any aspect ratio appears be supported. The spec also limits the bandwidth in terms of macroblocks/sec, for level 3.0 the max mb/s is 40500, max picture size is 1620 mb, so this limit the frame rate to 25 fps when transmitting the largest picture. But smaller pictures at higher framerates are clearly supported. The SDP only offers profile level, the picture size isn't known until the SPS comes in with the video stream, and that typically doesn't happen until after the client requests a fast_picture_update. Bill On 5/21/2014 9:29 AM, Eeri Kask wrote: > On Mon, 19 May 2014 12:15:04 -0400, Bill Gardner wrote: >> [...] >> PJSIP uses the largest possible frame supported by the H264 profile >> level which also has 3/2 aspect ratio, in multiples of 16 pixels (the >> H264 macroblock size). See function find_highest_res() in >> vid_codec_util.c. So at level 3.0 PJSIP allocates a 768x512 frame, >> exactly 3/2 aspect ratio. PJSIP can resize dynamically, but only to >> smaller frame sizes. So when 4CIF comes in at 704x576 (which is a >> slightly larger image but still supported by level 3.0) PJSIP can't >> decode the video and emits error messages. Fortunately an easy >> workaround is to set the profile level to 3.1 and then PJSIP allocates a >> pretty huge frame for decoding. > > Just curious, where does this imposed 3/2 aspect ratio come from? > > (Has it indirectly anything to do with the default 720x480 at 15 for h264 > in PJSIP as in ffmpeg_vid_codecs.c?) > > > If "ITU-T H.264 Appendix A.3.1 e), f), g)" is the proper document then > level 3.0 (max image size in macroblocks = 1620) should support frame > sizes (in pixels) something like from > > 640 x 640 (quadratic) > to > 1808 x 16 (most "nonquadratic") > > according to the size constraints specified there? > > Does SIP/SDP pose additional restrictions? > > > P.S. Would anything change if the other endpoint reduces offered fps? > > Eeri Kask > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org