<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 2, 2020 at 9:25 AM <<a href="mailto:bsenftner@earthlink.net">bsenftner@earthlink.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_6112020028265840704WordSection1"><p class="MsoNormal">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. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Using the following AVDictionary setup, the library has been able to handle pretty much every IP camera tried, until we encountered a client with <i>several hundred</i> very old Verint cameras.<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black">  av_dict_set(&mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"threads"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"auto"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0);<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black">  av_dict_set( &mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"refcounted_frames"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"1"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0 );           <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black">  av_dict_set( &mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"sync"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"video"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0 );      <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black">  av_dict_set( &mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"fflags"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"discardcorrupt"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0 );   </span><span style="font-size:8pt;font-family:"Courier New""><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New"">  <span style="color:black">av_dict_set( &mp_opts, </span><span style="color:rgb(163,21,21)">"max_delay"</span><span style="color:black">, </span><span style="color:rgb(163,21,21)">"100000"</span><span style="color:black">, 0 );<u></u><u></u></span></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black"> </span><span style="font-size:8pt;font-family:"Courier New";color:green">// av_dict_set( &mp_opts, "fflags", "nobuffer", 0 );</span><span style="font-size:8pt;font-family:"Courier New";color:black"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:green"> // av_dict_set( &mp_opts, "flags", "low_delay", 0 );</span><span style="font-size:8pt;font-family:"Courier New";color:black"><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black"> // av_dict_set( &mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"rtsp_transport"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"tcp"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0 );    <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black">  av_dict_set( &mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"framerate"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"29.97"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0 );<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black">  av_dict_set( &mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"analyzeduration"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"1000000"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0);<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:8pt;font-family:"Courier New";color:black">  av_dict_set( &mp_opts, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"allowed_media_types"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, </span><span style="font-size:8pt;font-family:"Courier New";color:rgb(163,21,21)">"video"</span><span style="font-size:8pt;font-family:"Courier New";color:black">, 0 );</span><span style="font-size:8pt;font-family:"Courier New""><u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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.  <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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? <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Are there some additional AVDictionary options necessary to get recognition of such an old D1 resolution h264 codec? <u></u><u></u></p><p class="MsoNormal">And is there some additional callback or metadata capture for identifying a dynamic resolution change? <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">-Sincerely,<u></u><u></u></p><p class="MsoNormal">Bsenftner<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p></div></div>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div><br clear="all"><div>Hi 

Bsenftner,</div><div><br></div><div>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.</div>-- <br><div dir="ltr" class="gmail_signature"><br>Regards<br>Strahinja Radman</div></div>