chipweinberger / flutter_quick_video_encoder

Quickly encode raw RGB images & PCM audio to MP4 video using the hardware h264 encoder
The Unlicense
7 stars 0 forks source link

Constant Rate Factor? #2

Closed jtkeyva closed 6 months ago

jtkeyva commented 6 months ago

Hello, wondering if there are any plans for CRF or something similar? Maybe it's' not supported?

https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg

Additional options that might be worth considering is setting the Constant Rate Factor, which lowers the average bit rate, but retains better quality. Vary the CRF between around 18 and 24 — the lower, the higher the bitrate.

ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4

chipweinberger commented 6 months ago

sure, open a PR. not sure if supported.

jtkeyva commented 6 months ago

sorry i have no idea how your underlying encoder works or if crf is even doable. looks to work in x264, x265 and libvpx but not sure if that's what yours uses?

chipweinberger commented 6 months ago

the code is all open source.

look at /android and /ios

that should give you a good understanding

jtkeyva commented 6 months ago

it's beyond me...i'm gonna run some file size tests as I would love this to be a viable encoding option. thanks for your work on this :)

chipweinberger commented 6 months ago

with some googling there is no CRF option

we use AVFoundation on iOS and MediaCodec on Android

jtkeyva commented 6 months ago

ahhh thanks for that :)