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

Restore ability to explicitly specify container format when opening a file on newer FFmpeg versions / (again) support iterating over formats #212

Open
JohnstonJ opened this issue Sep 22, 2024 · 0 comments

Comments

@JohnstonJ
Copy link

I would like to explicitly specify the format when opening a file. The open function has a format parameter which would appear to do just that. However, I cannot figure out how to obtain an instance of a Format to pass to this function.

As best I can tell, I need to get ahold of a format iterator, loop through that, find the format I want, and then pass it in to the open function. But it looks like that iterator feature is not compiled on FFmpeg >= 5.0:

#[cfg(not(feature = "ffmpeg_5_0"))]
mod iter;
#[cfg(not(feature = "ffmpeg_5_0"))]
pub use self::iter::Iter;

It looks like it must be because the underlying av_iformat_next and av_oformat_next functions were removed from FFmpeg at some point.

Checking the latest avformat.h documentation, I see there are three other functions of interest to get ahold of format structures:

  • av_demuxer_iterate -- iterate over all registered demuxers, returns AVInputFormat
  • av_muxer_iterate --- same but for muxers
  • av_find_input_format --- simple function to get a format by name (this is actually what I'd really want for my use case).
  • av_guess_format --- perform a similar role for finding a specific output format given short name and/or filename and/or MIME type.

I did a code search on GitHub for av_demuxer_iterate and av_find_input_format, and I can't find any hits for this in this repo, so I assume it's simply not supported (as opposed to: I somehow did not find the key function to do what I want). So this issue could be construed as a request to:

  • provide format iterator implementations that are compatible with newer FFmpeg versions (so we don't have to use FFmpeg < 5.0)
  • and/or provide quick access to just get a single format by name
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