c++ - Set bitrate of ogg file generated by libsndfile libraries -


i used code below convert sound files ogg vorbis, don't found on documentation of libsndfile how set bitrate of output file, set 128 kb/s. possible change bitrate of output file generated libsndfile?

#include <sndfile.hh>  #define buffer_len 4096  void convert(char *infilename, char *outfilename) {     static double data[buffer_len];     sndfile *infile, *outfile;     sf_info sfinfo;     int readcount;      infile = sf_open(infilename, sfm_read, &sfinfo);     sfinfo.format = sf_format_ogg | sf_format_vorbis;     outfile = sf_open(outfilename, sfm_write, &sfinfo);      while ((readcount = sf_read_double(infile, data, buffer_len)))     {         sf_write_double(outfile, data, readcount);     }      sf_close(infile);     sf_close(outfile); } 

with libsndfile there no way set specific bitrate. setting specific constant bit rate bad idea anyway constant bitrate low parts of sonf , high other parts.

with libsndfile can set various compression levels use variable bitrate. see : http://www.mega-nerd.com/libsndfile/command.html#sfc_set_vbr_encoding_quality


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -