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

Set analyzeduration, or similar options #9

Closed
smhk opened this issue Dec 26, 2018 · 2 comments
Closed

Set analyzeduration, or similar options #9

smhk opened this issue Dec 26, 2018 · 2 comments

Comments

@smhk
Copy link

smhk commented Dec 26, 2018

I'm wondering if there's a way to read, and set analyzeduration and similar options,

    let fmtCtx = AVFormatContext()
    fmtCtx.  something  .analyzeduration = 1000

opt.h ...

int av_set_options_string(void *ctx, const char *opts,
                          const char *key_val_sep, const char *pairs_sep);

/**
 * Parse the key-value pairs list in opts. For each key=value pair found,
 * set the value of the corresponding option in ctx.
 * .. etc

analyzeduration is an integer (microseconds)
https://ffmpeg.org/ffmpeg-formats.html

I had a guess at reading it,
let AD = try fmtCtx.integer(forKey: "analyzeduration")
crashes,

I had a guess at this sort of thing,
try fmtCtx.set(1000, forKey: "analyzeduration")
crashes ..

Is it possible?

@sunlubo
Copy link
Owner

sunlubo commented Dec 27, 2018

This code run successfully on my mac, please show me your crash info.

let fmtCtx = try AVFormatContext(url: "/Users/sun/AV/kda.flv")
try fmtCtx.set(1000, forKey: "analyzeduration")
print(try fmtCtx.integer(forKey: "analyzeduration"))
1000
Program ended with exit code: 0

@sunlubo sunlubo closed this as completed Jan 12, 2019
@iT-Boyer
Copy link

iT-Boyer commented Jul 21, 2022

I want to do it this way by options:

 let option:[String:String] = ["probesize":"4096"]
guard let _ = try? fmtCtx.findStreamInfo(options: [option]) else{return}

but print this log:Option 'probesize' not found.

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

3 participants