[Libav-user] AVDictionary options for very old D1 rtsp stream?

Strahinja Radman dr.strashni at gmail.com
Mon Oct 5 06:58:19 EEST 2020


On Fri, Oct 2, 2020 at 9:25 AM <bsenftner at earthlink.net> wrote:

> I have a libav based player library. Using AVDictionary options, set via
> av_dict_set() and ultimately passed to av_format_open_input(), the library
> handles playing video files, USB cameras, or IP streams.
>
>
>
> Using the following AVDictionary setup, the library has been able to
> handle pretty much every IP camera tried, until we encountered a client
> with *several hundred* very old Verint cameras.
>
>
>
>   av_dict_set(&mp_opts, "threads", "auto", 0);
>
>   av_dict_set( &mp_opts, "refcounted_frames", "1", 0 );
>
>   av_dict_set( &mp_opts, "sync", "video", 0 );
>
>   av_dict_set( &mp_opts, "fflags", "discardcorrupt", 0 );
>
>   av_dict_set( &mp_opts, "max_delay", "100000", 0 );
>
> // av_dict_set( &mp_opts, "fflags", "nobuffer", 0 );
>
> // av_dict_set( &mp_opts, "flags", "low_delay", 0 );
>
> // av_dict_set( &mp_opts, "rtsp_transport", "tcp", 0 );
>
>   av_dict_set( &mp_opts, "framerate", "29.97", 0 );
>
>   av_dict_set( &mp_opts, "analyzeduration", "1000000", 0);
>
>   av_dict_set( &mp_opts, "allowed_media_types", "video", 0 );
>
>
>
> The very old (20 years?) Verint cameras have a maximum resolution of D1
> (720x480), while offering resolutions of CIF, 2CIF and D1, in either h264
> or mjpeg stream formats.
>
>
>
> The h264 stream will play in VLC. With VLC logging set to debug, it looks
> like VLC attempts and fails 16 + 26 + 27 + 13 different h264 wrappers
> before figuring out through (maybe?) emulated DirectX9 hardware a stream
> header for 720x480. Playing and expecting 720x480, a Dx9 message says a
> resolution change occurs setting the stream to 720x540 resolution frames.
> That’s the frame size VLC ultimately displays.
>
>
>
> Trying ffprobe on the rtsp stream, it finds the 720x480 header. But there
> is no mention of a framebuffer resolution change. I know libav and my
> library link with the DirectX libraries, as that’s how I get USB stream
> support. Yet, I’m not familiar with how to handle dynamic resolution
> changes. This resolution change occurs before the first frame, so maybe
> that’s just how this old rtsp codec conventionally worked?
>
>
>
> Are there some additional AVDictionary options necessary to get
> recognition of such an old D1 resolution h264 codec?
>
> And is there some additional callback or metadata capture for identifying
> a dynamic resolution change?
>
>
>
> -Sincerely,
>
> Bsenftner
>
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".


Hi Bsenftner,

The resolution can change in the live streams. The way I solved that
problem was by using the filters. You init the filter with the width and
height data that you have and then if the actual frame size differs you
simply reinitialize the filter (all the AVFrames pass through the filter).
The only problem that I can see is that the encoder will be initialized
with the wrong resolution. Maybe a better way to solve your problem would
be to first decode a couple of frames and then open the output file.
-- 

Regards
Strahinja Radman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20201005/0e3ee877/attachment.html>


More information about the Libav-user mailing list