1

what settings are necessary to use h264 lossless encoding? I'm not talking about ffmpeg commandline tool, but about the c api.

I manage to encode video with lossy h264, but I don't know how to set the encoder to lossless.?

I code in MSVC++ and use precompiled libraries. online i found some .ffpreset files (for example libx264-lossless_max.ffpreset) which don't seem to be part of the precompiled version i use (at least they are not in the presets folder). I'm not sure whether ffpreset files are somehow compiled into the library, or whether they can be loaded into the encoder somehow? if so, how would I use such a preset file?

matthias_buehlmann
  • 4,641
  • 6
  • 34
  • 76

1 Answers1

3

you need to set the constant quality mode, and set the desired quality to 0. in x264 commandline this is by x264 --crf 0.

--crf Quality-based VBR (0-51, 0=lossless) [23.0]

in ffmpeg commandline this is done similarly

To have a constant quality (but a variable bitrate), use the option ’-qscale n’ when ’n’ is between 1 (excellent quality) and 31 (worst quality).

if you want to do this programatically, just read the source code to see how the specific options I outlned affect the AVCodecContext structure

Aviad Rozenhek
  • 2,259
  • 3
  • 21
  • 42