remotion-dev / remotion

🎥 Make videos programmatically with React
https://remotion.dev
Other
19.58k stars 952 forks source link

Feature request: Render configuration option for GOP size #4002

Open atticoos opened 2 weeks ago

atticoos commented 2 weeks ago

Feature Request 🛍️

Allow configuring the GOP size of the output video.

Use Case

As Remotion becomes used in more places and its output integrated with more services -- making additional encoding options available will be helpful to avoid re encoding the output video to achieve certain video requirements.

We use Mux for video delivery, and they have a set of standard input properties for video to minimize processing time and avoid re encoding. One requirement is a maximum GOP size of 239

We've been able to satisfy the request of the requirements, such as yup420p pixel format, and specific bitrates with Remotion's existing configuration options. However, longer videos have been flagged as having too high of a GOP size, and end up processing a full re encode:

"non_standard_input_reasons": {
  "video_gop_size": "high"
}

This would be a helpful setting, as we aim to reduce time to availability as much as possible.

Possible Solution

Add gopSize: number as an option to:

JonnyBurger commented 2 weeks ago

Good idea, I am just not familiar with it. Which FFmpeg flags would this expose exactly? What should be the defaults? Which codecs out of the ones that we support support this parameter as well?

atticoos commented 1 week ago

This is ffmpeg's -g flag, and by default, can be omitted unless otherwise specified by a value. While all video codecs that use I/P/B frames have GOPs, different codecs may prefer different GOP configurations but generally have the same implications