Skip to content

Make error message more helpful when RTSP stream is used without RTSP support #35

@arseni-mourzenko

Description

@arseni-mourzenko

Using motion for RTSP streams results in the error similar to:

[1] [CRT] [NET] netcam_start: Invalid netcam_url (rtsp://192.168.1.64/live.sdp)

When inspecting the code, I see that the error is actually shown when the regular expression which extracts the different parts of an URI doesn't work.

The regular expression is defined like this:

#ifdef have_av_get_media_type_string    
    const char *re = "(http|ftp|mjpg|rtsp)://(((.*):(.*))@)?"
                     "([^/:]|[-.a-z0-9]+)(:([0-9]+))?($|(/[^:]*))";
#else
    const char *re = "(http|ftp|mjpg)://(((.*):(.*))@)?"
                     "([^/:]|[-.a-z0-9]+)(:([0-9]+))?($|(/[^:]*))";
#endif

which means that if I see the error, the motion package has no support for RTSP. But how would a user know that? The documentation inside the /etc/motion/motion.conf file appears, in this case, misleading:

# URL to use if you are using a network camera, size will be autodetected (incl
http:// ftp:// mjpg:// rstp:// or file:///)
# Must be a URL that returns single jpeg pictures or a raw mjpeg stream. Default
: Not defined
netcam_url rtsp://192.168.1.64:554/live.sdp

In order to help users figure out the origin of the issue, consider showing a more helpful error message. For instance, if RTSP support is not enabled, an additional check could verify that the URI starts by rstp://, and if it does, the error could be:

[1] [CRT] [NET] netcam_start: Invalid netcam_url (rtsp://192.168.1.64/live.sdp). RTSP is not supported by the current build; consider compiling the application with have_av_get_media_type_string option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions