sipsorcery-org / SIPSorceryMedia.FFmpeg

GNU Lesser General Public License v2.1
31 stars 24 forks source link

[Question]How to set quality of encoded images #46

Closed Todilo closed 11 months ago

Todilo commented 1 year ago

As the title states, how do I control the quality of the encoded image?

I tried adding to the FFmpegVideoEncoder constructor a dictionary with "quality","best" but that doesn¨t really effect quality right? I also tried:

 dictionary.Add("crf", "10");
   dictionary.Add("quality", "best");
  dictionary.Add("b:v", "2000k");
new FFmpegVideoEncoder(dictionary)

But I get warning "option not found" . I have been using: https://trac.ffmpeg.org/wiki/Encode/VP8 as reference for parameters but I might be looking in the wrong direction?

If I don't provide any input I get a debug message: [libvpx @ 000001da8decfb80] Neither bitrate nor constrained quality specified, using default CRF of 32 and bitrate of 256kbit/sec

ChristopheI commented 1 year ago

It's not so easy...

For bitrate, I think this should work: dictionary.Add("b", "2000k");

For CRF try: dictionary.Add("VP8E_SET_CQ_LEVEL", "10");

For quality

Reference: https://www.freebsd.org/cgi/man.cgi?query=ffmpeg&sektion=1&apropos=0&manpath=FreeBSD+9.0-RELEASE+and+Ports

Please inform if it's working. I didn't tried on my side. Thanks