Flyleaf icon indicating copy to clipboard operation
Flyleaf copied to clipboard

reduce avformat_find_stream_info execute duration

Open swimfish09 opened this issue 2 years ago • 5 comments

If i know network stream audio and video metadata before open, Is there any method to reduce avformat_find_stream_info execute duration. audio and video metadata as below:

{
  "videoInfo": {
    "Bitrate": 537,
    "Codec": "h265",
    "Fps": 24,
    "Width": 1920,
    "Height": 1080
  },
  "audioInfo": {
    "Codec": "g711a",
    "SampleBit": 16,
    "SampleRate": 8000
  }
}

swimfish09 avatar May 26 '22 07:05 swimfish09

I think it's the analyzeduration/probesize ffmpeg options so yes you can change them from Config.Demuxer.FormatOpt["analyzeduration"] etc.

Check here the defaults

SuRGeoNix avatar May 26 '22 08:05 SuRGeoNix

If the analyzeduration/probesize ffmpeg options was too small, ffmpeg can not acquire the network stream metadata correctly.

swimfish09 avatar May 26 '22 08:05 swimfish09

I'm not sure if that possible. Requires more ffmpeg research to check whether is possible to achieve faster open with known data (eg. re-open). Maybe this link has some info but I can't really do that research currently.

SuRGeoNix avatar May 26 '22 09:05 SuRGeoNix

ffplay has a option find_stream_info which also maybe used in flyleaf

ffplay.exe -i xxx -fflags nobuffer -nofind_stream_info
 

swimfish09 avatar May 30 '22 00:05 swimfish09

That just skips avformat_find_stream_info. If you do that to Flyleaf currently it will crash as it requires to find pixel format color spaces etc. to work properly. I guess ffplay will fill the codec's default values. I will need to review those.

SuRGeoNix avatar May 30 '22 07:05 SuRGeoNix