Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeking back to the beginning of the file in scanFileAndUpdateMetadataAndIndex #455

Open
NicolasHug opened this issue Jan 20, 2025 · 0 comments

Comments

@NicolasHug
Copy link
Member

In scanFileAndUpdateMetadataAndIndex, we first scan the entire file by receiving all packets in the container, calling av_read_frame() until the end of the video:

int ffmpegStatus = av_read_frame(formatContext_.get(), packet.get());

After this scan, we call av_seek_file to go back to the beginning of the file:

int ffmepgStatus =
avformat_seek_file(formatContext_.get(), 0, INT64_MIN, 0, 0, 0);

(docs)

Specifically we pass:

  • 0 as reference stream index
  • 0 as the desired pts location

I wonder if we should instead pass:

  • the best stream's index instead of 0. I feel like the best stream has a higher chance of being the correct reference to use when seeking.
  • minPts as the desired pts location, instead of 0. As we've seen, some videos may start at negative pts values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant