Passing ffmpeg's -force_key_frames to mpv encoder?
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 37k
- Forks
- 3.5k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 22
Description
I'm using mpv in encoding mode (--o=...), trying to make it so it outputs a keyframe every second, regardless of frame rate (which can potentially vary from 24 to 60fps in one encoding).
The way this is done in ffmpeg is with the helpful parameter -force_key_frames which can take a measure of time or an expression to calculate how often there should be a keyframe.
I've tried adding it as a key/value in --vd-lavc-o and --demuxer-lavf-o but I get AVOption 'force_key_frames' not found and Could not set AVOption force_key_frames='expr:gte(t,n_forced*1)' respectively.
As far as I can tell I can only define my keyframe interval by setting ovcopts-add=g=<number> or ovcopts-add=x264opts=%36%keyint=<number>:min-keyint=<number>:no-scenecut, but these are not capable of defining intervals as time unlike -force_key_frames.
Is there any way to do this with a pre-existing mpv commandline argument without altering the source code? If not, how can I add it as a parameter to my fork of MPV?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing mpv's --vd-lavc-o, --demuxer-lavf-o, and ovcopts-add option handling into the encoder configuration. Check whether any existing entry point can pass FFmpeg's time-based keyframe setting; done means documenting a working command-line approach or identifying the source path required to support it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100