Added better detection of resolution switch
av_register_all should only be called once per process