The problem is that if I compile ffmpeg WITHOUT support for librtmp (no -enable_librtmp flag) it doesn't work. However, when using librtmp it works.

Trying to figure out what was going on I found out the following:

Native ffmpeg RTMP and librtmp impementations parse in a different way the app and playpath from this URI. In particular, librtmp does it right and native implementations doesn't. Here are the details: